From 05f193eb4615e6154bb13743bddf9c29285aaf5f Mon Sep 17 00:00:00 2001 From: K <704496037@qq.com> Date: Sun, 30 Aug 2026 15:27:23 +0800 Subject: [PATCH] test --- backend/package.json | 2 +- backend/src/restful/miscs.js | 22 ++++------------------ backend/src/utils/gist.js | 8 ++++---- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/backend/package.json b/backend/package.json index 5d00e686..c7c12243 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.36.51", + "version": "2.36.52", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "packageManager": "pnpm@11.0.9", diff --git a/backend/src/restful/miscs.js b/backend/src/restful/miscs.js index e5275aa0..a383d7f3 100644 --- a/backend/src/restful/miscs.js +++ b/backend/src/restful/miscs.js @@ -26,8 +26,7 @@ import { } from '@/utils/age'; const GIST_TOKEN_PATH = 'settings.gistToken'; -const GIST_DOWNLOAD_TOKEN_STRATEGY_PATH = - 'settings.gistDownloadTokenStrategy'; +const GIST_DOWNLOAD_TOKEN_STRATEGY_PATH = 'settings.gistDownloadTokenStrategy'; export default function register($app) { // utils @@ -215,11 +214,7 @@ async function decryptGistBackupContent(content, settings, encoding) { return decryptArmorIfPresent(content, ageSecretKey); } -function resolveGistDownloadTokenStrategy( - storedStrategy, - queryStrategy, - keep, -) { +function resolveGistDownloadTokenStrategy(storedStrategy, queryStrategy, keep) { if (queryStrategy !== undefined) { if (queryStrategy !== 'overwrite' && queryStrategy !== 'keep') { throw new RequestInvalidError( @@ -272,10 +267,7 @@ async function gistBackupAction( ); switch (action) { case 'upload': - const gists = await gist.locate(); - let backupContent; - try { const keepAgeSecretKey = isAgeGistBackupEncoding(encoding); @@ -289,7 +281,6 @@ async function gistBackupAction( const downloadedContent = await gist.download( GIST_BACKUP_FILE_NAME, - gists, ); const onlineContent = await decryptGistBackupContent( @@ -337,9 +328,7 @@ async function gistBackupAction( [GIST_BACKUP_FILE_NAME]: { content: uploadContent, }, - }, - {}, - gists, + } ); $.info(`上传备份完成`); @@ -430,10 +419,7 @@ async function gistBackupAction( const tokenPathIndex = keepPaths.indexOf(GIST_TOKEN_PATH); if (tokenStrategy === 'keep' && tokenPathIndex === -1) { keepPaths.push(GIST_TOKEN_PATH); - } else if ( - tokenStrategy === 'overwrite' && - tokenPathIndex !== -1 - ) { + } else if (tokenStrategy === 'overwrite' && tokenPathIndex !== -1) { keepPaths.splice(tokenPathIndex, 1); } if (!keepPaths.includes(GIST_DOWNLOAD_TOKEN_STRATEGY_PATH)) { diff --git a/backend/src/utils/gist.js b/backend/src/utils/gist.js index 3daa6ddd..6086ade2 100644 --- a/backend/src/utils/gist.js +++ b/backend/src/utils/gist.js @@ -199,12 +199,12 @@ export default class Gist { } } - async upload(input, options = {}, gists) { + async upload(input, options = {}) { if (Object.keys(input).length === 0) { return Promise.reject('未提供需上传的文件'); } - const gist = gists !== undefined ? gists : await this.locate(); + const gist = await this.locate(); let files = input; const emptyFileFallback = options.emptyFileFallback; @@ -415,8 +415,8 @@ export default class Gist { } } - async download(filename, gists) { - const gist = gists !== undefined ? gists : await this.locate(); + async download(filename) { + const gist = await this.locate(); if (gist?.id) { try { const { files } = await this.http