This commit is contained in:
K committed 2026-08-30 15:27:23 +08:00
1 parent 66f0ee8c7c
commit 05f193eb46
3 files changed
+9 -23

No files matched your search

+1 -1
View File
@@ -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",
+4 -18
View File
@@ -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)) {
+4 -4
View File
@@ -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