From 739100c873e843754090208f78fbb60cfbd65ea0 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 4 Mar 2024 11:43:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Stash/clash.meta(mihomo)=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20`interface-name`=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/index.js | 4 ++ .../src/core/proxy-utils/producers/surge.js | 55 +++++++++++++++---- 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/backend/package.json b/backend/package.json index 8dcf1b87d..8c7d35221 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.235", + "version": "2.14.236", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/index.js b/backend/src/core/proxy-utils/index.js index b511032bc..10d9293f9 100644 --- a/backend/src/core/proxy-utils/index.js +++ b/backend/src/core/proxy-utils/index.js @@ -263,6 +263,10 @@ function safeMatch(parser, line) { } function lastParse(proxy) { + if (proxy.interface) { + proxy['interface-name'] = proxy.interface; + delete proxy.interface; + } if (isValidPortNumber(proxy.port)) { proxy.port = parseInt(proxy.port, 10); } diff --git a/backend/src/core/proxy-utils/producers/surge.js b/backend/src/core/proxy-utils/producers/surge.js index 294b0a121..5fbc358a3 100644 --- a/backend/src/core/proxy-utils/producers/surge.js +++ b/backend/src/core/proxy-utils/producers/surge.js @@ -132,7 +132,10 @@ function shadowsocks(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -229,7 +232,10 @@ function trojan(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -315,7 +321,10 @@ function vmess(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -385,7 +394,10 @@ function ssh(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // block-quic result.appendIfPresent(`,block-quic=${proxy['block-quic']}`, 'block-quic'); @@ -445,7 +457,10 @@ function http(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -522,7 +537,10 @@ function socks5(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -597,7 +615,10 @@ function snell(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -687,7 +708,10 @@ function tuic(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -761,7 +785,10 @@ ${proxy.name}=wireguard`); `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -860,7 +887,10 @@ function wireguard_surge(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) { @@ -936,7 +966,10 @@ function hysteria2(proxy) { `,allow-other-interface=${proxy['allow-other-interface']}`, 'allow-other-interface', ); - result.appendIfPresent(`,interface=${proxy['interface']}`, 'interface'); + result.appendIfPresent( + `,interface=${proxy['interface-name']}`, + 'interface-name', + ); // shadow-tls if (isPresent(proxy, 'shadow-tls-password')) {