mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 22:29:02 +08:00
添加导入数据的接口
This commit is contained in:
parent
fc27450759
commit
77ec9c6953
@ -90,7 +90,9 @@ $app.route("/api/settings")
|
|||||||
$app.get("/api/backup", gistBackup);
|
$app.get("/api/backup", gistBackup);
|
||||||
|
|
||||||
// data
|
// data
|
||||||
$app.get("/api/export", exportData);
|
$app.route("/api/storage")
|
||||||
|
.get(exportData)
|
||||||
|
.post(importData);
|
||||||
|
|
||||||
$app.all("/", async (req, res) => {
|
$app.all("/", async (req, res) => {
|
||||||
res.send("Hello from Sub-Store! Made with ❤️ by Peng-YM.");
|
res.send("Hello from Sub-Store! Made with ❤️ by Peng-YM.");
|
||||||
@ -183,6 +185,12 @@ async function exportData(req, res) {
|
|||||||
res.json($.read("#sub-store"));
|
res.json($.read("#sub-store"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function importData(req, res) {
|
||||||
|
const data = req.body;
|
||||||
|
$.write(JSON.stringify(data), "#sub-store");
|
||||||
|
res.end();
|
||||||
|
}
|
||||||
|
|
||||||
/**************************** API -- Subscriptions ***************************************/
|
/**************************** API -- Subscriptions ***************************************/
|
||||||
// refresh resource
|
// refresh resource
|
||||||
async function refreshResource(req, res) {
|
async function refreshResource(req, res) {
|
||||||
|
2
backend/sub-store.min.js
vendored
2
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user