mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15b55f6d1a | ||
|
|
8e5ce26e7b | ||
|
|
c5d8aff73c | ||
|
|
5696492dde | ||
|
|
e6d05fd873 | ||
|
|
4111b8fabf | ||
|
|
dfc619a181 | ||
|
|
ff5283a66f | ||
|
|
6c54518e84 | ||
|
|
dd92a26e6c | ||
|
|
bb5c9d43d0 | ||
|
|
e54ac92357 | ||
|
|
507e37021c |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.18.5",
|
"version": "2.19.3",
|
||||||
"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": {
|
||||||
@@ -27,10 +27,12 @@
|
|||||||
"automerge": "1.0.1-preview.7",
|
"automerge": "1.0.1-preview.7",
|
||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
|
"dotenv": "^16.4.7",
|
||||||
"connect-history-api-fallback": "^2.0.0",
|
"connect-history-api-fallback": "^2.0.0",
|
||||||
"cron": "^3.1.6",
|
"cron": "^3.1.6",
|
||||||
"dns-packet": "^5.6.1",
|
"dns-packet": "^5.6.1",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
"mime-types": "^2.1.35",
|
||||||
"http-proxy-middleware": "^3.0.3",
|
"http-proxy-middleware": "^3.0.3",
|
||||||
"ip-address": "^9.0.5",
|
"ip-address": "^9.0.5",
|
||||||
"js-base64": "^3.7.2",
|
"js-base64": "^3.7.2",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
* @documentation: https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46
|
* @documentation: https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46
|
||||||
*/
|
*/
|
||||||
import { version } from '../package.json';
|
import { version } from '../package.json';
|
||||||
|
import $ from '@/core/app';
|
||||||
console.log(
|
console.log(
|
||||||
`
|
`
|
||||||
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
||||||
@@ -18,7 +19,6 @@ console.log(
|
|||||||
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
|
|
||||||
import migrate from '@/utils/migration';
|
import migrate from '@/utils/migration';
|
||||||
import serve from '@/restful';
|
import serve from '@/restful';
|
||||||
|
|
||||||
|
|||||||
@@ -89,8 +89,10 @@ async function doSync() {
|
|||||||
const allSubs = $.read(SUBS_KEY);
|
const allSubs = $.read(SUBS_KEY);
|
||||||
const allCols = $.read(COLLECTIONS_KEY);
|
const allCols = $.read(COLLECTIONS_KEY);
|
||||||
const subNames = [];
|
const subNames = [];
|
||||||
|
let enabledCount = 0;
|
||||||
allArtifacts.map((artifact) => {
|
allArtifacts.map((artifact) => {
|
||||||
if (artifact.sync && artifact.source) {
|
if (artifact.sync && artifact.source) {
|
||||||
|
enabledCount++;
|
||||||
if (artifact.type === 'subscription') {
|
if (artifact.type === 'subscription') {
|
||||||
const subName = artifact.source;
|
const subName = artifact.source;
|
||||||
const sub = findByName(allSubs, subName);
|
const sub = findByName(allSubs, subName);
|
||||||
@@ -111,6 +113,13 @@ async function doSync() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (enabledCount === 0) {
|
||||||
|
$.info(
|
||||||
|
`需同步的配置: ${enabledCount}, 总数: ${allArtifacts.length}`,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (subNames.length > 0) {
|
if (subNames.length > 0) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
subNames.map(async (subName) => {
|
subNames.map(async (subName) => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
||||||
import { COLLECTIONS_KEY, ARTIFACTS_KEY } from '@/constants';
|
import { COLLECTIONS_KEY, ARTIFACTS_KEY, FILES_KEY } from '@/constants';
|
||||||
import { failed, success } from '@/restful/response';
|
import { failed, success } from '@/restful/response';
|
||||||
import $ from '@/core/app';
|
import $ from '@/core/app';
|
||||||
import { RequestInvalidError, ResourceNotFoundError } from '@/restful/errors';
|
import { RequestInvalidError, ResourceNotFoundError } from '@/restful/errors';
|
||||||
@@ -106,7 +106,18 @@ function updateCollection(req, res) {
|
|||||||
artifact.source = newCol.name;
|
artifact.source = newCol.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// update all files referring this collection
|
||||||
|
const allFiles = $.read(FILES_KEY) || [];
|
||||||
|
for (const file of allFiles) {
|
||||||
|
if (
|
||||||
|
file.sourceType === 'collection' &&
|
||||||
|
file.sourceName === oldCol.name
|
||||||
|
) {
|
||||||
|
file.sourceName = newCol.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
$.write(allArtifacts, ARTIFACTS_KEY);
|
$.write(allArtifacts, ARTIFACTS_KEY);
|
||||||
|
$.write(allFiles, FILES_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateByName(allCols, name, newCol);
|
updateByName(allCols, name, newCol);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
||||||
import { getFlowHeaders, normalizeFlowHeader } from '@/utils/flow';
|
import { getFlowHeaders, normalizeFlowHeader } from '@/utils/flow';
|
||||||
import { FILES_KEY } from '@/constants';
|
import { FILES_KEY, ARTIFACTS_KEY } from '@/constants';
|
||||||
import { failed, success } from '@/restful/response';
|
import { failed, success } from '@/restful/response';
|
||||||
import $ from '@/core/app';
|
import $ from '@/core/app';
|
||||||
import {
|
import {
|
||||||
@@ -245,6 +245,20 @@ function updateFile(req, res) {
|
|||||||
};
|
};
|
||||||
$.info(`正在更新文件:${name}...`);
|
$.info(`正在更新文件:${name}...`);
|
||||||
|
|
||||||
|
if (name !== newFile.name) {
|
||||||
|
// update all artifacts referring this collection
|
||||||
|
const allArtifacts = $.read(ARTIFACTS_KEY) || [];
|
||||||
|
for (const artifact of allArtifacts) {
|
||||||
|
if (
|
||||||
|
artifact.type === 'file' &&
|
||||||
|
artifact.source === oldFile.name
|
||||||
|
) {
|
||||||
|
artifact.source = newFile.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.write(allArtifacts, ARTIFACTS_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
updateByName(allFiles, name, newFile);
|
updateByName(allFiles, name, newFile);
|
||||||
$.write(allFiles, FILES_KEY);
|
$.write(allFiles, FILES_KEY);
|
||||||
success(res, newFile);
|
success(res, newFile);
|
||||||
|
|||||||
@@ -29,6 +29,72 @@ export default function serve() {
|
|||||||
host = eval('process.env.SUB_STORE_BACKEND_API_HOST') || '::';
|
host = eval('process.env.SUB_STORE_BACKEND_API_HOST') || '::';
|
||||||
}
|
}
|
||||||
const $app = express({ substore: $, port, host });
|
const $app = express({ substore: $, port, host });
|
||||||
|
if ($.env.isNode) {
|
||||||
|
const be_merge = eval('process.env.SUB_STORE_BACKEND_MERGE');
|
||||||
|
const be_prefix = eval('process.env.SUB_STORE_BACKEND_PREFIX');
|
||||||
|
const fe_be_path = eval('process.env.SUB_STORE_FRONTEND_BACKEND_PATH');
|
||||||
|
const fe_path = eval('process.env.SUB_STORE_FRONTEND_PATH');
|
||||||
|
if (be_prefix || be_merge) {
|
||||||
|
if(!fe_be_path.startsWith('/')){
|
||||||
|
throw new Error(
|
||||||
|
'SUB_STORE_FRONTEND_BACKEND_PATH should start with /',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (be_merge) {
|
||||||
|
$.info(`[BACKEND] MERGE mode is [ON].`);
|
||||||
|
$.info(`[BACKEND && FRONTEND] ${host}:${port}`);
|
||||||
|
}
|
||||||
|
$.info(`[BACKEND PREFIX] ${host}:${port}${fe_be_path}`);
|
||||||
|
$app.use((req, res, next) => {
|
||||||
|
if (req.path.startsWith(fe_be_path)) {
|
||||||
|
req.url = req.url.replace(fe_be_path, '') || '/';
|
||||||
|
if(be_merge && req.url.startsWith('/api/')){
|
||||||
|
req.query['share'] = 'true';
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const pathname = decodeURIComponent(req._parsedUrl.pathname) || '/';
|
||||||
|
if(be_merge && req.path.startsWith('/share/') && req.query.token){
|
||||||
|
if (req.method.toLowerCase() !== 'get'){
|
||||||
|
res.status(405).send('Method not allowed');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tokens = $.read(TOKENS_KEY) || [];
|
||||||
|
const token = tokens.find(
|
||||||
|
(t) =>
|
||||||
|
t.token === req.query.token &&
|
||||||
|
`/share/${t.type}/${t.name}` === pathname &&
|
||||||
|
(t.exp == null || t.exp > Date.now()),
|
||||||
|
);
|
||||||
|
if (token){
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (be_merge && fe_path && req.path.indexOf('/',1) == -1) {
|
||||||
|
if (req.path.indexOf('.') == -1){
|
||||||
|
req.url = "/index.html"
|
||||||
|
}
|
||||||
|
const express_ = eval(`require("express")`);
|
||||||
|
const mime_ = eval(`require("mime-types")`);
|
||||||
|
const path_ = eval(`require("path")`);
|
||||||
|
const staticFileMiddleware = express_.static(fe_path, {
|
||||||
|
setHeaders: (res, path) => {
|
||||||
|
const type = mime_.contentType(path_.extname(path));
|
||||||
|
if (type) {
|
||||||
|
res.set('Content-Type', type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
staticFileMiddleware(req, res, next);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.status(403).end('Forbbiden');
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
// register routes
|
// register routes
|
||||||
registerCollectionRoutes($app);
|
registerCollectionRoutes($app);
|
||||||
registerSubscriptionRoutes($app);
|
registerSubscriptionRoutes($app);
|
||||||
@@ -175,7 +241,8 @@ export default function serve() {
|
|||||||
const fe_abs_path = path.resolve(
|
const fe_abs_path = path.resolve(
|
||||||
fe_path || path.join(__dirname, 'frontend'),
|
fe_path || path.join(__dirname, 'frontend'),
|
||||||
);
|
);
|
||||||
if (fe_path) {
|
const be_merge = eval('process.env.SUB_STORE_BACKEND_MERGE');
|
||||||
|
if (fe_path && !be_merge) {
|
||||||
try {
|
try {
|
||||||
fs.accessSync(path.join(fe_abs_path, 'index.html'));
|
fs.accessSync(path.join(fe_abs_path, 'index.html'));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -200,6 +267,9 @@ export default function serve() {
|
|||||||
let be_download_rewrite = '';
|
let be_download_rewrite = '';
|
||||||
let be_api_rewrite = '';
|
let be_api_rewrite = '';
|
||||||
let be_share_rewrite = `${be_share}:type/:name`;
|
let be_share_rewrite = `${be_share}:type/:name`;
|
||||||
|
let prefix = eval('process.env.SUB_STORE_BACKEND_PREFIX')
|
||||||
|
? fe_be_path
|
||||||
|
: '';
|
||||||
if (fe_be_path) {
|
if (fe_be_path) {
|
||||||
if (!fe_be_path.startsWith('/')) {
|
if (!fe_be_path.startsWith('/')) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -216,7 +286,7 @@ export default function serve() {
|
|||||||
app.use(
|
app.use(
|
||||||
be_share_rewrite,
|
be_share_rewrite,
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
target: `http://127.0.0.1:${port}`,
|
target: `http://127.0.0.1:${port}${prefix}`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: async (path, req) => {
|
pathRewrite: async (path, req) => {
|
||||||
if (req.method.toLowerCase() !== 'get')
|
if (req.method.toLowerCase() !== 'get')
|
||||||
@@ -237,7 +307,7 @@ export default function serve() {
|
|||||||
app.use(
|
app.use(
|
||||||
be_api_rewrite,
|
be_api_rewrite,
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
target: `http://127.0.0.1:${port}${be_api}`,
|
target: `http://127.0.0.1:${port}${prefix}${be_api}`,
|
||||||
pathRewrite: async (path) => {
|
pathRewrite: async (path) => {
|
||||||
return path.includes('?')
|
return path.includes('?')
|
||||||
? `${path}&share=true`
|
? `${path}&share=true`
|
||||||
@@ -248,7 +318,7 @@ export default function serve() {
|
|||||||
app.use(
|
app.use(
|
||||||
be_download_rewrite,
|
be_download_rewrite,
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
target: `http://127.0.0.1:${port}${be_download}`,
|
target: `http://127.0.0.1:${port}${prefix}${be_download}`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -269,10 +339,10 @@ export default function serve() {
|
|||||||
$.info(`[FRONTEND] ${fe_address}:${fe_port}`);
|
$.info(`[FRONTEND] ${fe_address}:${fe_port}`);
|
||||||
if (fe_be_path) {
|
if (fe_be_path) {
|
||||||
$.info(
|
$.info(
|
||||||
`[FRONTEND -> BACKEND] ${fe_address}:${fe_port}${be_api_rewrite} -> http://127.0.0.1:${port}${be_api}`,
|
`[FRONTEND -> BACKEND] ${fe_address}:${fe_port}${be_api_rewrite} -> ${host}:${port}${prefix}${be_api}`,
|
||||||
);
|
);
|
||||||
$.info(
|
$.info(
|
||||||
`[FRONTEND -> BACKEND] ${fe_address}:${fe_port}${be_download_rewrite} -> http://127.0.0.1:${port}${be_download}`,
|
`[FRONTEND -> BACKEND] ${fe_address}:${fe_port}${be_download_rewrite} -> ${host}:${port}${prefix}${be_download}`,
|
||||||
);
|
);
|
||||||
$.info(
|
$.info(
|
||||||
`[SHARE BACKEND] ${fe_address}:${fe_port}${be_share_rewrite}`,
|
`[SHARE BACKEND] ${fe_address}:${fe_port}${be_share_rewrite}`,
|
||||||
|
|||||||
@@ -134,11 +134,15 @@ export async function updateArtifactStore() {
|
|||||||
settings.artifactStore = url;
|
settings.artifactStore = url;
|
||||||
settings.artifactStoreStatus = 'VALID';
|
settings.artifactStoreStatus = 'VALID';
|
||||||
} else {
|
} else {
|
||||||
$.error(`找不到 Sub-Store Gist`);
|
$.error(`找不到 Sub-Store Gist (${ARTIFACT_REPOSITORY_KEY})`);
|
||||||
settings.artifactStoreStatus = 'NOT FOUND';
|
settings.artifactStoreStatus = 'NOT FOUND';
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
$.error(`查找 Sub-Store Gist 时发生错误: ${err.message ?? err}`);
|
$.error(
|
||||||
|
`查找 Sub-Store Gist (${ARTIFACT_REPOSITORY_KEY}) 时发生错误: ${
|
||||||
|
err.message ?? err
|
||||||
|
}`,
|
||||||
|
);
|
||||||
settings.artifactStoreStatus = 'ERROR';
|
settings.artifactStoreStatus = 'ERROR';
|
||||||
}
|
}
|
||||||
$.write(settings, SETTINGS_KEY);
|
$.write(settings, SETTINGS_KEY);
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ import {
|
|||||||
RequestInvalidError,
|
RequestInvalidError,
|
||||||
} from './errors';
|
} from './errors';
|
||||||
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
||||||
import { SUBS_KEY, COLLECTIONS_KEY, ARTIFACTS_KEY } from '@/constants';
|
import {
|
||||||
|
SUBS_KEY,
|
||||||
|
COLLECTIONS_KEY,
|
||||||
|
ARTIFACTS_KEY,
|
||||||
|
FILES_KEY,
|
||||||
|
} from '@/constants';
|
||||||
import {
|
import {
|
||||||
getFlowHeaders,
|
getFlowHeaders,
|
||||||
parseFlowHeaders,
|
parseFlowHeaders,
|
||||||
@@ -320,9 +325,20 @@ function updateSubscription(req, res) {
|
|||||||
artifact.source = sub.name;
|
artifact.source = sub.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// update all files referring this subscription
|
||||||
|
const allFiles = $.read(FILES_KEY) || [];
|
||||||
|
for (const file of allFiles) {
|
||||||
|
if (
|
||||||
|
file.sourceType === 'subscription' &&
|
||||||
|
file.sourceName == name
|
||||||
|
) {
|
||||||
|
file.sourceName = sub.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$.write(allCols, COLLECTIONS_KEY);
|
$.write(allCols, COLLECTIONS_KEY);
|
||||||
$.write(allArtifacts, ARTIFACTS_KEY);
|
$.write(allArtifacts, ARTIFACTS_KEY);
|
||||||
|
$.write(allFiles, FILES_KEY);
|
||||||
}
|
}
|
||||||
updateByName(allSubs, name, newSub);
|
updateByName(allSubs, name, newSub);
|
||||||
$.write(allSubs, SUBS_KEY);
|
$.write(allSubs, SUBS_KEY);
|
||||||
|
|||||||
@@ -556,8 +556,10 @@ async function syncArtifacts() {
|
|||||||
const allSubs = $.read(SUBS_KEY);
|
const allSubs = $.read(SUBS_KEY);
|
||||||
const allCols = $.read(COLLECTIONS_KEY);
|
const allCols = $.read(COLLECTIONS_KEY);
|
||||||
const subNames = [];
|
const subNames = [];
|
||||||
|
let enabledCount = 0;
|
||||||
allArtifacts.map((artifact) => {
|
allArtifacts.map((artifact) => {
|
||||||
if (artifact.sync && artifact.source) {
|
if (artifact.sync && artifact.source) {
|
||||||
|
enabledCount++;
|
||||||
if (artifact.type === 'subscription') {
|
if (artifact.type === 'subscription') {
|
||||||
const subName = artifact.source;
|
const subName = artifact.source;
|
||||||
const sub = findByName(allSubs, subName);
|
const sub = findByName(allSubs, subName);
|
||||||
@@ -578,6 +580,13 @@ async function syncArtifacts() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (enabledCount === 0) {
|
||||||
|
$.info(
|
||||||
|
`需同步的配置: ${enabledCount}, 总数: ${allArtifacts.length}`,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (subNames.length > 0) {
|
if (subNames.length > 0) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
subNames.map(async (subName) => {
|
subNames.map(async (subName) => {
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ export default class Gist {
|
|||||||
return Promise.reject(err);
|
return Promise.reject(err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject('找不到 Sub-Store Gist');
|
return Promise.reject(`找不到 Sub-Store Gist (${this.key})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import {
|
|||||||
SCHEMA_VERSION_KEY,
|
SCHEMA_VERSION_KEY,
|
||||||
ARTIFACTS_KEY,
|
ARTIFACTS_KEY,
|
||||||
RULES_KEY,
|
RULES_KEY,
|
||||||
|
FILES_KEY,
|
||||||
|
TOKENS_KEY,
|
||||||
} from '@/constants';
|
} from '@/constants';
|
||||||
import $ from '@/core/app';
|
import $ from '@/core/app';
|
||||||
|
|
||||||
@@ -55,7 +57,17 @@ function doMigrationV2() {
|
|||||||
const newRules = Object.values(rules);
|
const newRules = Object.values(rules);
|
||||||
$.write(newRules, RULES_KEY);
|
$.write(newRules, RULES_KEY);
|
||||||
|
|
||||||
// 5. delete builtin rules
|
// 5. migrate files
|
||||||
|
const files = $.read(FILES_KEY) || {};
|
||||||
|
const newFiles = Object.values(files);
|
||||||
|
$.write(newFiles, FILES_KEY);
|
||||||
|
|
||||||
|
// 6. migrate tokens
|
||||||
|
const tokens = $.read(TOKENS_KEY) || {};
|
||||||
|
const newTokens = Object.values(tokens);
|
||||||
|
$.write(newTokens, TOKENS_KEY);
|
||||||
|
|
||||||
|
// 7. delete builtin rules
|
||||||
delete $.cache.builtin;
|
delete $.cache.builtin;
|
||||||
$.info('Migration complete!');
|
$.info('Migration complete!');
|
||||||
|
|
||||||
|
|||||||
4
backend/src/vendor/open-api.js
vendored
4
backend/src/vendor/open-api.js
vendored
@@ -18,6 +18,10 @@ export class OpenAPI {
|
|||||||
this.http = HTTP();
|
this.http = HTTP();
|
||||||
this.env = ENV();
|
this.env = ENV();
|
||||||
|
|
||||||
|
if (isNode) {
|
||||||
|
const dotenv = eval(`require("dotenv")`);
|
||||||
|
dotenv.config();
|
||||||
|
}
|
||||||
this.node = (() => {
|
this.node = (() => {
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
const fs = eval("require('fs')");
|
const fs = eval("require('fs')");
|
||||||
|
|||||||
Reference in New Issue
Block a user