mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 17:11:31 +08:00
Update On Thu Jul 18 20:32:03 CEST 2024
This commit is contained in:
@@ -8,6 +8,8 @@ local jsonc = require "luci.jsonc"
|
||||
local name = 'passwall2'
|
||||
local api = require "luci.passwall2.api"
|
||||
local arg1 = arg[1]
|
||||
local arg2 = arg[2]
|
||||
local arg3 = arg[3]
|
||||
|
||||
local reboot = 0
|
||||
local geoip_update = 0
|
||||
@@ -20,6 +22,10 @@ local geosite_api = ucic:get_first(name, 'global_rules', "geosite_url", "https:/
|
||||
--
|
||||
local use_nft = ucic:get(name, "@global_forwarding[0]", "use_nft") or "0"
|
||||
|
||||
if arg3 == "cron" then
|
||||
arg2 = nil
|
||||
end
|
||||
|
||||
local log = function(...)
|
||||
if arg1 then
|
||||
if arg1 == "log" then
|
||||
@@ -145,8 +151,8 @@ local function fetch_geosite()
|
||||
return 0
|
||||
end
|
||||
|
||||
if arg[2] then
|
||||
string.gsub(arg[2], '[^' .. "," .. ']+', function(w)
|
||||
if arg2 then
|
||||
string.gsub(arg2, '[^' .. "," .. ']+', function(w)
|
||||
if w == "geoip" then
|
||||
geoip_update = 1
|
||||
end
|
||||
@@ -184,6 +190,12 @@ ucic:save(name)
|
||||
luci.sys.call("uci commit " .. name)
|
||||
|
||||
if reboot == 1 then
|
||||
if arg3 == "cron" then
|
||||
if not nixio.fs.access("/var/lock/" .. name .. ".lock") then
|
||||
luci.sys.call("touch /tmp/lock/" .. name .. "_cron.lock")
|
||||
end
|
||||
end
|
||||
|
||||
log("重启服务,应用新的规则。")
|
||||
if use_nft == "1" then
|
||||
luci.sys.call("sh /usr/share/" .. name .. "/nftables.sh flush_nftset_reload > /dev/null 2>&1 &")
|
||||
|
||||
Reference in New Issue
Block a user