From 90429028a6cd7450ca1bdb544d4d500896559c3e Mon Sep 17 00:00:00 2001 From: gitea-action Date: Sat, 9 Nov 2024 09:30:17 +0800 Subject: [PATCH] luci-app-ssr-plus: sync upstream last commit: https://github.com/fw876/helloworld/commit/88e303de450c46936c635ee0f8f28918aba26cd4 --- luci-app-ssr-plus/Makefile | 2 +- .../luasrc/model/cbi/shadowsocksr/client-config.lua | 13 +++++++++++++ .../luasrc/view/shadowsocksr/ssrurl.htm | 12 +++++++++++- .../root/usr/share/shadowsocksr/gen_config.lua | 11 +++++++++++ .../root/usr/share/shadowsocksr/subscribe.lua | 6 ++++++ patch-luci-app-ssr-plus.patch | 6 +++--- 6 files changed, 45 insertions(+), 5 deletions(-) diff --git a/luci-app-ssr-plus/Makefile b/luci-app-ssr-plus/Makefile index 8c5387b78..009827d36 100644 --- a/luci-app-ssr-plus/Makefile +++ b/luci-app-ssr-plus/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=189 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NONE_V2RAY \ diff --git a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua index 1048aa495..876a819cb 100644 --- a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua +++ b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua @@ -619,6 +619,7 @@ o:depends({type = "v2ray", v2ray_protocol = "socks"}) -- 传输协议 o = s:option(ListValue, "transport", translate("Transport")) o:value("tcp", "TCP") +o:value("raw", "RAW") o:value("kcp", "mKCP") o:value("ws", "WebSocket") o:value("httpupgrade", "HTTPUpgrade") @@ -642,14 +643,24 @@ o:value("none", translate("None")) o:value("http", "HTTP") o.rmempty = true +-- [[ RAW部分 ]]-- +-- RAW伪装 +o = s:option(ListValue, "raw_guise", translate("Camouflage Type")) +o:depends("transport", "raw") +o:value("none", translate("None")) +o:value("http", "HTTP") +o.rmempty = true + -- HTTP域名 o = s:option(Value, "http_host", translate("HTTP Host")) o:depends("tcp_guise", "http") +o:depends("raw_guise", "http") o.rmempty = true -- HTTP路径 o = s:option(Value, "http_path", translate("HTTP Path")) o:depends("tcp_guise", "http") +o:depends("raw_guise", "http") o.rmempty = true -- [[ WS部分 ]]-- @@ -928,7 +939,9 @@ if is_finded("xray") then end o.rmempty = true o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", tls = true}) + o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "raw", tls = true}) o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", reality = true}) + o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "raw", reality = true}) -- [[ uTLS ]]-- o = s:option(Value, "fingerprint", translate("Finger Print")) diff --git a/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm b/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm index 7f841fae8..18dcdf226 100644 --- a/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm +++ b/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm @@ -314,7 +314,10 @@ function import_ssr_url(btn, urlname, sid) { document.getElementsByName('cbid.shadowsocksr.' + sid + '.server')[0].value = url.hostname; document.getElementsByName('cbid.shadowsocksr.' + sid + '.server_port')[0].value = url.port || "80"; document.getElementsByName('cbid.shadowsocksr.' + sid + '.vmess_id')[0].value = url.username; - document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = params.get("type") == "http" ? "h2" : params.get("type") || "tcp"; + document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = + params.get("type") == "http" ? "h2" : + (params.get("type") == "raw" ? "raw" : + (params.get("type") || "tcp")); document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].dispatchEvent(event); document.getElementsByName('cbid.shadowsocksr.' + sid + '.vless_encryption')[0].value = params.get("encryption") || "none"; if ([ "tls", "xtls", "reality" ].includes(params.get("security"))) { @@ -375,6 +378,13 @@ function import_ssr_url(btn, urlname, sid) { document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : ""; document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : ""; } + case "raw": + document.getElementsByName('cbid.shadowsocksr.' + sid + '.raw_guise')[0].value = params.get("headerType") || "none"; + document.getElementsByName('cbid.shadowsocksr.' + sid + '.raw_guise')[0].dispatchEvent(event); + if (params.get("headerType") === "http") { + document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : ""; + document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : ""; + } break; } s.innerHTML = "<%:Import configuration information successfully.%>"; diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua index 59cee0808..569b46263 100755 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua @@ -231,6 +231,17 @@ end } } } or nil, + rawSettings = (server.transport == "raw" and server.raw_guise == "http") and { + -- raw + header = { + type = server.raw_guise, + request = { + -- request + path = {server.http_path} or {"/"}, + headers = {Host = {server.http_host} or {}} + } + } + } or nil, kcpSettings = (server.transport == "kcp") and { -- kcp mtu = tonumber(server.mtu), diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua index 34b095043..ccdd8be7a 100755 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua @@ -406,6 +406,12 @@ local function processData(szType, content) result.tcp_host = params.host and UrlDecode(params.host) or nil result.tcp_path = params.path and UrlDecode(params.path) or nil end + elseif result.transport == "raw" then + result.raw_guise = params.headerType or "none" + if result.raw_guise == "http" then + result.tcp_host = params.host and UrlDecode(params.host) or nil + result.tcp_path = params.path and UrlDecode(params.path) or nil + end end end if not result.alias then diff --git a/patch-luci-app-ssr-plus.patch b/patch-luci-app-ssr-plus.patch index d30e94403..88bb0c9c7 100644 --- a/patch-luci-app-ssr-plus.patch +++ b/patch-luci-app-ssr-plus.patch @@ -1,5 +1,5 @@ diff --git a/luci-app-ssr-plus/Makefile b/luci-app-ssr-plus/Makefile -index 735b377..8c5387b 100644 +index 04875d4..009827d 100644 --- a/luci-app-ssr-plus/Makefile +++ b/luci-app-ssr-plus/Makefile @@ -9,10 +9,9 @@ PKG_CONFIG_DEPENDS:= \ @@ -338,7 +338,7 @@ index d0b77f1..259cb7f 100644 res(); }); diff --git a/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm b/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm -index 7603d8c..7f841fa 100644 +index c81590e..18dcdf2 100644 --- a/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm +++ b/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm @@ -69,9 +69,9 @@ function export_ssr_url(btn, urlname, sid) { @@ -416,7 +416,7 @@ index 7603d8c..7f841fa 100644 return false; case "vless": try { -@@ -377,10 +377,10 @@ function import_ssr_url(btn, urlname, sid) { +@@ -387,10 +387,10 @@ function import_ssr_url(btn, urlname, sid) { } break; }