Skip to content

Commit 8ce7d58

Browse files
committed
chore: user-agent header
1 parent b622e92 commit 8ce7d58

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/console/app/src/lib/github.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@ import { query } from "@solidjs/router"
22

33
export const github = query(async () => {
44
"use server"
5+
const headers = {
6+
UserAgent:
7+
"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",
8+
}
59
try {
610
const [meta, releases, contributors] = await Promise.all([
7-
fetch("https://api.github.com/repos/sst/opencode").then(async (res) => {
11+
fetch("https://api.github.com/repos/sst/opencode", { headers }).then(async (res) => {
812
const text = await res.text()
913
console.log(text)
1014
const json = JSON.parse(text)
1115
return json
1216
}),
13-
fetch("https://api.github.com/repos/sst/opencode/releases").then(async (res) => {
17+
fetch("https://api.github.com/repos/sst/opencode/releases", { headers }).then(async (res) => {
1418
const text = await res.text()
1519
console.log(text)
1620
const json = JSON.parse(text)
1721
return json
1822
}),
19-
fetch("https://api.github.com/repos/sst/opencode/contributors?per_page=1"),
23+
fetch("https://api.github.com/repos/sst/opencode/contributors?per_page=1", { headers }),
2024
])
2125
const [release] = releases
2226
const contributorCount = Number.parseInt(

0 commit comments

Comments
 (0)