diff options
Diffstat (limited to 'packages/console/app/src/lib/github.ts')
| -rw-r--r-- | packages/console/app/src/lib/github.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/console/app/src/lib/github.ts b/packages/console/app/src/lib/github.ts index 5f742aef6..dab317751 100644 --- a/packages/console/app/src/lib/github.ts +++ b/packages/console/app/src/lib/github.ts @@ -1,4 +1,5 @@ import { query } from "@solidjs/router" +import { config } from "~/config" export const github = query(async () => { "use server" @@ -6,11 +7,15 @@ export const github = query(async () => { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", } + const apiBaseUrl = config.github.repoUrl.replace( + "https://github.com/", + "https://api.github.com/repos/", + ) try { const [meta, releases, contributors] = await Promise.all([ - fetch("https://api.github.com/repos/sst/opencode", { headers }).then((res) => res.json()), - fetch("https://api.github.com/repos/sst/opencode/releases", { headers }).then((res) => res.json()), - fetch("https://api.github.com/repos/sst/opencode/contributors?per_page=1", { headers }), + fetch(apiBaseUrl, { headers }).then((res) => res.json()), + fetch(`${apiBaseUrl}/releases`, { headers }).then((res) => res.json()), + fetch(`${apiBaseUrl}/contributors?per_page=1`, { headers }), ]) const [release] = releases const contributorCount = Number.parseInt( |
