mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 02:49:01 +08:00
更新 sub-store.js 兼容 node 服务端
This commit is contained in:
parent
638b510c7a
commit
dbe107681d
8
backend/sub-store.js
Normal file → Executable file
8
backend/sub-store.js
Normal file → Executable file
@ -823,8 +823,8 @@ function service() {
|
||||
const settings = $.read(SETTINGS_KEY);
|
||||
settings.syncTime = new Date().getTime();
|
||||
$.write(settings, SETTINGS_KEY);
|
||||
|
||||
content = $.read("#sub-store");
|
||||
if($.env.isNode) content = JSON.stringify($.cache,null,` `)
|
||||
$.info(`上传备份中...`);
|
||||
await gist.upload({filename: GIST_BACKUP_FILE_NAME, content});
|
||||
break;
|
||||
@ -833,6 +833,12 @@ function service() {
|
||||
content = await gist.download(GIST_BACKUP_FILE_NAME);
|
||||
// restore settings
|
||||
$.write(content, "#sub-store");
|
||||
if($.env.isNode){
|
||||
content = JSON.parse(content)
|
||||
Object.keys(content).forEach(key=>{
|
||||
$.write(content[key],key)
|
||||
})
|
||||
}
|
||||
break;
|
||||
}
|
||||
res.json({
|
||||
|
4
backend/sub-store.min.js
vendored
4
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,3 +1,4 @@
|
||||
const DEBUG = process.env.NODE_ENV === "development";
|
||||
// export const BACKEND_BASE = DEBUG ? `http://localhost:3000` : `https://sub.store`;
|
||||
export const BACKEND_BASE = DEBUG ? `https://sub.store:9999` : `https://sub.store`;
|
||||
const DEBUG = process.env.NODE_ENV === 'development';
|
||||
const domain = process.env.DOMIAN || 'https://sub.store';
|
||||
export const BACKEND_BASE = DEBUG ? `http://localhost:3000` : domain;
|
||||
// export const BACKEND_BASE = DEBUG ? `https://sub.store:9999` : `https://sub.store`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user