update 2026-05-28 10:41:36

This commit is contained in:
action committed 2026-05-28 10:41:36 +08:00
1 parent d0159b49a5
commit 1767015e34
3 files changed
+13 -10

No files matched your search

@@ -24,7 +24,6 @@ function index()
local uci = api.uci -- in function index()
local fs = api.fs
entry({"admin", "services", appname}).dependent = true
entry({"admin", "services", appname, "reset_config"}, call("reset_config")).leaf = true
entry({"admin", "services", appname, "show"}, call("show_menu")).leaf = true
entry({"admin", "services", appname, "hide"}, call("hide_menu")).leaf = true
local e
@@ -113,6 +112,7 @@ function index()
--[[Backup]]
entry({"admin", "services", appname, "create_backup"}, call("create_backup")).leaf = true
entry({"admin", "services", appname, "restore_backup"}, call("restore_backup")).leaf = true
entry({"admin", "services", appname, "reset_config"}, call("reset_config")).leaf = true
--[[geoview]]
entry({"admin", "services", appname, "geo_view"}, call("geo_view")).leaf = true
@@ -136,9 +136,15 @@ local function http_write_json_error(data)
end
function reset_config()
uci:revert(appname)
luci.sys.call("echo '' > /tmp/log/passwall.log")
luci.sys.call('/etc/init.d/passwall stop')
luci.sys.call('[ -f "/usr/share/passwall/0_default_config" ] && cp -f /usr/share/passwall/0_default_config /etc/config/passwall')
http.redirect(api.url())
if luci.sys.call('[ -s "/usr/share/passwall/0_default_config" ]') == 0 then
luci.sys.call('cp -f /usr/share/passwall/0_default_config /etc/config/passwall')
api.log(" * 恢复默认配置成功。")
else
api.log(" * 找不到默认配置文件,重置失败!")
end
end
function show_menu()
@@ -95,7 +95,7 @@ end
m:append(Template(appname .. "/global/status"))
global_cfgid = m:get("@global[0]")[".name"]
global_cfgid = (m:get("@global[0]") or {})[".name"] or ""
s = m:section(TypedSection, "global")
s.anonymous = true
@@ -150,12 +150,9 @@ local api = require "luci.passwall.api"
if (confirm("<%: Do you want to restore the client to default settings?%>")) {
setTimeout(function () {
if (confirm("<%: Are you sure you want to restore the client to default settings?%>")) {
var xhr1 = new XMLHttpRequest();
xhr1.open("GET",'<%= api.url("clear_log") %>', false);
xhr1.send();
var xhr2 = new XMLHttpRequest();
xhr2.open("GET",'<%= api.url("reset_config") %>', false);
xhr2.send();
const xhr = new XMLHttpRequest();
xhr.open("GET",'<%= api.url("reset_config") %>', false);
xhr.send();
window.location.href = '<%= api.url("log") %>'
}
}, 1000);