feat: 模块版文件中增加 token 路由

This commit is contained in:
xream
2024-11-08 18:10:39 +08:00
parent 64d13d954d
commit 3ff2ad5873
3 changed files with 5 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.413",
"version": "2.14.414",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@@ -21,6 +21,7 @@ import registerSettingRoutes from '@/restful/settings';
import registerMiscRoutes from '@/restful/miscs';
import registerSortRoutes from '@/restful/sort';
import registerFileRoutes from '@/restful/file';
import registerTokenRoutes from '@/restful/token';
import registerModuleRoutes from '@/restful/module';
migrate();
@@ -32,6 +33,7 @@ function serve() {
// register routes
registerCollectionRoutes($app);
registerSubscriptionRoutes($app);
registerTokenRoutes($app);
registerFileRoutes($app);
registerModuleRoutes($app);
registerArtifactRoutes($app);

View File

@@ -140,7 +140,7 @@ async function signToken(req, res) {
);
}
}
const secret = eval('process.env.SUB_STORE_FRONTEND_BACKEND_PATH');
// const secret = eval('process.env.SUB_STORE_FRONTEND_BACKEND_PATH');
const nanoid = eval(`require("nanoid")`);
const tokens = $.read(TOKENS_KEY) || [];
// const now = Date.now();
@@ -166,7 +166,7 @@ async function signToken(req, res) {
$.write(tokens, TOKENS_KEY);
return success(res, {
token,
secret,
// secret,
});
} catch (e) {
return failed(