mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 07:29:03 +08:00
Merge pull request #61 from dompling/master
更新 sub-store.js 兼容 node 服务端
This commit is contained in:
commit
4d1c9a49ac
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
40
nginx/front.conf
Normal file
40
nginx/front.conf
Normal file
@ -0,0 +1,40 @@
|
||||
upstream api {
|
||||
server 0.0.0.0:3000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 6080;
|
||||
# allow 127.0.0.1;
|
||||
# allow 0.0.0.0;
|
||||
# deny all;
|
||||
|
||||
gzip on;
|
||||
gzip_static on;
|
||||
gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript;
|
||||
gzip_proxied any;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.0;
|
||||
|
||||
location / {
|
||||
root /Sub-Store/web/dist;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://api;
|
||||
}
|
||||
|
||||
location /download {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://api;
|
||||
}
|
||||
|
||||
}
|
@ -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