diff options
| author | adamelmore <[email protected]> | 2026-01-26 11:57:59 -0600 |
|---|---|---|
| committer | adamelmore <[email protected]> | 2026-01-26 11:58:02 -0600 |
| commit | 3fdd08d66e566579e71b1475d6280d967de1a643 (patch) | |
| tree | fabd5ac33871daf07fa127172c2b9c81014a4b47 | |
| parent | ec2ab639bb60ce42f84d74c04641dc4281e4a82c (diff) | |
| download | opencode-3fdd08d66e566579e71b1475d6280d967de1a643.tar.gz opencode-3fdd08d66e566579e71b1475d6280d967de1a643.zip | |
chore: fix changelog page
| -rw-r--r-- | packages/console/app/src/routes/changelog.json.ts | 15 | ||||
| -rw-r--r-- | packages/console/app/src/routes/changelog/index.tsx | 10 |
2 files changed, 22 insertions, 3 deletions
diff --git a/packages/console/app/src/routes/changelog.json.ts b/packages/console/app/src/routes/changelog.json.ts index 9e3b75e5c..48dd985d7 100644 --- a/packages/console/app/src/routes/changelog.json.ts +++ b/packages/console/app/src/routes/changelog.json.ts @@ -20,6 +20,12 @@ type HighlightGroup = { items: HighlightItem[] } +const cors = { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Methods": "GET, OPTIONS", + "Access-Control-Allow-Headers": "Content-Type, Authorization", +} + const ok = "public, max-age=1, s-maxage=300, stale-while-revalidate=86400, stale-if-error=86400" const error = "public, max-age=1, s-maxage=60, stale-while-revalidate=600, stale-if-error=86400" @@ -106,6 +112,7 @@ export async function GET() { headers: { "Content-Type": "application/json", "Cache-Control": error, + ...cors, }, }) @@ -134,7 +141,15 @@ export async function GET() { headers: { "Content-Type": "application/json", "Cache-Control": ok, + ...cors, }, }, ) } + +export async function OPTIONS() { + return new Response(null, { + status: 200, + headers: cors, + }) +} diff --git a/packages/console/app/src/routes/changelog/index.tsx b/packages/console/app/src/routes/changelog/index.tsx index 2e2818da5..c7dca97a7 100644 --- a/packages/console/app/src/routes/changelog/index.tsx +++ b/packages/console/app/src/routes/changelog/index.tsx @@ -31,11 +31,15 @@ type ChangelogRelease = { sections: { title: string; items: string[] }[] } -async function getReleases() { +function endpoint() { const event = getRequestEvent() - const url = event ? new URL("/changelog.json", event.request.url).toString() : "/changelog.json" + if (event) return new URL("/changelog.json", event.request.url).toString() + if (!import.meta.env.SSR) return "/changelog.json" + return `${config.baseUrl}/changelog.json` +} - const response = await fetch(url).catch(() => undefined) +async function getReleases() { + const response = await fetch(endpoint()).catch(() => undefined) if (!response?.ok) return [] const json = await response.json().catch(() => undefined) |
