Skip to content

Commit 2a6a63d

Browse files
committed
feat: pass user-agent
1 parent cb10296 commit 2a6a63d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/core/card.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export class Generator {
4747
return result;
4848
}
4949

50-
protected async fetch(username: string, site: "us" | "cn"): Promise<FetchedData> {
50+
protected async fetch(
51+
username: string,
52+
site: "us" | "cn",
53+
headers: Record<string, string>,
54+
): Promise<FetchedData> {
5155
this.log("fetching", username, site);
5256
const cache_key = `data-${username.toLowerCase()}-${site}`;
5357

@@ -61,11 +65,11 @@ export class Generator {
6165

6266
try {
6367
if (site === "us") {
64-
const data = await query.us(username);
68+
const data = await query.us(username, headers);
6569
this.cache.put(cache_key, data).catch(console.error);
6670
return data;
6771
} else {
68-
const data = await query.cn(username);
72+
const data = await query.cn(username, headers);
6973
this.cache.put(cache_key, data).catch(console.error);
7074
return data;
7175
}

0 commit comments

Comments
 (0)