From 1c9ae2a07920d1625ed55eb1b496b76724510434 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 28 Jul 2025 14:31:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20GitHub=20=E5=8A=A0?= =?UTF-8?q?=E9=80=9F=E4=BB=A3=E7=90=86(=E5=89=8D=E7=AB=AF=E9=9C=80=20>=3D?= =?UTF-8?q?=202.15.58)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/restful/settings.js | 6 ++++-- backend/src/utils/gist.js | 10 ++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/backend/package.json b/backend/package.json index 9045c8b..64712fc 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.19.96", + "version": "2.19.97", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/restful/settings.js b/backend/src/restful/settings.js index fa623da..5c806de 100644 --- a/backend/src/restful/settings.js +++ b/backend/src/restful/settings.js @@ -61,7 +61,7 @@ async function updateSettings(req, res) { export async function updateAvatar() { const settings = $.read(SETTINGS_KEY); - const { githubUser: username, syncPlatform } = settings; + const { githubUser: username, syncPlatform, githubProxy } = settings; if (username) { if (syncPlatform === 'gitlab') { try { @@ -92,7 +92,9 @@ export async function updateAvatar() { try { const data = await $.http .get({ - url: `https://api.github.com/users/${encodeURIComponent( + url: `${ + githubProxy ? `${githubProxy}/` : '' + }https://api.github.com/users/${encodeURIComponent( username, )}`, headers: { diff --git a/backend/src/utils/gist.js b/backend/src/utils/gist.js index 0aeba25..0864673 100644 --- a/backend/src/utils/gist.js +++ b/backend/src/utils/gist.js @@ -9,7 +9,11 @@ import { SETTINGS_KEY } from '@/constants'; export default class Gist { constructor({ token, key, syncPlatform }) { const { isStash, isLoon, isShadowRocket, isQX } = ENV(); - const { defaultProxy, defaultTimeout: timeout } = $.read(SETTINGS_KEY); + const { + defaultProxy, + defaultTimeout: timeout, + githubProxy, + } = $.read(SETTINGS_KEY); let proxy = defaultProxy; if ($.env.isNode) { proxy = @@ -63,7 +67,9 @@ export default class Gist { 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36', }; this.http = HTTP({ - baseURL: 'https://api.github.com', + baseURL: `${ + githubProxy ? `${githubProxy}/` : '' + }https://api.github.com`, headers: { ...this.headers, ...(isStash && proxy