mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 18:49:03 +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",
|
"name": "sub-store",
|
||||||
"version": "2.14.399",
|
"version": "2.14.400",
|
||||||
"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": {
|
||||||
|
@ -20,10 +20,12 @@ export default function SurgeMac_Producer() {
|
|||||||
try {
|
try {
|
||||||
return surge_Producer.produce(proxy, type, opts);
|
return surge_Producer.produce(proxy, type, opts);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$.log(
|
if (opts.useMihomoExternal) {
|
||||||
`${proxy.name} is not supported on ${targetPlatform}, try to use Mihomo(SurgeMac - External Proxy Program) instead`,
|
$.log(
|
||||||
);
|
`${proxy.name} is not supported on ${targetPlatform}, try to use Mihomo(SurgeMac - External Proxy Program) instead`,
|
||||||
return mihomo(proxy, type, opts);
|
);
|
||||||
|
return mihomo(proxy, type, opts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,15 @@ async function doSync() {
|
|||||||
try {
|
try {
|
||||||
if (artifact.sync && artifact.source) {
|
if (artifact.sync && artifact.source) {
|
||||||
$.info(`正在同步云配置:${artifact.name}...`);
|
$.info(`正在同步云配置:${artifact.name}...`);
|
||||||
|
|
||||||
|
const useMihomoExternal =
|
||||||
|
artifact.platform === 'SurgeMac';
|
||||||
|
|
||||||
|
if (useMihomoExternal) {
|
||||||
|
$.info(
|
||||||
|
`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`,
|
||||||
|
);
|
||||||
|
}
|
||||||
const output = await produceArtifact({
|
const output = await produceArtifact({
|
||||||
type: artifact.type,
|
type: artifact.type,
|
||||||
name: artifact.source,
|
name: artifact.source,
|
||||||
@ -137,6 +146,7 @@ async function doSync() {
|
|||||||
produceOpts: {
|
produceOpts: {
|
||||||
'include-unsupported-proxy':
|
'include-unsupported-proxy':
|
||||||
artifact.includeUnsupportedProxy,
|
artifact.includeUnsupportedProxy,
|
||||||
|
useMihomoExternal,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,6 +52,8 @@ async function downloadSubscription(req, res) {
|
|||||||
name = decodeURIComponent(name);
|
name = decodeURIComponent(name);
|
||||||
nezhaIndex = decodeURIComponent(nezhaIndex);
|
nezhaIndex = decodeURIComponent(nezhaIndex);
|
||||||
|
|
||||||
|
const useMihomoExternal = req.query.target === 'SurgeMac';
|
||||||
|
|
||||||
const platform =
|
const platform =
|
||||||
req.query.target || getPlatformFromHeaders(req.headers) || 'JSON';
|
req.query.target || getPlatformFromHeaders(req.headers) || 'JSON';
|
||||||
|
|
||||||
@ -122,6 +124,10 @@ async function downloadSubscription(req, res) {
|
|||||||
$.info(`包含不支持的节点: ${includeUnsupportedProxy}`);
|
$.info(`包含不支持的节点: ${includeUnsupportedProxy}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useMihomoExternal) {
|
||||||
|
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
|
||||||
|
}
|
||||||
|
|
||||||
const allSubs = $.read(SUBS_KEY);
|
const allSubs = $.read(SUBS_KEY);
|
||||||
const sub = findByName(allSubs, name);
|
const sub = findByName(allSubs, name);
|
||||||
if (sub) {
|
if (sub) {
|
||||||
@ -138,6 +144,7 @@ async function downloadSubscription(req, res) {
|
|||||||
produceType,
|
produceType,
|
||||||
produceOpts: {
|
produceOpts: {
|
||||||
'include-unsupported-proxy': includeUnsupportedProxy,
|
'include-unsupported-proxy': includeUnsupportedProxy,
|
||||||
|
useMihomoExternal,
|
||||||
},
|
},
|
||||||
$options,
|
$options,
|
||||||
proxy,
|
proxy,
|
||||||
@ -253,6 +260,8 @@ async function downloadCollection(req, res) {
|
|||||||
name = decodeURIComponent(name);
|
name = decodeURIComponent(name);
|
||||||
nezhaIndex = decodeURIComponent(nezhaIndex);
|
nezhaIndex = decodeURIComponent(nezhaIndex);
|
||||||
|
|
||||||
|
const useMihomoExternal = req.query.target === 'SurgeMac';
|
||||||
|
|
||||||
const platform =
|
const platform =
|
||||||
req.query.target || getPlatformFromHeaders(req.headers) || 'JSON';
|
req.query.target || getPlatformFromHeaders(req.headers) || 'JSON';
|
||||||
|
|
||||||
@ -310,6 +319,9 @@ async function downloadCollection(req, res) {
|
|||||||
includeUnsupportedProxy = decodeURIComponent(includeUnsupportedProxy);
|
includeUnsupportedProxy = decodeURIComponent(includeUnsupportedProxy);
|
||||||
$.info(`包含不支持的节点: ${includeUnsupportedProxy}`);
|
$.info(`包含不支持的节点: ${includeUnsupportedProxy}`);
|
||||||
}
|
}
|
||||||
|
if (useMihomoExternal) {
|
||||||
|
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
|
||||||
|
}
|
||||||
|
|
||||||
if (collection) {
|
if (collection) {
|
||||||
try {
|
try {
|
||||||
@ -321,6 +333,7 @@ async function downloadCollection(req, res) {
|
|||||||
produceType,
|
produceType,
|
||||||
produceOpts: {
|
produceOpts: {
|
||||||
'include-unsupported-proxy': includeUnsupportedProxy,
|
'include-unsupported-proxy': includeUnsupportedProxy,
|
||||||
|
useMihomoExternal,
|
||||||
},
|
},
|
||||||
$options,
|
$options,
|
||||||
proxy,
|
proxy,
|
||||||
|
@ -559,6 +559,16 @@ async function syncArtifacts() {
|
|||||||
try {
|
try {
|
||||||
if (artifact.sync && artifact.source) {
|
if (artifact.sync && artifact.source) {
|
||||||
$.info(`正在同步云配置:${artifact.name}...`);
|
$.info(`正在同步云配置:${artifact.name}...`);
|
||||||
|
|
||||||
|
const useMihomoExternal =
|
||||||
|
artifact.platform === 'SurgeMac';
|
||||||
|
|
||||||
|
if (useMihomoExternal) {
|
||||||
|
$.info(
|
||||||
|
`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const output = await produceArtifact({
|
const output = await produceArtifact({
|
||||||
type: artifact.type,
|
type: artifact.type,
|
||||||
name: artifact.source,
|
name: artifact.source,
|
||||||
@ -566,6 +576,7 @@ async function syncArtifacts() {
|
|||||||
produceOpts: {
|
produceOpts: {
|
||||||
'include-unsupported-proxy':
|
'include-unsupported-proxy':
|
||||||
artifact.includeUnsupportedProxy,
|
artifact.includeUnsupportedProxy,
|
||||||
|
useMihomoExternal,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -681,12 +692,18 @@ async function syncArtifact(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const useMihomoExternal = artifact.platform === 'SurgeMac';
|
||||||
|
|
||||||
|
if (useMihomoExternal) {
|
||||||
|
$.info(`手动指定了 target 为 SurgeMac, 将使用 Mihomo External`);
|
||||||
|
}
|
||||||
const output = await produceArtifact({
|
const output = await produceArtifact({
|
||||||
type: artifact.type,
|
type: artifact.type,
|
||||||
name: artifact.source,
|
name: artifact.source,
|
||||||
platform: artifact.platform,
|
platform: artifact.platform,
|
||||||
produceOpts: {
|
produceOpts: {
|
||||||
'include-unsupported-proxy': artifact.includeUnsupportedProxy,
|
'include-unsupported-proxy': artifact.includeUnsupportedProxy,
|
||||||
|
useMihomoExternal,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user