Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de1f419

Browse files
committed
feat: 备份数据到 Gist 时, 清除 GitHub Token. 恢复后请重新设置 GitHub Token
1 parent bfa1b11 commit de1f419

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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.77",
3+
"version": "2.19.78",
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: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ async function gistBackupAction(action) {
120120
switch (action) {
121121
case 'upload':
122122
try {
123-
content = $.read('#sub-store');
124-
if ($.env.isNode) content = JSON.stringify($.cache, null, ` `);
123+
content = JSON.parse($.read('#sub-store'));
124+
if ($.env.isNode) content = { ...$.cache };
125+
content.settings.gistToken = '恢复后请重新设置 GitHub Token';
126+
content = JSON.stringify(content, null, ` `);
125127
$.info(`下载备份, 与本地内容对比...`);
126128
const onlineContent = await gist.download(
127129
GIST_BACKUP_FILE_NAME,
@@ -137,8 +139,10 @@ async function gistBackupAction(action) {
137139
// update syncTime
138140
settings.syncTime = new Date().getTime();
139141
$.write(settings, SETTINGS_KEY);
140-
content = $.read('#sub-store');
141-
if ($.env.isNode) content = JSON.stringify($.cache, null, ` `);
142+
content = JSON.parse($.read('#sub-store'));
143+
if ($.env.isNode) content = { ...$.cache };
144+
content.settings.gistToken = '恢复后请重新设置 GitHub Token';
145+
content = JSON.stringify(content, null, ` `);
142146
$.info(`上传备份中...`);
143147
try {
144148
await gist.upload({

0 commit comments

Comments
 (0)