浏览代码

luci-app-ssr-plus: Fix `Hysteria2` subscribe.

zxlhhyccc 8 月之前
父节点
当前提交
e1242a7a78

+ 1 - 1
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua

@@ -144,7 +144,7 @@ s = m:section(NamedSection, sid, "servers")
 s.anonymous = true
 s.addremove = false
 
-o = s:option(DummyValue, "ssr_url", "SS/SSR/V2RAY/TROJAN URL")
+o = s:option(DummyValue, "ssr_url", "SS/SSR/V2RAY/TROJAN/HYSTERIA2 URL")
 o.rawhtml = true
 o.template = "shadowsocksr/ssrurl"
 o.value = sid

+ 11 - 6
luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua

@@ -10,7 +10,6 @@ require "luci.util"
 require "luci.sys"
 require "luci.jsonc"
 require "luci.model.ipkg"
-local ucursor = require "luci.model.uci".cursor()
 
 -- these global functions are accessed all the time by the event handler
 -- so caching them is worth the effort
@@ -162,6 +161,12 @@ local function processData(szType, content)
 		local url = URL.parse("http://" .. content)
 		local params = url.query
 
+		-- 调试输出所有参数
+		-- log("Hysteria2 原始参数:")
+		-- for k,v in pairs(params) do
+			-- log(k.."="..v)
+		-- end
+
 		result.alias = url.fragment and UrlDecode(url.fragment) or nil
 		result.type = hy2_type
 		result.server = url.host
@@ -171,12 +176,12 @@ local function processData(szType, content)
 			result.transport_protocol = params.protocol or "udp"
 		end
 		result.hy2_auth = url.user
-		result.uplink_capacity = params.upmbps
-		result.downlink_capacity = params.downmbps
-		if params.obfs and params.obfs-password then
+		result.uplink_capacity = params.upmbps or "5"
+		result.downlink_capacity = params.downmbps or "20"
+		if params.obfs then
 			result.flag_obfs = "1"
-			result.transport_protocol = params.obfs
-			result.transport_protocol = params.obfs-password
+			result.obfs_type = params.obfs
+			result.salamander = params["obfs-password"] or params["obfs_password"]
 		end
 		if params.sni then
 			result.tls = "1"