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 0297156990..488974ff78 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 @@ -566,8 +566,12 @@ o = s:option(Value, _n("xhttp_path"), translate("XHTTP Path")) o.placeholder = "/" o:depends({ [_n("transport")] = "xhttp" }) -o = s:option(TextValue, _n("xhttp_extra"), translate("XHTTP Extra"), translate("An XHttpObject in JSON format, used for sharing.")) +o = s:option(Flag, _n("use_xhttp_extra"), translate("XHTTP Extra")) +o.default = "0" o:depends({ [_n("transport")] = "xhttp" }) + +o = s:option(TextValue, _n("xhttp_extra"), " ", translate("An XHttpObject in JSON format, used for sharing.")) +o:depends({ [_n("use_xhttp_extra")] = true }) o.rows = 15 o.wrap = "off" o.custom_write = function(self, section, value) diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm index 80cc37cc19..c0d33caae8 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm @@ -383,7 +383,9 @@ params += opt.query("host", dom_prefix + "xhttp_host"); params += opt.query("path", dom_prefix + "xhttp_path"); params += opt.query("mode", dom_prefix + "xhttp_mode"); - params += opt.query("extra", dom_prefix + "xhttp_extra"); + if (opt.get(dom_prefix + "use_xhttp_extra").checked) { + params += opt.query("extra", dom_prefix + "xhttp_extra"); + } } else if (v_transport === "httpupgrade") { v_transport = "httpupgrade"; params += opt.query("host", dom_prefix + "httpupgrade_host"); @@ -1266,6 +1268,7 @@ opt.set(dom_prefix + 'xhttp_host', queryParam.host || ""); opt.set(dom_prefix + 'xhttp_path', queryParam.path || ""); opt.set(dom_prefix + 'xhttp_mode', queryParam.mode || "auto"); + opt.set(dom_prefix + 'use_xhttp_extra', !!queryParam.extra); opt.set(dom_prefix + 'xhttp_extra', queryParam.extra || ""); } else if (queryParam.type === "httpupgrade") { opt.set(dom_prefix + 'httpupgrade_host', queryParam.host || ""); diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 931222e5ed..0809f3888f 100755 --- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -1054,7 +1054,8 @@ local function processData(szType, content, add_mode, add_from) result.xhttp_host = params.host result.xhttp_path = params.path result.xhttp_mode = params.mode or "auto" - result.xhttp_extra = params.extra + result.use_xhttp_extra = (params.extra and params.extra ~= "") and "1" or nil + result.xhttp_extra = (params.extra and params.extra ~= "") and params.extra 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)