mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 11:28:59 +08:00
feat: 全部是 WireGuard 节点的订阅, 支持输出为 Surge 模块
This commit is contained in:
parent
6f7da57e3a
commit
8cbb4492be
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.14.300",
|
||||
"version": "2.14.301",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -219,7 +219,7 @@ function produce(proxies, targetPlatform, type, opts = {}) {
|
||||
$.log(`Producing proxies for target: ${targetPlatform}`);
|
||||
if (typeof producer.type === 'undefined' || producer.type === 'SINGLE') {
|
||||
let localPort = 10000;
|
||||
const list = proxies
|
||||
let list = proxies
|
||||
.map((proxy) => {
|
||||
try {
|
||||
let line = producer.produce(proxy, type, opts);
|
||||
@ -245,7 +245,18 @@ function produce(proxies, targetPlatform, type, opts = {}) {
|
||||
}
|
||||
})
|
||||
.filter((line) => line.length > 0);
|
||||
return type === 'internal' ? list : list.join('\n');
|
||||
list = type === 'internal' ? list : list.join('\n');
|
||||
if (
|
||||
targetPlatform.startsWith('Surge') &&
|
||||
proxies.length > 0 &&
|
||||
proxies.every((p) => p.type === 'wireguard')
|
||||
) {
|
||||
list = `#!name=${proxies[0]?.subName}
|
||||
#!desc=${proxies[0]?._desc ?? ''}
|
||||
#!category=${proxies[0]?._category ?? ''}
|
||||
${list}`;
|
||||
}
|
||||
return list;
|
||||
} else if (producer.type === 'ALL') {
|
||||
return producer.produce(proxies, type, opts);
|
||||
}
|
||||
|
@ -762,8 +762,8 @@ function wireguard(proxy) {
|
||||
}
|
||||
const result = new Result(proxy);
|
||||
|
||||
result.append(`# WireGuard Proxy ${proxy.name}
|
||||
${proxy.name}=wireguard`);
|
||||
result.append(`# > WireGuard Proxy ${proxy.name}
|
||||
# ${proxy.name}=wireguard`);
|
||||
|
||||
proxy['section-name'] = getIfNotBlank(proxy['section-name'], proxy.name);
|
||||
|
||||
@ -821,7 +821,7 @@ ${proxy.name}=wireguard`);
|
||||
);
|
||||
|
||||
result.append(`
|
||||
# WireGuard Section ${proxy.name}
|
||||
# > WireGuard Section ${proxy.name}
|
||||
[WireGuard ${proxy['section-name']}]
|
||||
private-key = ${proxy['private-key']}`);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user