luci-app-passwall: sync upstream

last commit: 7866380106
This commit is contained in:
gitea-action 2025-01-12 14:30:19 +08:00
parent 744e5f64ca
commit 2067c985ee
3 changed files with 16 additions and 9 deletions

View File

@ -566,14 +566,12 @@ o = s:option(Value, _n("xhttp_path"), translate("XHTTP Path"))
o.placeholder = "/" o.placeholder = "/"
o:depends({ [_n("transport")] = "xhttp" }) o:depends({ [_n("transport")] = "xhttp" })
o = s:option(TextValue, _n("xhttp_extra"), translate("XHTTP Extra"), translate("An <a target='_blank' href='https://xtls.github.io/config/transports/splithttp.html#extra'>XHTTP extra object</a> in raw json")) o = s:option(TextValue, _n("xhttp_extra"), translate("XHTTP Extra"), translate("An XHttpObject in JSON format, used for sharing."))
o:depends({ [_n("transport")] = "xhttp" }) o:depends({ [_n("transport")] = "xhttp" })
o.rows = 15 o.rows = 15
o.wrap = "off" o.wrap = "off"
o.custom_write = function(self, section, value) o.custom_write = function(self, section, value)
m:set(section, self.option:sub(1 + #option_prefix), value) m:set(section, self.option:sub(1 + #option_prefix), value)
local success, data = pcall(jsonc.parse, value) local success, data = pcall(jsonc.parse, value)
if success and data then if success and data then
local address = (data.extra and data.extra.downloadSettings and data.extra.downloadSettings.address) local address = (data.extra and data.extra.downloadSettings and data.extra.downloadSettings.address)
@ -594,6 +592,10 @@ o.validate = function(self, value)
end end
return value return value
end end
o.custom_remove = function(self, section, value)
m:del(section, self.option:sub(1 + #option_prefix))
m:del(section, "download_address")
end
-- [[ Mux.Cool ]]-- -- [[ Mux.Cool ]]--
o = s:option(Flag, _n("mux"), "Mux", translate("Enable Mux.Cool")) o = s:option(Flag, _n("mux"), "Mux", translate("Enable Mux.Cool"))

View File

@ -1178,6 +1178,10 @@ function luci_types(id, m, s, type_name, option_prefix)
end end
s.fields[key].remove = function(self, section) s.fields[key].remove = function(self, section)
if s.fields["type"]:formvalue(id) == type_name then if s.fields["type"]:formvalue(id) == type_name then
-- 添加自定义 custom_remove 属性,如果有自定义的 custom_remove 函数,则使用自定义的 remove 逻辑
if self.custom_remove then
self:custom_remove(section)
else
if self.rewrite_option and rewrite_option_table[self.rewrite_option] == 1 then if self.rewrite_option and rewrite_option_table[self.rewrite_option] == 1 then
m:del(section, self.rewrite_option) m:del(section, self.rewrite_option)
else else
@ -1188,6 +1192,7 @@ function luci_types(id, m, s, type_name, option_prefix)
end end
end end
end end
end
local deps = s.fields[key].deps local deps = s.fields[key].deps
if #deps > 0 then if #deps > 0 then

View File

@ -1567,8 +1567,8 @@ msgstr "客户端文件不适合当前设备。"
msgid "Can't move new file to path: %s" msgid "Can't move new file to path: %s"
msgstr "无法移动新文件到:%s" msgstr "无法移动新文件到:%s"
msgid "An <a target='_blank' href='https://xtls.github.io/config/transports/splithttp.html#extra'>XHTTP extra object</a> in raw json" msgid "An XHttpObject in JSON format, used for sharing."
msgstr "一个 json 格式的 <a target='_blank' href='https://xtls.github.io/config/transports/splithttp.html#extra'>XHTTP extra object</a>" msgstr "JSON 格式的 XHttpObject用来实现分享。"
msgid "Enable Mux.Cool" msgid "Enable Mux.Cool"
msgstr "启用 Mux.Cool" msgstr "启用 Mux.Cool"