feat: 调整 env backend 判断

This commit is contained in:
xream committed 2026-02-27 01:09:02 +08:00
1 parent 54b5cbd746
commit dd2ed938e3
3 files changed
+22 -11

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.21.29",
"version": "2.21.32",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
+19 -9
View File
@@ -13,15 +13,25 @@ const {
isGUIforCores,
} = ENV();
let backend = 'Node';
if (isNode) backend = 'Node';
if (isQX) backend = 'QX';
if (isLoon) backend = 'Loon';
if (isSurge) backend = 'Surge';
if (isStash) backend = 'Stash';
if (isShadowRocket) backend = 'Shadowrocket';
if (isEgern) backend = 'Egern';
if (isLanceX) backend = 'LanceX';
if (isGUIforCores) backend = 'GUI.for.Cores';
if (isNode) {
backend = 'Node';
} else if (isQX) {
backend = 'QX';
} else if (isLoon) {
backend = 'Loon';
} else if (isStash) {
backend = 'Stash';
} else if (isShadowRocket) {
backend = 'Shadowrocket';
} else if (isEgern) {
backend = 'Egern';
} else if (isSurge) {
backend = 'Surge';
} else if (isLanceX) {
backend = 'LanceX';
} else if (isGUIforCores) {
backend = 'GUI.for.Cores';
}
let meta = {};
let feature = {};
+2 -1
View File
@@ -1,12 +1,13 @@
/* eslint-disable no-undef */
const isQX = typeof $task !== 'undefined';
const isLoon = typeof $loon !== 'undefined';
// 可能有一些兼容环境依赖于这个, 先不改成 $environment.surge-version
const isSurge = typeof $httpClient !== 'undefined' && !isLoon;
const isNode = eval(`typeof process !== "undefined"`); // eval is needed in order to avoid browserify processing
const isStash =
'undefined' !== typeof $environment && $environment['stash-version'];
const isShadowRocket = 'undefined' !== typeof $rocket;
const isEgern = 'object' == typeof egern;
const isEgern = 'undefined' !== typeof Egern && Egern.version;
const isLanceX = 'undefined' != typeof $native;
const isGUIforCores = typeof $Plugins !== 'undefined';
import { Base64 } from 'js-base64';