mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-26 00:18:05 +08:00
refactor: Migrate to API v2
- Added auto schema migration - Refactored /api/subs, /api/collections, /api/artifacts. Now these APIs will return array instead of object. This enables sorting items in the future.
This commit is contained in:
@@ -2,7 +2,7 @@ import {
|
||||
SETTINGS_KEY,
|
||||
GIST_BACKUP_KEY,
|
||||
GIST_BACKUP_FILE_NAME,
|
||||
} from './constants';
|
||||
} from '@/constants';
|
||||
import { version as substoreVersion } from '../../package.json';
|
||||
import { ENV, HTTP } from '@/vendor/open-api';
|
||||
import express from '@/vendor/express';
|
||||
@@ -15,6 +15,7 @@ import registerArtifactRoutes from './artifacts';
|
||||
import registerDownloadRoutes from './download';
|
||||
import registerSettingRoutes from './settings';
|
||||
import registerPreviewRoutes from './preview';
|
||||
import { success } from '@/restful/response';
|
||||
|
||||
export default function serve() {
|
||||
const $app = express({ substore: $ });
|
||||
@@ -117,15 +118,12 @@ async function gistBackup(req, res) {
|
||||
$.write(content, '#sub-store');
|
||||
if ($.env.isNode) {
|
||||
content = JSON.parse(content);
|
||||
Object.keys(content).forEach((key) => {
|
||||
$.write(content[key], key);
|
||||
});
|
||||
$.cache = content;
|
||||
$.persistCache();
|
||||
}
|
||||
break;
|
||||
}
|
||||
res.json({
|
||||
status: 'success',
|
||||
});
|
||||
success(res);
|
||||
} catch (err) {
|
||||
const msg = `${
|
||||
action === 'upload' ? '上传' : '下载'
|
||||
|
||||
Reference in New Issue
Block a user