From 00be2678f4d244e708a98bddcba4293c2dd482bf Mon Sep 17 00:00:00 2001
From: Peng-YM <1048217874pengym@gmail.com>
Date: Mon, 31 Aug 2020 15:09:53 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DSS=E6=97=A0=E6=B7=B7=E6=B7=86?=
=?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9A=84=E6=83=85=E5=86=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/.idea/workspace.xml | 66 ++++++++++++++++++-------------------
backend/sub-store.js | 23 ++++++++-----
2 files changed, 48 insertions(+), 41 deletions(-)
diff --git a/backend/.idea/workspace.xml b/backend/.idea/workspace.xml
index edee212..2af2e1e 100644
--- a/backend/.idea/workspace.xml
+++ b/backend/.idea/workspace.xml
@@ -81,7 +81,7 @@
-
+
@@ -101,177 +101,177 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/backend/sub-store.js b/backend/sub-store.js
index 419e5fa..0cca3ce 100644
--- a/backend/sub-store.js
+++ b/backend/sub-store.js
@@ -618,7 +618,7 @@ function URI_SS() {
content = content.split("#")[0]; // strip proxy name
// handle IPV4 and IPV6
- const serverAndPort = content.match(/@([^\/]*)\//)[1];
+ const serverAndPort = content.match(/@([^\/]*)(\/|$)/)[1];
const portIdx = serverAndPort.lastIndexOf(":");
proxy.server = serverAndPort.substring(0, portIdx);
proxy.port = serverAndPort.substring(portIdx + 1);
@@ -1317,10 +1317,15 @@ function Loon_Producer() {
switch (proxy.type) {
case "ss":
obfs_opts = ",,";
- if (proxy.plugin === 'obfs') {
- const {mode, host} = proxy['plugin-opts'];
- obfs_opts = `,${mode},${host}`
+ if (proxy.plugin) {
+ if (proxy.plugin === 'obfs') {
+ const {mode, host} = proxy['plugin-opts'];
+ obfs_opts = `,${mode},${host}`
+ } else {
+ throw new Error(`Platform ${targetPlatform} does not support obfs option: ${proxy.obfs}`);
+ }
}
+
return `${proxy.name}=shadowsocks,${proxy.server},${proxy.port},${proxy.cipher},${proxy.password}${obfs_opts}`;
case "ssr":
return `${proxy.name}=shadowsocksr,${proxy.server},${proxy.port},${proxy.cipher},${proxy.password},${proxy.protocol},{${proxy['protocol-param']}},${proxy.obfs},{${proxy['obfs-param']}}`
@@ -1359,10 +1364,12 @@ function Surge_Producer() {
switch (proxy.type) {
case 'ss':
obfs_opts = "";
- if (proxy.plugin === "obfs") {
- obfs_opts = `,obfs=${proxy['plugin-opts'].mode},obfs-host=${proxy['plugin-opts'].host}`
- } else {
- throw new Error(`Platform ${targetPlatform} does not support obfs option: ${proxy.obfs}`);
+ if (proxy.plugin) {
+ if (proxy.plugin === "obfs") {
+ obfs_opts = `,obfs=${proxy['plugin-opts'].mode},obfs-host=${proxy['plugin-opts'].host}`
+ } else {
+ throw new Error(`Platform ${targetPlatform} does not support obfs option: ${proxy.obfs}`);
+ }
}
return `${proxy.name}=ss,${proxy.server},${proxy.port},encrypt-method=${proxy.cipher},password=${proxy.password}${obfs_opts},tfo=${proxy.tfo || 'false'},udp-relay=${proxy.udp || 'false'}`;
case 'vmess':