Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

site.ts

30 lines1.2 KB

1export const GITHUB_REPOSITORY_URL = "https://github.com/pingdotgg/t3code";
2​
3export const IOS_APP_STORE_URL =
4 "https://apps.apple.com/us/app/t3-code-remote-claude-more/id6787819824";
5​
6export const ANDROID_PLAY_STORE_URL =
7 "https://play.google.com/store/apps/details?id=com.t3tools.t3code";
8​
9// Runs at build time, so each deploy picks up the current count.
10async function fetchGithubStars(): Promise<string> {
11 const token = process.env.GITHUB_TOKEN;
12 try {
13 const response = await fetch("https://api.github.com/repos/pingdotgg/t3code", {
14 headers: token ? { Authorization: `Bearer ${token}` } : {},
15 });
16 if (!response.ok) throw new Error(`GitHub API responded ${response.status}`);
17 const { stargazers_count: stars } = (await response.json()) as { stargazers_count: number };
18 return stars < 1000 ? String(stars) : `${Math.floor(stars / 1000)}k+`;
19 } catch (error) {
20 // A deploy must not ship a made-up count; offline dev should still render.
21 if (import.meta.env.PROD) throw new Error("Could not fetch GitHub stars", { cause: error });
22 console.warn("Could not fetch GitHub stars", error);
23 return "?";
24 }
26​
27export const MARKETING_STATS = {
28 githubStars: await fetchGithubStars(),
29 users: "500,000",
30} as const;