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 7cb119bb9..029715699 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,14 +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 XHTTP extra object 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.rows = 15
o.wrap = "off"
o.custom_write = function(self, section, value)
-
m:set(section, self.option:sub(1 + #option_prefix), value)
-
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)
@@ -594,6 +592,10 @@ o.validate = function(self, value)
end
return value
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 ]]--
o = s:option(Flag, _n("mux"), "Mux", translate("Enable Mux.Cool"))
diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua
index 48f0dd402..c1a7a283d 100644
--- a/luci-app-passwall/luasrc/passwall/api.lua
+++ b/luci-app-passwall/luasrc/passwall/api.lua
@@ -1178,11 +1178,16 @@ function luci_types(id, m, s, type_name, option_prefix)
end
s.fields[key].remove = function(self, section)
if s.fields["type"]:formvalue(id) == type_name then
- if self.rewrite_option and rewrite_option_table[self.rewrite_option] == 1 then
- m:del(section, self.rewrite_option)
+ -- 添加自定义 custom_remove 属性,如果有自定义的 custom_remove 函数,则使用自定义的 remove 逻辑
+ if self.custom_remove then
+ self:custom_remove(section)
else
- if self.option:find(option_prefix) == 1 then
- m:del(section, self.option:sub(1 + #option_prefix))
+ if self.rewrite_option and rewrite_option_table[self.rewrite_option] == 1 then
+ m:del(section, self.rewrite_option)
+ else
+ if self.option:find(option_prefix) == 1 then
+ m:del(section, self.option:sub(1 + #option_prefix))
+ end
end
end
end
diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po
index f5e216e7b..657a00b27 100644
--- a/luci-app-passwall/po/zh-cn/passwall.po
+++ b/luci-app-passwall/po/zh-cn/passwall.po
@@ -1567,8 +1567,8 @@ msgstr "客户端文件不适合当前设备。"
msgid "Can't move new file to path: %s"
msgstr "无法移动新文件到:%s"
-msgid "An XHTTP extra object in raw json"
-msgstr "一个 json 格式的 XHTTP extra object"
+msgid "An XHttpObject in JSON format, used for sharing."
+msgstr "JSON 格式的 XHttpObject,用来实现分享。"
msgid "Enable Mux.Cool"
msgstr "启用 Mux.Cool"