mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
943edc696d |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.19.10",
|
"version": "2.19.2",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -114,7 +114,12 @@ async function processFn(
|
|||||||
if (item.type.indexOf('Script') !== -1) {
|
if (item.type.indexOf('Script') !== -1) {
|
||||||
const { mode, content } = item.args;
|
const { mode, content } = item.args;
|
||||||
if (mode === 'link') {
|
if (mode === 'link') {
|
||||||
|
let noCache;
|
||||||
let url = content || '';
|
let url = content || '';
|
||||||
|
if (url.endsWith('#noCache')) {
|
||||||
|
url = url.replace(/#noCache$/, '');
|
||||||
|
noCache = true;
|
||||||
|
}
|
||||||
// extract link arguments
|
// extract link arguments
|
||||||
const rawArgs = url.split('#');
|
const rawArgs = url.split('#');
|
||||||
if (rawArgs.length > 1) {
|
if (rawArgs.length > 1) {
|
||||||
@@ -133,14 +138,7 @@ async function processFn(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
url = `${url.split('#')[0]}${
|
url = `${url.split('#')[0]}${noCache ? '#noCache' : ''}`;
|
||||||
rawArgs[2]
|
|
||||||
? `#${rawArgs[2]}`
|
|
||||||
: $arguments?.noCache != null ||
|
|
||||||
$arguments?.insecure != null
|
|
||||||
? `#${rawArgs[1]}`
|
|
||||||
: ''
|
|
||||||
}`;
|
|
||||||
const downloadUrlMatch = url.match(
|
const downloadUrlMatch = url.match(
|
||||||
/^\/api\/(file|module)\/(.+)/,
|
/^\/api\/(file|module)\/(.+)/,
|
||||||
);
|
);
|
||||||
@@ -615,7 +613,7 @@ function lastParse(proxy) {
|
|||||||
proxy['tls-fingerprint'] = rs.generateFingerprint(caStr);
|
proxy['tls-fingerprint'] = rs.generateFingerprint(caStr);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
['ss'].includes(proxy.type) &&
|
['shadowsocks'].includes(proxy.type) &&
|
||||||
isPresent(proxy, 'shadow-tls-password')
|
isPresent(proxy, 'shadow-tls-password')
|
||||||
) {
|
) {
|
||||||
proxy.plugin = 'shadow-tls';
|
proxy.plugin = 'shadow-tls';
|
||||||
|
|||||||
@@ -634,9 +634,6 @@ function URI_VLESS() {
|
|||||||
}
|
}
|
||||||
if (!proxy.network && isShadowrocket && params.obfs) {
|
if (!proxy.network && isShadowrocket && params.obfs) {
|
||||||
proxy.network = params.obfs;
|
proxy.network = params.obfs;
|
||||||
if (['none'].includes(proxy.network)) {
|
|
||||||
proxy.network = 'tcp';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (['websocket'].includes(proxy.network)) {
|
if (['websocket'].includes(proxy.network)) {
|
||||||
proxy.network = 'ws';
|
proxy.network = 'ws';
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ vmess = tag equals "vmess"i address method uuid (transport/transport_host/transp
|
|||||||
proxy.alterId = proxy.alterId || 0;
|
proxy.alterId = proxy.alterId || 0;
|
||||||
handleTransport();
|
handleTransport();
|
||||||
}
|
}
|
||||||
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/flow/public_key/short_id/others)* {
|
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/others)* {
|
||||||
proxy.type = "vless";
|
proxy.type = "vless";
|
||||||
handleTransport();
|
handleTransport();
|
||||||
}
|
}
|
||||||
@@ -180,10 +180,6 @@ tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-
|
|||||||
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||||||
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||||||
|
|
||||||
flow = comma "flow" equals match:[^,]+ { proxy["flow"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
||||||
public_key = comma "public-key" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["public-key"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
||||||
short_id = comma "short-id" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["short-id"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
||||||
|
|
||||||
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
||||||
udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; }
|
udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; }
|
||||||
ip_mode = comma "ip-mode" equals match:[^,]+ { proxy["ip-version"] = match.join(""); }
|
ip_mode = comma "ip-mode" equals match:[^,]+ { proxy["ip-version"] = match.join(""); }
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ vmess = tag equals "vmess"i address method uuid (transport/transport_host/transp
|
|||||||
proxy.alterId = proxy.alterId || 0;
|
proxy.alterId = proxy.alterId || 0;
|
||||||
handleTransport();
|
handleTransport();
|
||||||
}
|
}
|
||||||
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/flow/public_key/short_id/others)* {
|
vless = tag equals "vless"i address uuid (transport/transport_host/transport_path/over_tls/tls_host/tls_verification/tls_cert_sha256/tls_pubkey_sha256/fast_open/udp_relay/ip_mode/others)* {
|
||||||
proxy.type = "vless";
|
proxy.type = "vless";
|
||||||
handleTransport();
|
handleTransport();
|
||||||
}
|
}
|
||||||
@@ -178,10 +178,6 @@ tls_verification = comma "skip-cert-verify" equals flag:bool { proxy["skip-cert-
|
|||||||
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
tls_cert_sha256 = comma "tls-cert-sha256" equals match:[^,]+ { proxy["tls-fingerprint"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||||||
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
tls_pubkey_sha256 = comma "tls-pubkey-sha256" equals match:[^,]+ { proxy["tls-pubkey-sha256"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
||||||
|
|
||||||
flow = comma "flow" equals match:[^,]+ { proxy["flow"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
||||||
public_key = comma "public-key" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["public-key"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
||||||
short_id = comma "short-id" equals match:[^,]+ { proxy["reality-opts"] = proxy["reality-opts"] || {}; proxy["reality-opts"]["short-id"] = match.join("").replace(/^"(.*)"$/, '$1'); }
|
|
||||||
|
|
||||||
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
fast_open = comma "fast-open" equals flag:bool { proxy.tfo = flag; }
|
||||||
udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; }
|
udp_relay = comma "udp" equals flag:bool { proxy.udp = flag; }
|
||||||
ip_mode = comma "ip-mode" equals match:[^,]+ { proxy["ip-version"] = match.join(""); }
|
ip_mode = comma "ip-mode" equals match:[^,]+ { proxy["ip-version"] = match.join(""); }
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function Loon_Producer() {
|
|||||||
case 'vmess':
|
case 'vmess':
|
||||||
return vmess(proxy);
|
return vmess(proxy);
|
||||||
case 'vless':
|
case 'vless':
|
||||||
return vless(proxy, opts['include-unsupported-proxy']);
|
return vless(proxy);
|
||||||
case 'http':
|
case 'http':
|
||||||
return http(proxy);
|
return http(proxy);
|
||||||
case 'socks5':
|
case 'socks5':
|
||||||
@@ -347,28 +347,10 @@ function vmess(proxy) {
|
|||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function vless(proxy, includeUnsupportedProxy) {
|
function vless(proxy) {
|
||||||
if (
|
if (typeof proxy.flow !== 'undefined' || proxy['reality-opts']) {
|
||||||
!includeUnsupportedProxy &&
|
|
||||||
(typeof proxy.flow !== 'undefined' || proxy['reality-opts'])
|
|
||||||
) {
|
|
||||||
throw new Error(`VLESS XTLS/REALITY is not supported`);
|
throw new Error(`VLESS XTLS/REALITY is not supported`);
|
||||||
}
|
}
|
||||||
let isReality = false;
|
|
||||||
if (includeUnsupportedProxy) {
|
|
||||||
if (
|
|
||||||
proxy['reality-opts'] &&
|
|
||||||
['xtls-rprx-vision'].includes(proxy.flow)
|
|
||||||
) {
|
|
||||||
isReality = true;
|
|
||||||
} else if (proxy['reality-opts']) {
|
|
||||||
throw new Error(
|
|
||||||
`VLESS REALITY with flow(${proxy.flow}) is not supported`,
|
|
||||||
);
|
|
||||||
} else if (proxy.flow) {
|
|
||||||
throw new Error(`VLESS XTLS is not supported`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const result = new Result(proxy);
|
const result = new Result(proxy);
|
||||||
result.append(
|
result.append(
|
||||||
`${proxy.name}=vless,${proxy.server},${proxy.port},"${proxy.uuid}"`,
|
`${proxy.name}=vless,${proxy.server},${proxy.port},"${proxy.uuid}"`,
|
||||||
@@ -417,21 +399,7 @@ function vless(proxy, includeUnsupportedProxy) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// sni
|
// sni
|
||||||
if (isReality) {
|
result.appendIfPresent(`,tls-name=${proxy.sni}`, 'sni');
|
||||||
result.appendIfPresent(`,flow=${proxy.flow}`, 'flow');
|
|
||||||
result.appendIfPresent(`,sni=${proxy.sni}`, 'sni');
|
|
||||||
result.appendIfPresent(
|
|
||||||
`,public-key="${proxy['reality-opts']['public-key']}"`,
|
|
||||||
'reality-opts.public-key',
|
|
||||||
);
|
|
||||||
result.appendIfPresent(
|
|
||||||
`,short-id=${proxy['reality-opts']['short-id']}`,
|
|
||||||
'reality-opts.short-id',
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
result.appendIfPresent(`,tls-name=${proxy.sni}`, 'sni');
|
|
||||||
}
|
|
||||||
|
|
||||||
result.appendIfPresent(
|
result.appendIfPresent(
|
||||||
`,tls-cert-sha256=${proxy['tls-fingerprint']}`,
|
`,tls-cert-sha256=${proxy['tls-fingerprint']}`,
|
||||||
'tls-fingerprint',
|
'tls-fingerprint',
|
||||||
|
|||||||
@@ -14,12 +14,10 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : '';
|
|||||||
`
|
`
|
||||||
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
||||||
Sub-Store -- v${version}
|
Sub-Store -- v${version}
|
||||||
Loon -- ${$loon}
|
|
||||||
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
|
||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const build = $loon.match(/\((\d+)\)$/)?.[1];
|
|
||||||
let arg;
|
let arg;
|
||||||
if (typeof $argument != 'undefined') {
|
if (typeof $argument != 'undefined') {
|
||||||
arg = Object.fromEntries(
|
arg = Object.fromEntries(
|
||||||
@@ -28,28 +26,23 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : '';
|
|||||||
} else {
|
} else {
|
||||||
arg = {};
|
arg = {};
|
||||||
}
|
}
|
||||||
console.log(`arg: ${JSON.stringify(arg)}`);
|
|
||||||
|
|
||||||
const RESOURCE_TYPE = {
|
const RESOURCE_TYPE = {
|
||||||
PROXY: 1,
|
PROXY: 1,
|
||||||
RULE: 2,
|
RULE: 2,
|
||||||
};
|
};
|
||||||
if (!arg.resourceUrlOnly) {
|
|
||||||
result = resource;
|
result = resource;
|
||||||
}
|
|
||||||
|
|
||||||
if (resourceType === RESOURCE_TYPE.PROXY) {
|
if (resourceType === RESOURCE_TYPE.PROXY) {
|
||||||
if (!arg.resourceUrlOnly) {
|
try {
|
||||||
try {
|
let proxies = ProxyUtils.parse(resource);
|
||||||
let proxies = ProxyUtils.parse(resource);
|
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
|
||||||
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
|
'include-unsupported-proxy': arg?.includeUnsupportedProxy,
|
||||||
'include-unsupported-proxy':
|
});
|
||||||
arg?.includeUnsupportedProxy || build >= 838,
|
} catch (e) {
|
||||||
});
|
console.log('解析器: 使用 resource 出现错误');
|
||||||
} catch (e) {
|
console.log(e.message ?? e);
|
||||||
console.log('解析器: 使用 resource 出现错误');
|
|
||||||
console.log(e.message ?? e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
|
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
|
||||||
console.log(`解析器: 尝试从 ${resourceUrl} 获取订阅`);
|
console.log(`解析器: 尝试从 ${resourceUrl} 获取订阅`);
|
||||||
@@ -66,21 +59,18 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : '';
|
|||||||
);
|
);
|
||||||
let proxies = ProxyUtils.parse(raw);
|
let proxies = ProxyUtils.parse(raw);
|
||||||
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
|
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
|
||||||
'include-unsupported-proxy':
|
'include-unsupported-proxy': arg?.includeUnsupportedProxy,
|
||||||
arg?.includeUnsupportedProxy || build >= 838,
|
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.message ?? e);
|
console.log(e.message ?? e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (resourceType === RESOURCE_TYPE.RULE) {
|
} else if (resourceType === RESOURCE_TYPE.RULE) {
|
||||||
if (!arg.resourceUrlOnly) {
|
try {
|
||||||
try {
|
const rules = RuleUtils.parse(resource);
|
||||||
const rules = RuleUtils.parse(resource);
|
result = RuleUtils.produce(rules, 'Loon');
|
||||||
result = RuleUtils.produce(rules, 'Loon');
|
} catch (e) {
|
||||||
} catch (e) {
|
console.log(e.message ?? e);
|
||||||
console.log(e.message ?? e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
|
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
|
||||||
console.log(`解析器: 尝试从 ${resourceUrl} 获取规则`);
|
console.log(`解析器: 尝试从 ${resourceUrl} 获取规则`);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
||||||
import { COLLECTIONS_KEY, ARTIFACTS_KEY, FILES_KEY } from '@/constants';
|
import { COLLECTIONS_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 { RequestInvalidError, ResourceNotFoundError } from '@/restful/errors';
|
import { RequestInvalidError, ResourceNotFoundError } from '@/restful/errors';
|
||||||
@@ -106,18 +106,7 @@ 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, ARTIFACTS_KEY } from '@/constants';
|
import { 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 {
|
import {
|
||||||
@@ -245,20 +245,6 @@ 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);
|
||||||
|
|||||||
@@ -5,12 +5,7 @@ import {
|
|||||||
RequestInvalidError,
|
RequestInvalidError,
|
||||||
} from './errors';
|
} from './errors';
|
||||||
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
import { deleteByName, findByName, updateByName } from '@/utils/database';
|
||||||
import {
|
import { SUBS_KEY, COLLECTIONS_KEY, ARTIFACTS_KEY } from '@/constants';
|
||||||
SUBS_KEY,
|
|
||||||
COLLECTIONS_KEY,
|
|
||||||
ARTIFACTS_KEY,
|
|
||||||
FILES_KEY,
|
|
||||||
} from '@/constants';
|
|
||||||
import {
|
import {
|
||||||
getFlowHeaders,
|
getFlowHeaders,
|
||||||
parseFlowHeaders,
|
parseFlowHeaders,
|
||||||
@@ -325,20 +320,9 @@ 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);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ function doMigrationV2() {
|
|||||||
const newTokens = Object.values(tokens);
|
const newTokens = Object.values(tokens);
|
||||||
$.write(newTokens, TOKENS_KEY);
|
$.write(newTokens, TOKENS_KEY);
|
||||||
|
|
||||||
// 7. delete builtin rules
|
// 6. delete builtin rules
|
||||||
delete $.cache.builtin;
|
delete $.cache.builtin;
|
||||||
$.info('Migration complete!');
|
$.info('Migration complete!');
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export function getPlatformFromUserAgent({ ua, UA, accept }) {
|
|||||||
return 'Clash';
|
return 'Clash';
|
||||||
} else if (ua.indexOf('v2ray') !== -1) {
|
} else if (ua.indexOf('v2ray') !== -1) {
|
||||||
return 'V2Ray';
|
return 'V2Ray';
|
||||||
} else if (ua.indexOf('sing-box') !== -1 || ua.indexOf('singbox') !== -1) {
|
} else if (ua.indexOf('sing-box') !== -1) {
|
||||||
return 'sing-box';
|
return 'sing-box';
|
||||||
} else if (accept.indexOf('application/json') === 0) {
|
} else if (accept.indexOf('application/json') === 0) {
|
||||||
return 'JSON';
|
return 'JSON';
|
||||||
@@ -66,12 +66,10 @@ export function shouldIncludeUnsupportedProxy(platform, ua) {
|
|||||||
UA: ua,
|
UA: ua,
|
||||||
ua: ua.toLowerCase(),
|
ua: ua.toLowerCase(),
|
||||||
});
|
});
|
||||||
if (!['Stash', 'Egern', 'Loon'].includes(target)) {
|
if (!['Stash', 'Egern'].includes(target)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const coerceVersion = coerce(ua);
|
const version = coerce(ua).version;
|
||||||
$.log(JSON.stringify(coerceVersion, null, 2));
|
|
||||||
const { version } = coerceVersion;
|
|
||||||
if (
|
if (
|
||||||
platform === 'Stash' &&
|
platform === 'Stash' &&
|
||||||
target === 'Stash' &&
|
target === 'Stash' &&
|
||||||
@@ -86,14 +84,6 @@ export function shouldIncludeUnsupportedProxy(platform, ua) {
|
|||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Loon 的 UA 不规范, version 取出来是 build
|
|
||||||
if (
|
|
||||||
platform === 'Loon' &&
|
|
||||||
target === 'Loon' &&
|
|
||||||
gte(version, '838.0.0')
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$.error(`获取版本号失败: ${e}`);
|
$.error(`获取版本号失败: ${e}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user