Procházet zdrojové kódy

luci-app-ssr-plus: Fix when `SOCKS5` is initial disabled `Netflix` shunt faild issue.

zxlhhyccc před 8 měsíci
rodič
revize
b0bd48e7c2

+ 4 - 0
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -543,6 +543,8 @@ shunt_dns_config_file_port() {
                    jq --arg port "$port" '.inbounds |= .[0:1] + [{"protocol":"socks","port":($port | tonumber),"settings":{"udp":true,"auth":"noauth"}}] + .[1:]' "$shunt_config_file" > "$shunt_config_file.tmp" && mv "$shunt_config_file.tmp" $shunt_config_file
             echo "$port"  # 返回端口号
             return 0  # 成功返回
+        else
+            sed -i -e '/"mixed"/d' $shunt_config_file
         fi
     else
         # NetFlix 和 全局 socks 节点不相同
@@ -553,6 +555,8 @@ shunt_dns_config_file_port() {
                    -e '/"mixed"/d' \
                    -e 's/"auth"\s*:\s*"password"/\"auth\": \"noauth\"/g' \
                    -e '/"accounts": \[/,/\]/d' $shunt_config_file
+        else
+            sed -i -e '/"mixed"/d' $shunt_config_file
         fi
     fi
     # 使用传入的端口

+ 4 - 4
luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua

@@ -184,11 +184,11 @@ if proto and proto:find("tcp") and socks_port ~= "0" then
         -- socks
         protocol = "socks",
         port = tonumber(socks_port),
-        settings = (socks_server.server ~= "same") and {
-			auth = socks_server.socks5_auth,
+        settings = {
+			auth = socks_server.socks5_auth or "noauth",
 			udp = true,
-			mixed = (socks_server.socks5_mixed == '1') and true or false,
-			accounts = (socks_server.socks5_auth ~= "noauth") and {
+			mixed = ((socks_server.socks5_mixed == '1') and true or false) or (socks_server.server == 'same') and nil,
+			accounts = (socks_server.server ~= "same" and (socks_server.socks5_auth and socks_server.socks5_auth ~= "noauth")) and {
 				{
 					user = socks_server.socks5_user,
 					pass = socks_server.socks5_pass