mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 04:59:02 +08:00
feat: ⚠️ BREAKING CHANG 仅手动指定 target 为 SurgeMac 时, 启用 mihomo 来支援 Surge 本身不支持的协议
This commit is contained in:
parent
6cf8080cd3
commit
27e693c308
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.14.399",
|
||||
"version": "2.14.400",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -20,10 +20,12 @@ export default function SurgeMac_Producer() {
|
||||
try {
|
||||
return surge_Producer.produce(proxy, type, opts);
|
||||
} catch (e) {
|
||||
$.log(
|
||||
`${proxy.name} is not supported on ${targetPlatform}, try to use Mihomo(SurgeMac - External Proxy Program) instead`,
|
||||
);
|
||||
return mihomo(proxy, type, opts);
|
||||
if (opts.useMihomoExternal) {
|
||||
$.log(
|
||||
`${proxy.name} is not supported on ${targetPlatform}, try to use Mihomo(SurgeMac - External Proxy Program) instead`,
|
||||
);
|
||||
return mihomo(proxy, type, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,6 +130,15 @@ async function doSync() {
|
||||
try {
|
||||
if (artifact.sync && artifact.source) {
|
||||
$.info(`正在同步云配置:${artifact.name}...`);
|
||||
|
||||
const useMihomoExternal =
|
||||
artifact.platform === 'SurgeMac';
|
||||
|
||||
if (useMihomoExternal) {
|
||||
$.info(
|
||||
`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`,
|
||||
);
|
||||
}
|
||||
const output = await produceArtifact({
|
||||
type: artifact.type,
|
||||
name: artifact.source,
|
||||
@ -137,6 +146,7 @@ async function doSync() {
|
||||
produceOpts: {
|
||||
'include-unsupported-proxy':
|
||||
artifact.includeUnsupportedProxy,
|
||||
useMihomoExternal,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -52,6 +52,8 @@ async function downloadSubscription(req, res) {
|
||||
name = decodeURIComponent(name);
|
||||
nezhaIndex = decodeURIComponent(nezhaIndex);
|
||||
|
||||
const useMihomoExternal = req.query.target === 'SurgeMac';
|
||||
|
||||
const platform =
|
||||
req.query.target || getPlatformFromHeaders(req.headers) || 'JSON';
|
||||
|
||||
@ -122,6 +124,10 @@ async function downloadSubscription(req, res) {
|
||||
$.info(`包含不支持的节点: ${includeUnsupportedProxy}`);
|
||||
}
|
||||
|
||||
if (useMihomoExternal) {
|
||||
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
|
||||
}
|
||||
|
||||
const allSubs = $.read(SUBS_KEY);
|
||||
const sub = findByName(allSubs, name);
|
||||
if (sub) {
|
||||
@ -138,6 +144,7 @@ async function downloadSubscription(req, res) {
|
||||
produceType,
|
||||
produceOpts: {
|
||||
'include-unsupported-proxy': includeUnsupportedProxy,
|
||||
useMihomoExternal,
|
||||
},
|
||||
$options,
|
||||
proxy,
|
||||
@ -253,6 +260,8 @@ async function downloadCollection(req, res) {
|
||||
name = decodeURIComponent(name);
|
||||
nezhaIndex = decodeURIComponent(nezhaIndex);
|
||||
|
||||
const useMihomoExternal = req.query.target === 'SurgeMac';
|
||||
|
||||
const platform =
|
||||
req.query.target || getPlatformFromHeaders(req.headers) || 'JSON';
|
||||
|
||||
@ -310,6 +319,9 @@ async function downloadCollection(req, res) {
|
||||
includeUnsupportedProxy = decodeURIComponent(includeUnsupportedProxy);
|
||||
$.info(`包含不支持的节点: ${includeUnsupportedProxy}`);
|
||||
}
|
||||
if (useMihomoExternal) {
|
||||
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
|
||||
}
|
||||
|
||||
if (collection) {
|
||||
try {
|
||||
@ -321,6 +333,7 @@ async function downloadCollection(req, res) {
|
||||
produceType,
|
||||
produceOpts: {
|
||||
'include-unsupported-proxy': includeUnsupportedProxy,
|
||||
useMihomoExternal,
|
||||
},
|
||||
$options,
|
||||
proxy,
|
||||
|
@ -559,6 +559,16 @@ async function syncArtifacts() {
|
||||
try {
|
||||
if (artifact.sync && artifact.source) {
|
||||
$.info(`正在同步云配置:${artifact.name}...`);
|
||||
|
||||
const useMihomoExternal =
|
||||
artifact.platform === 'SurgeMac';
|
||||
|
||||
if (useMihomoExternal) {
|
||||
$.info(
|
||||
`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`,
|
||||
);
|
||||
}
|
||||
|
||||
const output = await produceArtifact({
|
||||
type: artifact.type,
|
||||
name: artifact.source,
|
||||
@ -566,6 +576,7 @@ async function syncArtifacts() {
|
||||
produceOpts: {
|
||||
'include-unsupported-proxy':
|
||||
artifact.includeUnsupportedProxy,
|
||||
useMihomoExternal,
|
||||
},
|
||||
});
|
||||
|
||||
@ -681,12 +692,18 @@ async function syncArtifact(req, res) {
|
||||
}
|
||||
|
||||
try {
|
||||
const useMihomoExternal = artifact.platform === 'SurgeMac';
|
||||
|
||||
if (useMihomoExternal) {
|
||||
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
|
||||
}
|
||||
const output = await produceArtifact({
|
||||
type: artifact.type,
|
||||
name: artifact.source,
|
||||
platform: artifact.platform,
|
||||
produceOpts: {
|
||||
'include-unsupported-proxy': artifact.includeUnsupportedProxy,
|
||||
useMihomoExternal,
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user