mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-06-16 02:37:19 +08:00
feat: 手动下载备份文件和使用备份上传恢复(前端版本 > 2.14.15
)
This commit is contained in:
parent
c2499f6779
commit
000e90d114
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.109",
|
"version": "2.14.110",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -22,12 +22,26 @@ export default function register($app) {
|
|||||||
// Storage management
|
// Storage management
|
||||||
$app.route('/api/storage')
|
$app.route('/api/storage')
|
||||||
.get((req, res) => {
|
.get((req, res) => {
|
||||||
res.json($.read('#sub-store'));
|
res.set('content-type', 'application/json')
|
||||||
|
.set(
|
||||||
|
'content-disposition',
|
||||||
|
'attachment; filename="sub-store.json"',
|
||||||
|
)
|
||||||
|
.send(
|
||||||
|
$.env.isNode
|
||||||
|
? JSON.stringify($.cache)
|
||||||
|
: $.read('#sub-store'),
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.post((req, res) => {
|
.post((req, res) => {
|
||||||
const data = req.body;
|
const { content } = req.body;
|
||||||
$.write(JSON.stringify(data), '#sub-store');
|
$.write(content, '#sub-store');
|
||||||
res.end();
|
if ($.env.isNode) {
|
||||||
|
$.cache = JSON.parse(content);
|
||||||
|
$.persistCache();
|
||||||
|
}
|
||||||
|
migrate();
|
||||||
|
success(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Redirect sub.store to vercel webpage
|
// Redirect sub.store to vercel webpage
|
||||||
|
@ -10,7 +10,12 @@ export default function register($app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getSettings(req, res) {
|
async function getSettings(req, res) {
|
||||||
const settings = $.read(SETTINGS_KEY);
|
let settings = $.read(SETTINGS_KEY);
|
||||||
|
if (!settings) {
|
||||||
|
settings = {};
|
||||||
|
$.write(settings, SETTINGS_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
if (!settings.avatarUrl) await updateGitHubAvatar();
|
if (!settings.avatarUrl) await updateGitHubAvatar();
|
||||||
if (!settings.artifactStore) await updateArtifactStore();
|
if (!settings.artifactStore) await updateArtifactStore();
|
||||||
success(res, settings);
|
success(res, settings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user