Skip to content

Commit e816e5b

Browse files
committed
fix: 尝试修复上传 Gist
1 parent 005051c commit e816e5b

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.19.81",
3+
"version": "2.19.82",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
55
"main": "src/main.js",
66
"scripts": {

backend/src/restful/miscs.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ async function gistBackupAction(action) {
120120
switch (action) {
121121
case 'upload':
122122
try {
123-
content = JSON.parse($.read('#sub-store'));
123+
content = $.read('#sub-store');
124+
content = content ? JSON.parse(content) : {};
124125
if ($.env.isNode) content = JSON.parse(JSON.stringify($.cache));
125126
content.settings.gistToken = '恢复后请重新设置 GitHub Token';
126127
content = JSON.stringify(content, null, ` `);
@@ -139,7 +140,8 @@ async function gistBackupAction(action) {
139140
// update syncTime
140141
settings.syncTime = new Date().getTime();
141142
$.write(settings, SETTINGS_KEY);
142-
content = JSON.parse($.read('#sub-store'));
143+
content = $.read('#sub-store');
144+
content = content ? JSON.parse(content) : {};
143145
if ($.env.isNode) content = JSON.parse(JSON.stringify($.cache));
144146
content.settings.gistToken = '恢复后请重新设置 GitHub Token';
145147
content = JSON.stringify(content, null, ` `);

0 commit comments

Comments
 (0)