From 76df312cb7e671fb24b49ca4fbba8d4efd9382eb Mon Sep 17 00:00:00 2001 From: flycran Date: Mon, 9 Nov 2026 08:33:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20web=20=E6=92=AD=E6=94=BE=E5=99=A8?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E6=97=B6?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=20process=20=E5=AE=88=E5=8D=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 浏览器构建里没有 process,fetchContributions 直接读 process.env.GITHUB_TOKEN 会抛 ReferenceError。加运行时判断,浏览器侧按无 token 处理并回落到 gh-calendar。 --- src/utils/githubContributions.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/githubContributions.ts b/src/utils/githubContributions.ts index 8ac2271..9f83a74 100644 --- a/src/utils/githubContributions.ts +++ b/src/utils/githubContributions.ts @@ -233,7 +233,12 @@ export async function fetchContributions( username: string, options: FetchContributionsOptions = {} ): Promise { - const token = options.token?.trim() || process.env.GITHUB_TOKEN?.trim() + // web 播放器在浏览器里运行,没有 process,按无 token 处理 + const envToken = + typeof process === 'undefined' + ? undefined + : process.env.GITHUB_TOKEN?.trim() + const token = options.token?.trim() || envToken if (token) { return fetchContributionsFromGraphql(username, token, options.limit) From 7259f1aee13ecaec66210a627b5d816d0efb1511 Mon Sep 17 00:00:00 2001 From: flycran Date: Mon, 9 Nov 2026 08:33:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20=E9=87=8D=E6=96=B0=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=20dist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 432578a..81cd5b9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35257,7 +35257,11 @@ async function fetchContributionsFromCalendar(username, limit) { * 否则回落到无需认证的 gh-calendar。 */ async function fetchContributions(username, options = {}) { - const token = options.token?.trim() || process.env.GITHUB_TOKEN?.trim(); + // web 播放器在浏览器里运行,没有 process,按无 token 处理 + const envToken = typeof process === 'undefined' + ? undefined + : process.env.GITHUB_TOKEN?.trim(); + const token = options.token?.trim() || envToken; if (token) { return fetchContributionsFromGraphql(username, token, options.limit); } From dfaab893de72f9025d5163a04294ed949e24152d Mon Sep 17 00:00:00 2001 From: flycran Date: Mon, 9 Nov 2026 08:34:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20=E5=8F=91=E5=B8=83=203.4.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d2a2104..ed14720 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "github-gravity", "description": "Generate an animated SVG of your GitHub contribution graph falling under gravity, with custom text as collision obstacles", - "version": "3.4.0", + "version": "3.4.1", "author": "flycran", "type": "module", "private": true,