@devries-cameron20 / t3code Mirror · read-only / commits / 740a7cc21f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 14:45 UTC

fix(marketing): download page shows its Releases fallback when the GitHub API rejects the request (#28339)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Victor committed Nov 14, 2026 at 06:33 UTC 740a7cc21fadae371ba1c9c2980049c5d7e7d4a3
2 files changed +26 -2
apps/marketing/src/lib/releases.test.ts new
+18
@@ -0,0 +1,18 @@
1 +import { afterEach, describe, expect, it, vi } from "vite-plus/test";
2 +
3 +import { fetchLatestRelease } from "./releases";
4 +
5 +afterEach(() => {
6 + vi.unstubAllGlobals();
7 +});
8 +
9 +describe("fetchLatestRelease", () => {
10 + it("rejects a GitHub API error response instead of returning it as a release", async () => {
11 + vi.stubGlobal("sessionStorage", { getItem: () => null });
12 + vi.stubGlobal("fetch", async () =>
13 + Response.json({ message: "API rate limit exceeded" }, { status: 403 }),
14 + );
15 +
16 + await expect(fetchLatestRelease("stable")).rejects.toThrow("403");
17 + });
18 +});
apps/marketing/src/lib/releases.ts
+8 -2
@@ -25,12 +25,18 @@ function cacheKey(channel: ReleaseChannel) {
25 return `t3code-${channel}-release`;
26 }
27
28 +async function fetchJson<T>(url: string): Promise<T> {
29 + const response = await fetch(url);
30 + if (!response.ok) throw new Error(`GitHub API responded ${response.status}`);
31 + return response.json();
32 +}
33 +
34 async function fetchStable(): Promise<Release> {
29 - return fetch(LATEST_API_URL).then((r) => r.json());
35 + return fetchJson(LATEST_API_URL);
36 }
37
38 async function fetchNightly(): Promise<Release> {
33 - const list: Release[] = await fetch(LIST_API_URL).then((r) => r.json());
39 + const list = await fetchJson<Release[]>(LIST_API_URL);
40 const nightly = Array.isArray(list)
41 ? list.find((release) => release.tag_name?.includes("-nightly."))
42 : undefined;