Skip to content

Commit 0be395f

Browse files
puriaclaude
andauthored
feat: serve well-known nostr.json via build-time fetch (#206)
Replace meta-refresh redirect with a static Astro endpoint that fetches relay.dyne.org's nostr.json at build time, so curl and other non-browser clients get real JSON instead of an HTML redirect page. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 94eb992 commit 0be395f

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/pages/.well-known/nostr.json.md

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { APIRoute } from 'astro';
2+
3+
const UPSTREAM = 'https://relay.dyne.org/.well-known/nostr.json';
4+
5+
export const GET: APIRoute = async () => {
6+
const res = await fetch(UPSTREAM);
7+
if (!res.ok) {
8+
throw new Error(`Failed to fetch ${UPSTREAM}: ${res.status} ${res.statusText}`);
9+
}
10+
const body = await res.text();
11+
return new Response(body, {
12+
headers: {
13+
'Content-Type': 'application/json; charset=utf-8',
14+
'Access-Control-Allow-Origin': '*',
15+
},
16+
});
17+
};

0 commit comments

Comments
 (0)