Reintroduce storage management API, closes #113

This commit is contained in:
Peng-YM 2022-06-16 11:28:15 +08:00
parent 56ada242d2
commit f91f34d644
3 changed files with 14 additions and 3 deletions

View File

@ -6,7 +6,7 @@
* *
* *
* Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket! * Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket!
* @updated: 2022/6/16 10:27:24 * @updated: 2022/6/16 11:22:36
* @version: 2.0 * @version: 2.0
* @author: Peng-YM * @author: Peng-YM
* @github: https://github.com/Peng-YM/Sub-Store * @github: https://github.com/Peng-YM/Sub-Store

View File

@ -27,6 +27,17 @@ export default function serve() {
$app.get('/api/utils/env', getEnv); // get runtime environment $app.get('/api/utils/env', getEnv); // get runtime environment
$app.get('/api/utils/backup', gistBackup); // gist backup actions $app.get('/api/utils/backup', gistBackup); // gist backup actions
// Storage management
$app.route('/api/storage')
.get((req, res) => {
res.json($.read('#sub-store'));
})
.post((req, res) => {
const data = req.body;
$.write(JSON.stringify(data), '#sub-store');
res.end();
});
// Redirect sub.store to vercel webpage // Redirect sub.store to vercel webpage
$app.get('/', async (req, res) => { $app.get('/', async (req, res) => {
// 302 redirect // 302 redirect

File diff suppressed because one or more lines are too long