mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 17:35:13 +08:00
🐤 Sync 2026-04-21 23:57:32
This commit is contained in:
1 parent
c27391a2ae
commit
1b5d8bfe7a
2 files changed
+41
-8
No files matched your search
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-passwall
|
PKG_NAME:=luci-app-passwall
|
||||||
PKG_VERSION:=26.4.15
|
PKG_VERSION:=26.4.15
|
||||||
PKG_RELEASE:=87
|
PKG_RELEASE:=88
|
||||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ local UrlEncode = api.UrlEncode
|
|||||||
local UrlDecode = api.UrlDecode
|
local UrlDecode = api.UrlDecode
|
||||||
local uci = api.uci
|
local uci = api.uci
|
||||||
local fs = api.fs
|
local fs = api.fs
|
||||||
uci:revert(appname)
|
|
||||||
|
|
||||||
local has_ss = api.is_finded("ss-redir")
|
local has_ss = api.is_finded("ss-redir")
|
||||||
local has_ss_rust = api.is_finded("sslocal")
|
local has_ss_rust = api.is_finded("sslocal")
|
||||||
@@ -317,7 +316,12 @@ do
|
|||||||
currentNodes[#currentNodes + 1] = {
|
currentNodes[#currentNodes + 1] = {
|
||||||
log = true,
|
log = true,
|
||||||
node = node,
|
node = node,
|
||||||
currentNode = node and uci:get_all(appname, node) or nil,
|
currentNode = (function()
|
||||||
|
if node and node:find("Socks_") then
|
||||||
|
return { Socks = node }
|
||||||
|
end
|
||||||
|
return node and uci:get_all(appname, node) or nil
|
||||||
|
end)(),
|
||||||
remarks = node,
|
remarks = node,
|
||||||
set = function(o, server)
|
set = function(o, server)
|
||||||
if o and server and server ~= "nil" then
|
if o and server and server ~= "nil" then
|
||||||
@@ -341,7 +345,7 @@ do
|
|||||||
|
|
||||||
--后备节点
|
--后备节点
|
||||||
local currentNode = uci:get_all(appname, node_id) or nil
|
local currentNode = uci:get_all(appname, node_id) or nil
|
||||||
if currentNode and currentNode.fallback_node then
|
if currentNode and currentNode.fallback_node and not currentNode.fallback_node:find("Socks_") then
|
||||||
CONFIG[#CONFIG + 1] = {
|
CONFIG[#CONFIG + 1] = {
|
||||||
log = true,
|
log = true,
|
||||||
id = node_id,
|
id = node_id,
|
||||||
@@ -365,7 +369,12 @@ do
|
|||||||
currentNodes[#currentNodes + 1] = {
|
currentNodes[#currentNodes + 1] = {
|
||||||
log = true,
|
log = true,
|
||||||
node = node,
|
node = node,
|
||||||
currentNode = node and uci:get_all(appname, node) or nil,
|
currentNode = (function()
|
||||||
|
if node and node:find("Socks_") then
|
||||||
|
return { Socks = node }
|
||||||
|
end
|
||||||
|
return node and uci:get_all(appname, node) or nil
|
||||||
|
end)(),
|
||||||
remarks = node,
|
remarks = node,
|
||||||
set = function(o, server)
|
set = function(o, server)
|
||||||
if o and server and server ~= "nil" then
|
if o and server and server ~= "nil" then
|
||||||
@@ -1745,6 +1754,10 @@ end
|
|||||||
local function select_node(nodes, config, parentConfig)
|
local function select_node(nodes, config, parentConfig)
|
||||||
if config.currentNode then
|
if config.currentNode then
|
||||||
local server
|
local server
|
||||||
|
-- 负载均衡、urltest中的 Socks [端口] 节点保持原id
|
||||||
|
if config.currentNode["Socks"] then
|
||||||
|
server = config.currentNode.Socks
|
||||||
|
end
|
||||||
-- 特别优先级 cfgid
|
-- 特别优先级 cfgid
|
||||||
if config.currentNode[".name"] then
|
if config.currentNode[".name"] then
|
||||||
for index, node in pairs(nodes) do
|
for index, node in pairs(nodes) do
|
||||||
@@ -1959,7 +1972,6 @@ local function update_node(manual)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
api.uci_save(uci, appname, true)
|
|
||||||
|
|
||||||
if next(CONFIG) then
|
if next(CONFIG) then
|
||||||
local nodes = {}
|
local nodes = {}
|
||||||
@@ -1980,10 +1992,10 @@ local function update_node(manual)
|
|||||||
select_node(nodes, config)
|
select_node(nodes, config)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
api.uci_save(uci, appname, true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
api.uci_save(uci, appname, true)
|
||||||
|
|
||||||
if arg[3] == "cron" then
|
if arg[3] == "cron" then
|
||||||
if not fs.access("/var/lock/" .. appname .. ".lock") then
|
if not fs.access("/var/lock/" .. appname .. ".lock") then
|
||||||
luci.sys.call("touch /tmp/lock/" .. appname .. "_cron.lock")
|
luci.sys.call("touch /tmp/lock/" .. appname .. "_cron.lock")
|
||||||
@@ -2162,7 +2174,26 @@ local execute = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function check_instance(action)
|
||||||
|
local lock_file = "/var/lock/" .. appname .. "_subscribe.lock"
|
||||||
|
if action == "start" then
|
||||||
|
math.randomseed(os.time() + math.floor(os.clock() * 1000))
|
||||||
|
api.nixio.nanosleep(0, math.random(100, 1000) * 1000000)
|
||||||
|
if fs.access(lock_file) then
|
||||||
|
log("有订阅实例正在运行,请稍后再试...\n")
|
||||||
|
os.exit(0)
|
||||||
|
else
|
||||||
|
luci.sys.call("touch " .. lock_file)
|
||||||
|
uci:revert(appname)
|
||||||
|
end
|
||||||
|
elseif action == "end" then
|
||||||
|
luci.sys.call("rm -f " .. lock_file)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if arg[1] then
|
if arg[1] then
|
||||||
|
check_instance("start")
|
||||||
|
|
||||||
if arg[1] == "start" then
|
if arg[1] == "start" then
|
||||||
log('开始订阅...')
|
log('开始订阅...')
|
||||||
xpcall(execute, function(e)
|
xpcall(execute, function(e)
|
||||||
@@ -2183,4 +2214,6 @@ if arg[1] then
|
|||||||
elseif arg[1] == "truncate" then
|
elseif arg[1] == "truncate" then
|
||||||
truncate_nodes(arg[2])
|
truncate_nodes(arg[2])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
check_instance("end")
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user