mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 09:39:02 +08:00
feat: OpenAPI 增加 isEgern, isLanceX; /api/utils/env 增加 meta 信息
This commit is contained in:
parent
1c6d761e09
commit
572f2f5533
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.14.240",
|
||||
"version": "2.14.241",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -1,7 +1,16 @@
|
||||
import { version as substoreVersion } from '../../package.json';
|
||||
import { ENV } from '@/vendor/open-api';
|
||||
|
||||
const { isNode, isQX, isLoon, isSurge, isStash, isShadowRocket } = ENV();
|
||||
const {
|
||||
isNode,
|
||||
isQX,
|
||||
isLoon,
|
||||
isSurge,
|
||||
isStash,
|
||||
isShadowRocket,
|
||||
isLanceX,
|
||||
isEgern,
|
||||
} = ENV();
|
||||
let backend = 'Node';
|
||||
if (isNode) backend = 'Node';
|
||||
if (isQX) backend = 'QX';
|
||||
@ -9,8 +18,29 @@ if (isLoon) backend = 'Loon';
|
||||
if (isSurge) backend = 'Surge';
|
||||
if (isStash) backend = 'Stash';
|
||||
if (isShadowRocket) backend = 'ShadowRocket';
|
||||
if (isEgern) backend = 'Egern';
|
||||
if (isLanceX) backend = 'LanceX';
|
||||
|
||||
let meta = {};
|
||||
|
||||
try {
|
||||
if (typeof $environment !== 'undefined') {
|
||||
// eslint-disable-next-line no-undef
|
||||
meta.env = $environment;
|
||||
}
|
||||
if (typeof $loon !== 'undefined') {
|
||||
// eslint-disable-next-line no-undef
|
||||
meta.loon = $loon;
|
||||
}
|
||||
if (typeof $script !== 'undefined') {
|
||||
// eslint-disable-next-line no-undef
|
||||
meta.script = $script;
|
||||
}
|
||||
// eslint-disable-next-line no-empty
|
||||
} catch (e) {}
|
||||
|
||||
export default {
|
||||
backend,
|
||||
version: substoreVersion,
|
||||
meta,
|
||||
};
|
||||
|
13
backend/src/vendor/open-api.js
vendored
13
backend/src/vendor/open-api.js
vendored
@ -6,6 +6,8 @@ const isNode = eval(`typeof process !== "undefined"`); // eval is needed in orde
|
||||
const isStash =
|
||||
'undefined' !== typeof $environment && $environment['stash-version'];
|
||||
const isShadowRocket = 'undefined' !== typeof $rocket;
|
||||
const isEgern = 'object' == typeof egern;
|
||||
const isLanceX = 'undefined' != typeof $native;
|
||||
|
||||
export class OpenAPI {
|
||||
constructor(name = 'untitled', debug = false) {
|
||||
@ -251,7 +253,16 @@ export class OpenAPI {
|
||||
}
|
||||
|
||||
export function ENV() {
|
||||
return { isQX, isLoon, isSurge, isNode, isStash, isShadowRocket };
|
||||
return {
|
||||
isQX,
|
||||
isLoon,
|
||||
isSurge,
|
||||
isNode,
|
||||
isStash,
|
||||
isShadowRocket,
|
||||
isEgern,
|
||||
isLanceX,
|
||||
};
|
||||
}
|
||||
|
||||
export function HTTP(defaultOptions = { baseURL: '' }) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user