diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index acc9745a3..8ec330c11 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -495,6 +495,10 @@ o = s:option(Value, option_name("ws_path"), translate("WebSocket Path")) o.placeholder = "/" o:depends({ [option_name("transport")] = "ws" }) +o = s:option(Value, option_name("ws_heartbeatPeriod"), translate("HeartbeatPeriod(second)")) +o.datatype = "integer" +o:depends({ [option_name("transport")] = "ws" }) + -- [[ HTTP/2部分 ]]-- o = s:option(Value, option_name("h2_host"), translate("HTTP/2 Host")) o:depends({ [option_name("transport")] = "h2" }) @@ -575,6 +579,7 @@ o.default = "auto" o:value("auto") o:value("packet-up") o:value("stream-up") +o:value("stream-one") o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host")) o:depends({ [option_name("transport")] = "xhttp" }) @@ -588,12 +593,18 @@ o:depends({ [option_name("transport")] = "xhttp" }) o.rows = 15 o.wrap = "off" o.custom_write = function(self, section, value) + m:set(section, self.option:sub(1 + #option_prefix), value) - local data = value and value ~= "" and jsonc.parse(value) - local address = (data and data.extra and data.extra.downloadSettings and data.extra.downloadSettings.address) - or (data and data.downloadSettings and data.downloadSettings.address) - if address and address ~= "" then - m:set(section, "download_address", address) + + local success, data = pcall(jsonc.parse, value) + if success and data then + local address = (data.extra and data.extra.downloadSettings and data.extra.downloadSettings.address) + or (data.downloadSettings and data.downloadSettings.address) + if address and address ~= "" then + m:set(section, "download_address", address) + else + m:del(section, "download_address") + end else m:del(section, "download_address") end diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 199ed78ab..3c9907758 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -189,7 +189,8 @@ function gen_outbound(flag, node, tag, proxy_table) headers = (node.ws_host ~= nil) and {Host = node.ws_host} or nil, maxEarlyData = tonumber(node.ws_maxEarlyData) or nil, - earlyDataHeaderName = (node.ws_earlyDataHeaderName) and node.ws_earlyDataHeaderName or nil + earlyDataHeaderName = (node.ws_earlyDataHeaderName) and node.ws_earlyDataHeaderName or nil, + heartbeatPeriod = tonumber(node.ws_heartbeatPeriod) or nil } or nil, httpSettings = (node.transport == "h2") and { path = node.h2_path or "/", @@ -221,7 +222,14 @@ function gen_outbound(flag, node, tag, proxy_table) path = node.xhttp_path or node.splithttp_path or "/", host = node.xhttp_host or node.splithttp_host, -- 如果包含 "extra" 节,取 "extra" 内的内容,否则直接赋值给 extra - extra = node.xhttp_extra and (jsonc.parse(node.xhttp_extra).extra or jsonc.parse(node.xhttp_extra)) or nil + extra = node.xhttp_extra and (function() + local success, parsed = pcall(jsonc.parse, node.xhttp_extra) + if success then + return parsed.extra or parsed + else + return nil + end + end)() or nil } or nil, } or nil, settings = { diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po index 5b0c488f2..d91152c2f 100644 --- a/luci-app-passwall/po/zh-cn/passwall.po +++ b/luci-app-passwall/po/zh-cn/passwall.po @@ -1609,6 +1609,9 @@ msgstr "端口跳跃时间 " msgid "Additional ports for hysteria hop" msgstr "端口跳跃额外端口" +msgid "HeartbeatPeriod(second)" +msgstr "心跳周期(单位:秒)" + msgid "Custom geoip Path" msgstr "自定义 geoip 文件路径" diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua index d216733cf..1dbc3c224 100755 --- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -1000,10 +1000,14 @@ local function processData(szType, content, add_mode, add_from) result.xhttp_path = params.path result.xhttp_mode = params.mode or "auto" result.xhttp_extra = params.extra - local Data = params.extra and params.extra ~= "" and jsonParse(params.extra) - local address = (Data and Data.extra and Data.extra.downloadSettings and Data.extra.downloadSettings.address) - or (Data and Data.downloadSettings and Data.downloadSettings.address) - result.download_address = address and address ~= "" and address or nil + local success, Data = pcall(jsonParse, params.extra) + if success and Data then + local address = (Data.extra and Data.extra.downloadSettings and Data.extra.downloadSettings.address) + or (Data.downloadSettings and Data.downloadSettings.address) + result.download_address = address and address ~= "" and address or nil + else + result.download_address = nil + end end if params.type == 'httpupgrade' then result.httpupgrade_host = params.host