mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
feat: 支持 GitHub 加速代理(前端需 >= 2.15.58)
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user