fix: 尝试修复上传 Gist

This commit is contained in:
xream
2025-07-18 13:37:35 +08:00
parent 005051c4ac
commit e816e5b3c0
2 changed files with 5 additions and 3 deletions

View File

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

View File

@@ -120,7 +120,8 @@ async function gistBackupAction(action) {
switch (action) {
case 'upload':
try {
content = JSON.parse($.read('#sub-store'));
content = $.read('#sub-store');
content = content ? JSON.parse(content) : {};
if ($.env.isNode) content = JSON.parse(JSON.stringify($.cache));
content.settings.gistToken = '恢复后请重新设置 GitHub Token';
content = JSON.stringify(content, null, ` `);
@@ -139,7 +140,8 @@ async function gistBackupAction(action) {
// update syncTime
settings.syncTime = new Date().getTime();
$.write(settings, SETTINGS_KEY);
content = JSON.parse($.read('#sub-store'));
content = $.read('#sub-store');
content = content ? JSON.parse(content) : {};
if ($.env.isNode) content = JSON.parse(JSON.stringify($.cache));
content.settings.gistToken = '恢复后请重新设置 GitHub Token';
content = JSON.stringify(content, null, ` `);