Skip to content

Commit 63064bc

Browse files
committed
feat: Gist 备份默认为 Base64 编码方式
1 parent e81245a commit 63064bc

2 files changed

Lines changed: 9 additions & 9 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.85",
3+
"version": "2.19.86",
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,14 @@ async function gistBackupAction(action, keep, encode) {
128128
content = $.read('#sub-store');
129129
content = content ? JSON.parse(content) : {};
130130
if ($.env.isNode) content = JSON.parse(JSON.stringify($.cache));
131-
if (encode === 'base64') {
132-
content = Base64.encode(
133-
JSON.stringify(content, null, ` `),
134-
);
135-
} else {
131+
if (encode === 'plaintext') {
136132
content.settings.gistToken =
137133
'恢复后请重新设置 GitHub Token';
138134
content = JSON.stringify(content, null, ` `);
135+
} else {
136+
content = Base64.encode(
137+
JSON.stringify(content, null, ` `),
138+
);
139139
}
140140

141141
$.info(`下载备份, 与本地内容对比...`);
@@ -156,11 +156,11 @@ async function gistBackupAction(action, keep, encode) {
156156
content = $.read('#sub-store');
157157
content = content ? JSON.parse(content) : {};
158158
if ($.env.isNode) content = JSON.parse(JSON.stringify($.cache));
159-
if (encode) {
160-
content = Base64.encode(JSON.stringify(content, null, ` `));
161-
} else {
159+
if (encode === 'plaintext') {
162160
content.settings.gistToken = '恢复后请重新设置 GitHub Token';
163161
content = JSON.stringify(content, null, ` `);
162+
} else {
163+
content = Base64.encode(JSON.stringify(content, null, ` `));
164164
}
165165
$.info(`上传备份中...`);
166166
try {

0 commit comments

Comments
 (0)