parent
2fdb1e5629
commit
9a7eb879ac
@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=25.1.1
|
||||
PKG_VERSION:=25.1.8
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
@ -98,16 +98,14 @@ function reset_config()
|
||||
end
|
||||
|
||||
function show_menu()
|
||||
uci:delete(appname, "@global[0]", "hide_from_luci")
|
||||
api.uci_save(uci, appname, true)
|
||||
api.sh_uci_del(appname, "@global[0]", "hide_from_luci", true)
|
||||
luci.sys.call("rm -rf /tmp/luci-*")
|
||||
luci.sys.call("/etc/init.d/rpcd restart >/dev/null")
|
||||
luci.http.redirect(api.url())
|
||||
end
|
||||
|
||||
function hide_menu()
|
||||
uci:set(appname, "@global[0]", "hide_from_luci","1")
|
||||
api.uci_save(uci, appname, true)
|
||||
api.sh_uci_set(appname, "@global[0]", "hide_from_luci", "1", true)
|
||||
luci.sys.call("rm -rf /tmp/luci-*")
|
||||
luci.sys.call("/etc/init.d/rpcd restart >/dev/null")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "status", "overview"))
|
||||
@ -294,8 +292,7 @@ function set_node()
|
||||
local config = luci.http.formvalue("config")
|
||||
local section = luci.http.formvalue("section")
|
||||
uci:set(appname, type, config, section)
|
||||
api.uci_save(uci, appname, true)
|
||||
luci.sys.call("/etc/init.d/passwall2 restart > /dev/null 2>&1 &")
|
||||
api.uci_save(uci, appname, true, true)
|
||||
luci.http.redirect(api.url("log"))
|
||||
end
|
||||
|
||||
|
@ -337,10 +337,15 @@ o = s:taboption("DNS", Flag, "dns_redirect", translate("DNS Redirect"), translat
|
||||
o.default = "1"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:taboption("DNS", Button, "clear_ipset", translate("Clear IPSet"), translate("Try this feature if the rule modification does not take effect."))
|
||||
if (m:get("@global_forwarding[0]", "use_nft") or "0") == "1" then
|
||||
o = s:taboption("DNS", Button, "clear_ipset", translate("Clear NFTSET"), translate("Try this feature if the rule modification does not take effect."))
|
||||
else
|
||||
o = s:taboption("DNS", Button, "clear_ipset", translate("Clear IPSET"), translate("Try this feature if the rule modification does not take effect."))
|
||||
end
|
||||
o.inputstyle = "remove"
|
||||
function o.write(e, e)
|
||||
luci.sys.call('[ -n "$(nft list sets 2>/dev/null | grep \"passwall2_\")" ] && sh /usr/share/passwall2/nftables.sh flush_nftset_reload || sh /usr/share/passwall2/iptables.sh flush_ipset_reload > /dev/null 2>&1 &')
|
||||
m:set("@global[0]", "flush_set", "1")
|
||||
api.uci_save(m.uci, appname, true, true)
|
||||
luci.http.redirect(api.url("log"))
|
||||
end
|
||||
|
||||
|
@ -1301,7 +1301,7 @@ function gen_config(var)
|
||||
experimental.cache_file = {
|
||||
enabled = true,
|
||||
store_fakeip = true,
|
||||
path = "/tmp/singbox_passwall2_" .. flag .. ".db"
|
||||
path = CACHE_PATH .. "/singbox_" .. flag .. ".db"
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -968,24 +968,16 @@ del_firewall_rule() {
|
||||
ip -6 rule del fwmark 1 table 100 2>/dev/null
|
||||
ip -6 route del local ::/0 dev lo table 100 2>/dev/null
|
||||
|
||||
$DIR/app.sh echolog "删除iptables防火墙规则完成。"
|
||||
$DIR/app.sh echolog "删除 iptables 规则完成。"
|
||||
}
|
||||
|
||||
flush_ipset() {
|
||||
$DIR/app.sh echolog "清空 IPSET。"
|
||||
$DIR/app.sh echolog "清空 IPSet。"
|
||||
for _name in $(ipset list | grep "Name: " | grep "passwall2_" | awk '{print $2}'); do
|
||||
destroy_ipset ${_name}
|
||||
done
|
||||
}
|
||||
|
||||
flush_ipset_reload() {
|
||||
del_firewall_rule
|
||||
flush_ipset
|
||||
rm -rf /tmp/singbox_passwall2_*
|
||||
rm -f /tmp/etc/passwall2_tmp/geoip-*.json
|
||||
/etc/init.d/passwall2 reload
|
||||
}
|
||||
|
||||
flush_include() {
|
||||
echo '#!/bin/sh' >$FWI
|
||||
}
|
||||
@ -1076,6 +1068,13 @@ start() {
|
||||
|
||||
stop() {
|
||||
del_firewall_rule
|
||||
[ $(config_t_get global flush_set "0") = "1" ] && {
|
||||
uci -q delete ${CONFIG}.@global[0].flush_set
|
||||
uci -q commit ${CONFIG}
|
||||
flush_ipset
|
||||
rm -rf /tmp/etc/passwall2_tmp/singbox*
|
||||
rm -f /tmp/etc/passwall2_tmp/geoip-*.json
|
||||
}
|
||||
flush_include
|
||||
}
|
||||
|
||||
@ -1091,12 +1090,6 @@ insert_rule_before)
|
||||
insert_rule_after)
|
||||
insert_rule_after "$@"
|
||||
;;
|
||||
flush_ipset)
|
||||
flush_ipset
|
||||
;;
|
||||
flush_ipset_reload)
|
||||
flush_ipset_reload
|
||||
;;
|
||||
get_ipt_bin)
|
||||
get_ipt_bin
|
||||
;;
|
||||
|
@ -1027,11 +1027,11 @@ del_firewall_rule() {
|
||||
destroy_nftset $NFTSET_LAN6
|
||||
destroy_nftset $NFTSET_VPS6
|
||||
|
||||
$DIR/app.sh echolog "删除nftables防火墙规则完成。"
|
||||
$DIR/app.sh echolog "删除 nftables 规则完成。"
|
||||
}
|
||||
|
||||
flush_nftset() {
|
||||
$DIR/app.sh echolog "清空 NFTSET。"
|
||||
$DIR/app.sh echolog "清空 NFTSet。"
|
||||
for _name in $(nft -a list sets | grep -E "passwall2" | awk -F 'set ' '{print $2}' | awk '{print $1}'); do
|
||||
destroy_nftset ${_name}
|
||||
done
|
||||
@ -1042,14 +1042,6 @@ flush_table() {
|
||||
nft delete table $NFTABLE_NAME
|
||||
}
|
||||
|
||||
flush_nftset_reload() {
|
||||
del_firewall_rule
|
||||
flush_table
|
||||
rm -rf /tmp/singbox_passwall2_*
|
||||
rm -f /tmp/etc/passwall2_tmp/geoip-*.json
|
||||
/etc/init.d/passwall2 reload
|
||||
}
|
||||
|
||||
flush_include() {
|
||||
echo '#!/bin/sh' >$FWI
|
||||
}
|
||||
@ -1101,6 +1093,14 @@ start() {
|
||||
|
||||
stop() {
|
||||
del_firewall_rule
|
||||
[ $(config_t_get global flush_set "0") = "1" ] && {
|
||||
uci -q delete ${CONFIG}.@global[0].flush_set
|
||||
uci -q commit ${CONFIG}
|
||||
#flush_table
|
||||
flush_nftset
|
||||
rm -rf /tmp/etc/passwall2_tmp/singbox*
|
||||
rm -f /tmp/etc/passwall2_tmp/geoip-*.json
|
||||
}
|
||||
flush_include
|
||||
}
|
||||
|
||||
@ -1116,12 +1116,6 @@ insert_rule_before)
|
||||
insert_rule_after)
|
||||
insert_rule_after "$@"
|
||||
;;
|
||||
flush_nftset)
|
||||
flush_nftset
|
||||
;;
|
||||
flush_nftset_reload)
|
||||
flush_nftset_reload
|
||||
;;
|
||||
get_wan_ip)
|
||||
get_wan_ip
|
||||
;;
|
||||
|
@ -93,6 +93,9 @@ local function fetch_geoip()
|
||||
end
|
||||
end
|
||||
end
|
||||
if json.message then
|
||||
log(json.message)
|
||||
end
|
||||
end,
|
||||
function(e)
|
||||
end)
|
||||
@ -144,6 +147,9 @@ local function fetch_geosite()
|
||||
end
|
||||
end
|
||||
end
|
||||
if json.message then
|
||||
log(json.message)
|
||||
end
|
||||
end,
|
||||
function(e)
|
||||
end)
|
||||
@ -196,10 +202,7 @@ if reboot == 1 then
|
||||
end
|
||||
|
||||
log("重启服务,应用新的规则。")
|
||||
if use_nft == "1" then
|
||||
sys.call("sh /usr/share/" .. name .. "/nftables.sh flush_nftset_reload > /dev/null 2>&1 &")
|
||||
else
|
||||
sys.call("sh /usr/share/" .. name .. "/iptables.sh flush_ipset_reload > /dev/null 2>&1 &")
|
||||
end
|
||||
uci:set(name, "@global[0]", "flush_set", "1")
|
||||
api.uci_save(uci, name, true, true)
|
||||
end
|
||||
log("规则更新完毕...")
|
||||
|
Loading…
Reference in New Issue
Block a user