Compare commits

...

2 Commits

Author SHA1 Message Date
xream
1c9ae2a079 feat: 支持 GitHub 加速代理(前端需 >= 2.15.58) 2025-07-28 14:31:39 +08:00
xream
22e39dc18f feat: 单条订阅确保没有 subscriptions 字段 2025-07-28 11:26:18 +08:00
4 changed files with 16 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.19.95",
"version": "2.19.97",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {

View File

@@ -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: {

View File

@@ -230,6 +230,7 @@ async function getFlowInfo(req, res) {
function createSubscription(req, res) {
const sub = req.body;
delete sub.subscriptions;
$.info(`正在创建订阅: ${sub.name}`);
if (/\//.test(sub.name)) {
failed(
@@ -262,6 +263,7 @@ function getSubscription(req, res) {
let { raw } = req.query;
const allSubs = $.read(SUBS_KEY);
const sub = findByName(allSubs, name);
delete sub.subscriptions;
if (sub) {
if (raw) {
res.set('content-type', 'application/json')
@@ -292,6 +294,7 @@ function getSubscription(req, res) {
function updateSubscription(req, res) {
let { name } = req.params;
let sub = req.body;
delete sub.subscriptions;
const allSubs = $.read(SUBS_KEY);
const oldSub = findByName(allSubs, name);
if (oldSub) {

View File

@@ -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