diff options
| author | Adam <[email protected]> | 2025-10-03 09:27:12 -0500 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-10-03 09:27:12 -0500 |
| commit | 8ce7d58e6d7589d466982ef12aafa7cda50bb24d (patch) | |
| tree | 3182f22999b2d654bbffb343c66c43deae0a951c /packages/console/app/src/lib/github.ts | |
| parent | b622e924b6949e9deef41463bcaeac901d0498f0 (diff) | |
| download | opencode-8ce7d58e6d7589d466982ef12aafa7cda50bb24d.tar.gz opencode-8ce7d58e6d7589d466982ef12aafa7cda50bb24d.zip | |
chore: user-agent header
Diffstat (limited to 'packages/console/app/src/lib/github.ts')
| -rw-r--r-- | packages/console/app/src/lib/github.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/console/app/src/lib/github.ts b/packages/console/app/src/lib/github.ts index 15cbd6cb7..80d3f308f 100644 --- a/packages/console/app/src/lib/github.ts +++ b/packages/console/app/src/lib/github.ts @@ -2,21 +2,25 @@ import { query } from "@solidjs/router" export const github = query(async () => { "use server" + const headers = { + UserAgent: + "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", + } try { const [meta, releases, contributors] = await Promise.all([ - fetch("https://api.github.com/repos/sst/opencode").then(async (res) => { + fetch("https://api.github.com/repos/sst/opencode", { headers }).then(async (res) => { const text = await res.text() console.log(text) const json = JSON.parse(text) return json }), - fetch("https://api.github.com/repos/sst/opencode/releases").then(async (res) => { + fetch("https://api.github.com/repos/sst/opencode/releases", { headers }).then(async (res) => { const text = await res.text() console.log(text) const json = JSON.parse(text) return json }), - fetch("https://api.github.com/repos/sst/opencode/contributors?per_page=1"), + fetch("https://api.github.com/repos/sst/opencode/contributors?per_page=1", { headers }), ]) const [release] = releases const contributorCount = Number.parseInt( |
