My landing page, written in Astro hayden.moe
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: move webfinger endpoint to an api route

+24 -9
-9
public/.well-known/webfinger
··· 1 - { 2 - "subject": "acct:hayden@hayden.moe", 3 - "links": [ 4 - { 5 - "rel": "http://openid.net/specs/connect/1.0/issuer", 6 - "href": "https://sso.hayden.moe/application/o/tailscale/" 7 - } 8 - ] 9 - }
+24
src/pages/.well-known/webfinger.ts
··· 1 + import type { APIContext } from "astro"; 2 + 3 + export const prerender = false; 4 + 5 + export const GET = async (c: APIContext) => { 6 + const res = c.url.searchParams.get('resource'); 7 + if (!res) { 8 + return Response.json({ error: 'missing resource query' }, { status: 400 }); 9 + } 10 + 11 + if (!res.startsWith('acct:')) { 12 + return Response.json({ error: 'this endpoint only supports acct: resources' }, { status: 400 }); 13 + } 14 + 15 + return Response.json({ 16 + subject: res, 17 + links: [ 18 + { 19 + rel: "http://openid.net/specs/connect/1.0/issuer", 20 + href: "https://sso.hayden.moe/application/o/tailscale/" 21 + } 22 + ] 23 + }); 24 + }