🍉 Sync 2025-11-07 00:12:45
This commit is contained in:
@@ -450,12 +450,12 @@ local function get_subscribe_info(cfgid, value)
|
||||
end
|
||||
|
||||
-- 处理数据
|
||||
local function processData(szType, content, add_mode, add_from)
|
||||
--log(content, add_mode, add_from)
|
||||
local function processData(szType, content, add_mode, group)
|
||||
--log(content, add_mode, group)
|
||||
local result = {
|
||||
timeout = 60,
|
||||
add_mode = add_mode, --0为手动配置,1为导入,2为订阅
|
||||
add_from = add_from
|
||||
group = group
|
||||
}
|
||||
--ssr://base64(host:port:protocol:method:obfs:base64pass/?obfsparam=base64param&protoparam=base64param&remarks=base64remarks&group=base64group&udpport=0&uot=0)
|
||||
if szType == 'ssr' then
|
||||
@@ -1539,14 +1539,14 @@ local function curl(url, file, ua, mode)
|
||||
return tonumber(result)
|
||||
end
|
||||
|
||||
local function truncate_nodes(add_from)
|
||||
local function truncate_nodes(group)
|
||||
for _, config in pairs(CONFIG) do
|
||||
if config.currentNodes and #config.currentNodes > 0 then
|
||||
local newNodes = {}
|
||||
local removeNodesSet = {}
|
||||
for k, v in pairs(config.currentNodes) do
|
||||
if v.currentNode and v.currentNode.add_mode == "2" then
|
||||
if (not add_from) or (add_from and add_from == v.currentNode.add_from) then
|
||||
if (not group) or (group and group == v.currentNode.group) then
|
||||
removeNodesSet[v.currentNode[".name"]] = true
|
||||
end
|
||||
end
|
||||
@@ -1561,7 +1561,7 @@ local function truncate_nodes(add_from)
|
||||
end
|
||||
else
|
||||
if config.currentNode and config.currentNode.add_mode == "2" then
|
||||
if (not add_from) or (add_from and add_from == config.currentNode.add_from) then
|
||||
if (not group) or (group and group == config.currentNode.group) then
|
||||
if config.delete then
|
||||
config.delete(config)
|
||||
elseif config.set then
|
||||
@@ -1573,13 +1573,13 @@ local function truncate_nodes(add_from)
|
||||
end
|
||||
uci:foreach(appname, "nodes", function(node)
|
||||
if node.add_mode == "2" then
|
||||
if (not add_from) or (add_from and add_from == node.add_from) then
|
||||
if (not group) or (group and group == node.group) then
|
||||
uci:delete(appname, node['.name'])
|
||||
end
|
||||
end
|
||||
end)
|
||||
uci:foreach(appname, "subscribe_list", function(o)
|
||||
if (not add_from) or add_from == o.remark then
|
||||
if (not group) or group == o.remark then
|
||||
uci:delete(appname, o['.name'], "md5")
|
||||
end
|
||||
end)
|
||||
@@ -1720,7 +1720,7 @@ local function update_node(manual)
|
||||
if manual == 0 and next(group) then
|
||||
uci:foreach(appname, "nodes", function(node)
|
||||
-- 如果未发现新节点或手动导入的节点就不要删除了...
|
||||
if node.add_mode == "2" and (node.add_from and group[node.add_from] == true) then
|
||||
if node.add_mode == "2" and (node.group and group[node.group] == true) then
|
||||
uci:delete(appname, node['.name'])
|
||||
end
|
||||
end)
|
||||
@@ -1797,7 +1797,7 @@ local function update_node(manual)
|
||||
luci.sys.call("/etc/init.d/" .. appname .. " restart > /dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
local function parse_link(raw, add_mode, add_from, cfgid)
|
||||
local function parse_link(raw, add_mode, group, cfgid)
|
||||
if raw and #raw > 0 then
|
||||
local nodes, szType
|
||||
local node_list = {}
|
||||
@@ -1833,17 +1833,17 @@ local function parse_link(raw, add_mode, add_from, cfgid)
|
||||
xpcall(function ()
|
||||
local result
|
||||
if szType == 'ssd' then
|
||||
result = processData(szType, v, add_mode, add_from)
|
||||
result = processData(szType, v, add_mode, group)
|
||||
elseif not szType then
|
||||
local node = api.trim(v)
|
||||
local dat = split(node, "://")
|
||||
if dat and dat[1] and dat[2] then
|
||||
if dat[1] == 'vmess' or dat[1] == 'ssr' then
|
||||
local link = api.trim(dat[2]:gsub("#.*$", ""))
|
||||
result = processData(dat[1], base64Decode(link), add_mode, add_from)
|
||||
result = processData(dat[1], base64Decode(link), add_mode, group)
|
||||
else
|
||||
local link = dat[2]:gsub("&", "&"):gsub("%s*#%s*", "#") -- 一些奇葩的链接用"&"当做"&","#"前后带空格
|
||||
result = processData(dat[1], link, add_mode, add_from)
|
||||
result = processData(dat[1], link, add_mode, group)
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -1874,14 +1874,14 @@ local function parse_link(raw, add_mode, add_from, cfgid)
|
||||
end
|
||||
if #node_list > 0 then
|
||||
nodeResult[#nodeResult + 1] = {
|
||||
remark = add_from,
|
||||
remark = group,
|
||||
list = node_list
|
||||
}
|
||||
end
|
||||
log('成功解析【' .. add_from .. '】节点数量: ' .. #node_list)
|
||||
log('成功解析【' .. group .. '】节点数量: ' .. #node_list)
|
||||
else
|
||||
if add_mode == "2" then
|
||||
log('获取到的【' .. add_from .. '】订阅内容为空,可能是订阅地址无效,或是网络问题,请诊断!')
|
||||
log('获取到的【' .. group .. '】订阅内容为空,可能是订阅地址无效,或是网络问题,请诊断!')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user