luci: add remove sing-box resource files button

This commit is contained in:
xiaorouji 2023-11-23 02:35:19 +08:00 committed by sbwml
parent 602ddad71b
commit c723875552
2 changed files with 20 additions and 0 deletions

View File

@ -199,6 +199,20 @@ if has_singbox then
o.default = "https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db"
o:value("https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db")
o.rmempty = false
o = s:option(Button, "_remove_resource", translate("Remove resource files"))
o.description = translate("Sing-Box will automatically download resource files when starting, you can use this feature achieve upgrade resource files.")
o.inputstyle = "remove"
function o.write(self, section, value)
local geoip_path = s.fields["geoip_path"] and s.fields["geoip_path"]:formvalue(section) or nil
if geoip_path then
os.remove(geoip_path)
end
local geosite_path = s.fields["geosite_path"] and s.fields["geosite_path"]:formvalue(section) or nil
if geosite_path then
os.remove(geosite_path)
end
end
end
return m

View File

@ -1510,6 +1510,12 @@ msgstr "自定义geosite文件路径"
msgid "Custom geosite URL"
msgstr "自定义geosite文件更新链接"
msgid "Remove resource files"
msgstr "删除资源文件"
msgid "Sing-Box will automatically download resource files when starting, you can use this feature achieve upgrade resource files."
msgstr "Sing-Box 会在启动时自动下载资源文件,您可以使用此功能实现升级资源文件。"
msgid "Override the connection destination address"
msgstr "覆盖连接目标地址"