mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
chore: user-agent header
This commit is contained in:
@@ -2,21 +2,25 @@ import { query } from "@solidjs/router"
|
|||||||
|
|
||||||
export const github = query(async () => {
|
export const github = query(async () => {
|
||||||
"use server"
|
"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 {
|
try {
|
||||||
const [meta, releases, contributors] = await Promise.all([
|
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()
|
const text = await res.text()
|
||||||
console.log(text)
|
console.log(text)
|
||||||
const json = JSON.parse(text)
|
const json = JSON.parse(text)
|
||||||
return json
|
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()
|
const text = await res.text()
|
||||||
console.log(text)
|
console.log(text)
|
||||||
const json = JSON.parse(text)
|
const json = JSON.parse(text)
|
||||||
return json
|
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 [release] = releases
|
||||||
const contributorCount = Number.parseInt(
|
const contributorCount = Number.parseInt(
|
||||||
|
|||||||
Reference in New Issue
Block a user