luci-app-passwall: sync upstream

last commit: 760d23b382
This commit is contained in:
actions 2024-05-03 13:30:04 +08:00
parent 0c37349105
commit 2abf2a5a9f
4 changed files with 16 additions and 8 deletions

View File

@ -16,7 +16,7 @@ function index()
entry({"admin", "services", appname, "show"}, call("show_menu")).leaf = true entry({"admin", "services", appname, "show"}, call("show_menu")).leaf = true
entry({"admin", "services", appname, "hide"}, call("hide_menu")).leaf = true entry({"admin", "services", appname, "hide"}, call("hide_menu")).leaf = true
if not nixio.fs.access("/etc/config/passwall") then return end if not nixio.fs.access("/etc/config/passwall") then return end
if nixio.fs.access("/etc/config/passwall_show") then if ucic:get(appname, "@global[0]", "show_menu") == "1" then
e = entry({"admin", "services", appname}, alias("admin", "services", appname, "settings"), _("Pass Wall"), -1) e = entry({"admin", "services", appname}, alias("admin", "services", appname, "settings"), _("Pass Wall"), -1)
e.dependent = true e.dependent = true
e.acl_depends = { "luci-app-passwall" } e.acl_depends = { "luci-app-passwall" }
@ -91,14 +91,16 @@ function reset_config()
end end
function show_menu() function show_menu()
luci.sys.call("touch /etc/config/passwall_show") ucic:set(appname, "@global[0]", "show_menu","1")
ucic:commit(appname)
luci.sys.call("rm -rf /tmp/luci-*") luci.sys.call("rm -rf /tmp/luci-*")
luci.sys.call("/etc/init.d/rpcd restart >/dev/null") luci.sys.call("/etc/init.d/rpcd restart >/dev/null")
luci.http.redirect(api.url()) luci.http.redirect(api.url())
end end
function hide_menu() function hide_menu()
luci.sys.call("rm -rf /etc/config/passwall_show") ucic:set(appname, "@global[0]", "show_menu","0")
ucic:commit(appname)
luci.sys.call("rm -rf /tmp/luci-*") luci.sys.call("rm -rf /tmp/luci-*")
luci.sys.call("/etc/init.d/rpcd restart >/dev/null") luci.sys.call("/etc/init.d/rpcd restart >/dev/null")
luci.http.redirect(luci.dispatcher.build_url("admin", "status", "overview")) luci.http.redirect(luci.dispatcher.build_url("admin", "status", "overview"))

View File

@ -31,11 +31,16 @@ uci -q batch <<-EOF >/dev/null
commit uhttpd commit uhttpd
EOF EOF
touch /etc/config/passwall_show >/dev/null 2>&1
[ ! -s "/etc/config/passwall" ] && cp -f /usr/share/passwall/0_default_config /etc/config/passwall [ ! -s "/etc/config/passwall" ] && cp -f /usr/share/passwall/0_default_config /etc/config/passwall
chmod +x /usr/share/passwall/*.sh chmod +x /usr/share/passwall/*.sh
[ -e "/etc/config/passwall_show" ] && {
rm -rf /etc/config/passwall_show
uci -q set passwall.@global[0].show_menu=1
uci -q commit passwall
}
rm -f /tmp/luci-indexcache rm -f /tmp/luci-indexcache
rm -rf /tmp/luci-modulecache/ rm -rf /tmp/luci-modulecache/
killall -HUP rpcd 2>/dev/null killall -HUP rpcd 2>/dev/null

View File

@ -1,5 +1,6 @@
config global config global
option show_menu '1'
option enabled '0' option enabled '0'
option socks_enabled '0' option socks_enabled '0'
option tcp_node 'nil' option tcp_node 'nil'

View File

@ -11,10 +11,10 @@ index 1fb70f5..e1a5538 100644
include $(TOPDIR)/feeds/luci/luci.mk include $(TOPDIR)/feeds/luci/luci.mk
diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua
index bfb8f79..31a6164 100644 index 626a7bd..622e952 100644
--- a/luci-app-passwall/luasrc/controller/passwall.lua --- a/luci-app-passwall/luasrc/controller/passwall.lua
+++ b/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua
@@ -242,7 +242,7 @@ function connect_status() @@ -244,7 +244,7 @@ function connect_status()
local e = {} local e = {}
e.use_time = "" e.use_time = ""
local url = luci.http.formvalue("url") local url = luci.http.formvalue("url")
@ -403,10 +403,10 @@ index 24662de..77b6a0b 100644
</div> </div>
</div> </div>
diff --git a/luci-app-passwall/root/usr/share/passwall/0_default_config b/luci-app-passwall/root/usr/share/passwall/0_default_config diff --git a/luci-app-passwall/root/usr/share/passwall/0_default_config b/luci-app-passwall/root/usr/share/passwall/0_default_config
index cfe606d..1601d03 100644 index 0d2bf8f..331951d 100644
--- a/luci-app-passwall/root/usr/share/passwall/0_default_config --- a/luci-app-passwall/root/usr/share/passwall/0_default_config
+++ b/luci-app-passwall/root/usr/share/passwall/0_default_config +++ b/luci-app-passwall/root/usr/share/passwall/0_default_config
@@ -32,7 +32,7 @@ config global_haproxy @@ -33,7 +33,7 @@ config global_haproxy
config global_delay config global_delay
option auto_on '0' option auto_on '0'
option start_daemon '1' option start_daemon '1'