update 2025-07-23 09:39:23

This commit is contained in:
actions-user 2025-07-23 09:39:23 +08:00
parent c302f688c7
commit cba4222c57
15 changed files with 103 additions and 145 deletions

View File

@ -100,6 +100,4 @@ o:value("1:65535", translate("All"))
o:value("53", "53") o:value("53", "53")
]]-- ]]--
m:append(Template(appname .. "/acl/js"))
return m return m

View File

@ -59,6 +59,11 @@ function m.commit_handler(self)
end) end)
end end
m.render = function(self, ...)
Map.render(self, ...)
api.optimize_cbi_ui()
end
o = s:option(ListValue, "filter_keyword_mode", translate("Filter keyword Mode")) o = s:option(ListValue, "filter_keyword_mode", translate("Filter keyword Mode"))
o:value("0", translate("Close")) o:value("0", translate("Close"))
o:value("1", translate("Discard List")) o:value("1", translate("Discard List"))
@ -134,8 +139,7 @@ end
o = s:option(Button, "_update", translate("Manual subscription All")) o = s:option(Button, "_update", translate("Manual subscription All"))
o.inputstyle = "apply" o.inputstyle = "apply"
function o.write(t, n) function o.write(t, n)
luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start > /dev/null 2>&1 &") luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start all manual > /dev/null 2>&1 &")
m.no_commit = true
luci.http.redirect(api.url("log")) luci.http.redirect(api.url("log"))
end end
@ -203,8 +207,7 @@ end
o = s:option(Button, "_update", translate("Manual subscription")) o = s:option(Button, "_update", translate("Manual subscription"))
o.inputstyle = "apply" o.inputstyle = "apply"
function o.write(t, n) function o.write(t, n)
luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start " .. n .. " > /dev/null 2>&1 &") luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start " .. n .. " manual > /dev/null 2>&1 &")
m.no_commit = true
luci.http.redirect(api.url("log")) luci.http.redirect(api.url("log"))
end end

View File

@ -9,6 +9,11 @@ if not arg[1] or not m:get(arg[1]) then
luci.http.redirect(m.redirect) luci.http.redirect(m.redirect)
end end
m.render = function(self, ...)
Map.render(self, ...)
api.optimize_cbi_ui()
end
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")
local has_trojan_plus = api.is_finded("trojan-plus") local has_trojan_plus = api.is_finded("trojan-plus")

View File

@ -250,6 +250,4 @@ if has_singbox then
o.description = translate("Override the connection destination address with the sniffed domain.<br />When enabled, traffic will match only by domain, ignoring IP rules.<br />If using shunt nodes, configure the domain shunt rules correctly.") o.description = translate("Override the connection destination address with the sniffed domain.<br />When enabled, traffic will match only by domain, ignoring IP rules.<br />If using shunt nodes, configure the domain shunt rules correctly.")
end end
m:append(Template(appname .. "/other/js"))
return m return m

View File

@ -1290,3 +1290,27 @@ function format_go_time(input)
if s > 0 or result == "" then result = result .. s .. "s" end if s > 0 or result == "" then result = result .. s .. "s" end
return result return result
end end
function optimize_cbi_ui()
luci.http.write([[
<script type="text/javascript">
//
document.querySelectorAll("input.btn.cbi-button.cbi-button-up").forEach(function(btn) {
btn.value = "]] .. i18n.translate("Move up") .. [[";
});
document.querySelectorAll("input.btn.cbi-button.cbi-button-down").forEach(function(btn) {
btn.value = "]] .. i18n.translate("Move down") .. [[";
});
//
document.querySelectorAll("div.cbi-value-description").forEach(function(descDiv) {
var prev = descDiv.previousSibling;
while (prev && prev.nodeType === Node.TEXT_NODE && prev.textContent.trim() === "") {
prev = prev.previousSibling;
}
if (prev && prev.nodeType === Node.ELEMENT_NODE && prev.tagName === "BR") {
prev.remove();
}
});
</script>
]])
end

View File

@ -1,15 +0,0 @@
<script type="text/javascript">
//<![CDATA[
//修正上移、下移按钮名称
window.onload = function() {
var ups = document.querySelectorAll("input.btn.cbi-button.cbi-button-up");
var downs = document.querySelectorAll("input.btn.cbi-button.cbi-button-down");
for (var i = 0; i < ups.length; i++) {
ups[i].value = "<%:Move up%>";
}
for (var i = 0; i < downs.length; i++) {
downs[i].value = "<%:Move down%>";
}
}
//]]>
</script>

View File

@ -45,17 +45,5 @@
} }
}, 300); }, 300);
}); });
//修正上移、下移按钮名称
window.onload = function() {
var ups = document.querySelectorAll("input.btn.cbi-button.cbi-button-up");
var downs = document.querySelectorAll("input.btn.cbi-button.cbi-button-down");
for (var i = 0; i < ups.length; i++) {
ups[i].value = "<%:Move up%>";
}
for (var i = 0; i < downs.length; i++) {
downs[i].value = "<%:Move down%>";
}
}
//]]> //]]>
</script> </script>

View File

@ -421,12 +421,6 @@ table td, .table .td {
obj.port = port_dom.value; obj.port = port_dom.value;
} }
//修正上移、下移按钮名称
var up = td.querySelector(".cbi-button-up");
var down = td.querySelector(".cbi-button-down");
if (up) up.value = "<%:Move up%>";
if (down) down.value = "<%:Move down%>";
node_count++; node_count++;
var add_from = document.getElementById("cbid.passwall." + id + ".add_from").value; var add_from = document.getElementById("cbid.passwall." + id + ".add_from").value;
if (node_list[add_from]) if (node_list[add_from])

View File

@ -34,17 +34,5 @@ local api = require "luci.passwall.api"
}); });
return false; return false;
} }
//修正上移、下移按钮名称
window.onload = function() {
var ups = document.querySelectorAll("input.btn.cbi-button.cbi-button-up");
var downs = document.querySelectorAll("input.btn.cbi-button.cbi-button-down");
for (var i = 0; i < ups.length; i++) {
ups[i].value = "<%:Move up%>";
}
for (var i = 0; i < downs.length; i++) {
downs[i].value = "<%:Move down%>";
}
}
//]]> //]]>
</script> </script>

View File

@ -1,15 +0,0 @@
<script type="text/javascript">
//<![CDATA[
//修正上移、下移按钮名称
window.onload = function() {
var ups = document.querySelectorAll("input.btn.cbi-button.cbi-button-up");
var downs = document.querySelectorAll("input.btn.cbi-button.cbi-button-down");
for (var i = 0; i < ups.length; i++) {
ups[i].value = "<%:Move up%>";
}
for (var i = 0; i < downs.length; i++) {
downs[i].value = "<%:Move down%>";
}
}
//]]>
</script>

View File

@ -38,18 +38,6 @@ local geosite_update = api.uci_get_type("@global_rules[0]", "geosite_update", "1
} }
); );
} }
//修正上移、下移按钮名称
window.onload = function() {
var ups = document.querySelectorAll("input.btn.cbi-button.cbi-button-up");
var downs = document.querySelectorAll("input.btn.cbi-button.cbi-button-down");
for (var i = 0; i < ups.length; i++) {
ups[i].value = "<%:Move up%>";
}
for (var i = 0; i < downs.length; i++) {
downs[i].value = "<%:Move down%>";
}
}
//]]> //]]>
</script> </script>
<div class="cbi-value" id="_rule_div"> <div class="cbi-value" id="_rule_div">

View File

@ -29,11 +29,6 @@ local api = require "luci.passwall.api"
//添加"日志"按钮 //添加"日志"按钮
new_div += '<input class="btn cbi-button cbi-button-add" type="button" value="<%:Log%>" onclick="window.open(\'' + '<%=api.url("server_user_log")%>' + '?id=' + id + '\', \'_blank\')"/>&nbsp;&nbsp;'; new_div += '<input class="btn cbi-button cbi-button-add" type="button" value="<%:Log%>" onclick="window.open(\'' + '<%=api.url("server_user_log")%>' + '?id=' + id + '\', \'_blank\')"/>&nbsp;&nbsp;';
td.innerHTML = new_div + td.innerHTML; td.innerHTML = new_div + td.innerHTML;
//修正上移、下移按钮名称
var up = td.querySelector(".cbi-button-up");
var down = td.querySelector(".cbi-button-down");
if (up) up.value = "<%:Move up%>";
if (down) down.value = "<%:Move down%>";
} }
catch(err) { catch(err) {
console.error(err); console.error(err);

View File

@ -465,4 +465,4 @@ if reboot == 1 then
uci:set(name, "@global[0]", "flush_set", "1") uci:set(name, "@global[0]", "flush_set", "1")
api.uci_save(uci, name, true, true) api.uci_save(uci, name, true, true)
end end
log("规则更新完毕...") log("规则更新完毕...\n")

View File

@ -43,20 +43,3 @@ gh-proxy.com
gitmirror.com gitmirror.com
ghfast.top ghfast.top
# Synology ddns
account.synology.com
checkip.dyndns.org
checkip.synology.com
checkipv6.dyndns.org
checkipv6.synology.com
checkport.synology.com
ddns.synology.com
# google
dl.google.com
# github proxy
gh-proxy.com
gitmirror.com
ghfast.top

View File

@ -23,6 +23,7 @@ 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")
local has_ssr = api.is_finded("ssr-local") and api.is_finded("ssr-redir")
local has_trojan_plus = api.is_finded("trojan-plus") local has_trojan_plus = api.is_finded("trojan-plus")
local has_singbox = api.finded_com("sing-box") local has_singbox = api.finded_com("sing-box")
local has_xray = api.finded_com("xray") local has_xray = api.finded_com("xray")
@ -446,6 +447,10 @@ local function processData(szType, content, add_mode, add_from)
} }
--ssr://base64(host:port:protocol:method:obfs:base64pass/?obfsparam=base64param&protoparam=base64param&remarks=base64remarks&group=base64group&udpport=0&uot=0) --ssr://base64(host:port:protocol:method:obfs:base64pass/?obfsparam=base64param&protoparam=base64param&remarks=base64remarks&group=base64group&udpport=0&uot=0)
if szType == 'ssr' then if szType == 'ssr' then
if not has_ssr then
log("跳过 SSR 节点,因未安装 SSR 核心程序 shadowsocksr-libev。")
return nil
end
result.type = "SSR" result.type = "SSR"
local dat = split(content, "/%?") local dat = split(content, "/%?")
@ -472,17 +477,13 @@ local function processData(szType, content, add_mode, add_from)
result.remarks = base64Decode(params.remarks) result.remarks = base64Decode(params.remarks)
elseif szType == 'vmess' then elseif szType == 'vmess' then
local info = jsonParse(content) local info = jsonParse(content)
if has_singbox then
result.type = 'sing-box'
end
if has_xray then
result.type = 'Xray'
end
if vmess_type_default == "sing-box" and has_singbox then if vmess_type_default == "sing-box" and has_singbox then
result.type = 'sing-box' result.type = 'sing-box'
end elseif vmess_type_default == "xray" and has_xray then
if vmess_type_default == "xray" and has_xray then
result.type = "Xray" result.type = "Xray"
else
log("跳过 VMess 节点,因未适配到 VMess 核心程序,或未正确设置节点使用类型。")
return nil
end end
result.alter_id = info.aid result.alter_id = info.aid
result.address = info.add result.address = info.add
@ -590,7 +591,21 @@ local function processData(szType, content, add_mode, add_from)
return nil return nil
end end
elseif szType == "ss" then elseif szType == "ss" then
result.type = "SS" if ss_type_default == "shadowsocks-libev" and has_ss then
result.type = "SS"
elseif ss_type_default == "shadowsocks-rust" and has_ss_rust then
result.type = 'SS-Rust'
elseif ss_type_default == "xray" and has_xray then
result.type = 'Xray'
result.protocol = 'shadowsocks'
result.transport = 'raw'
elseif ss_type_default == "sing-box" and has_singbox then
result.type = 'sing-box'
result.protocol = 'shadowsocks'
else
log("跳过 SS 节点,因未适配到 SS 核心程序,或未正确设置节点使用类型。")
return nil
end
--SS-URI = "ss://" userinfo "@" hostname ":" port [ "/" ] [ "?" plugin ] [ "#" tag ] --SS-URI = "ss://" userinfo "@" hostname ":" port [ "/" ] [ "?" plugin ] [ "#" tag ]
--userinfo = websafe-base64-encode-utf8(method ":" password) --userinfo = websafe-base64-encode-utf8(method ":" password)
@ -678,19 +693,6 @@ local function processData(szType, content, add_mode, add_from)
result.method = method result.method = method
result.password = password result.password = password
if ss_type_default == "shadowsocks-rust" and has_ss_rust then
result.type = 'SS-Rust'
end
if ss_type_default == "xray" and has_xray then
result.type = 'Xray'
result.protocol = 'shadowsocks'
result.transport = 'raw'
end
if ss_type_default == "sing-box" and has_singbox then
result.type = 'sing-box'
result.protocol = 'shadowsocks'
end
if result.type ~= "Xray" then if result.type ~= "Xray" then
result.method = (method:lower() == "chacha20-poly1305" and "chacha20-ietf-poly1305") or result.method = (method:lower() == "chacha20-poly1305" and "chacha20-ietf-poly1305") or
(method:lower() == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or method (method:lower() == "xchacha20-poly1305" and "xchacha20-ietf-poly1305") or method
@ -884,10 +886,15 @@ local function processData(szType, content, add_mode, add_from)
result.type = "Trojan-Plus" result.type = "Trojan-Plus"
elseif trojan_type_default == "sing-box" and has_singbox then elseif trojan_type_default == "sing-box" and has_singbox then
result.type = 'sing-box' result.type = 'sing-box'
result.protocol = 'trojan'
elseif trojan_type_default == "xray" and has_xray then elseif trojan_type_default == "xray" and has_xray then
result.type = 'Xray' result.type = 'Xray'
result.protocol = 'trojan'
else
log("跳过 Trojan 节点,因未适配到 Trojan 核心程序,或未正确设置节点使用类型。")
return nil
end end
result.protocol = 'trojan'
local alias = "" local alias = ""
if content:find("#") then if content:find("#") then
local idx_sp = content:find("#") local idx_sp = content:find("#")
@ -1043,17 +1050,13 @@ local function processData(szType, content, add_mode, add_from)
result.group = content.airport result.group = content.airport
result.remarks = content.remarks result.remarks = content.remarks
elseif szType == "vless" then elseif szType == "vless" then
if has_singbox then
result.type = 'sing-box'
end
if has_xray then
result.type = 'Xray'
end
if vless_type_default == "sing-box" and has_singbox then if vless_type_default == "sing-box" and has_singbox then
result.type = 'sing-box' result.type = 'sing-box'
end elseif vless_type_default == "xray" and has_xray then
if vless_type_default == "xray" and has_xray then
result.type = "Xray" result.type = "Xray"
else
log("跳过 VLESS 节点,因未适配到 VLESS 核心程序,或未正确设置节点使用类型。")
return nil
end end
result.protocol = "vless" result.protocol = "vless"
local alias = "" local alias = ""
@ -1216,6 +1219,14 @@ local function processData(szType, content, add_mode, add_from)
end end
end end
elseif szType == 'hysteria' then elseif szType == 'hysteria' then
if has_singbox then
result.type = 'sing-box'
result.protocol = "hysteria"
else
log("跳过 Hysteria 节点,因未安装 Hysteria 核心程序 Sing-box。")
return nil
end
local alias = "" local alias = ""
if content:find("#") then if content:find("#") then
local idx_sp = content:find("#") local idx_sp = content:find("#")
@ -1263,10 +1274,6 @@ local function processData(szType, content, add_mode, add_from)
result.hysteria_down_mbps = params.downmbps result.hysteria_down_mbps = params.downmbps
result.hysteria_hop = params.mport result.hysteria_hop = params.mport
if has_singbox then
result.type = 'sing-box'
result.protocol = "hysteria"
end
elseif szType == 'hysteria2' or szType == 'hy2' then elseif szType == 'hysteria2' or szType == 'hy2' then
local alias = "" local alias = ""
if content:find("#") then if content:find("#") then
@ -1326,8 +1333,19 @@ local function processData(szType, content, add_mode, add_from)
if params["obfs-password"] or params["obfs_password"] then if params["obfs-password"] or params["obfs_password"] then
result.hysteria2_obfs = params["obfs-password"] or params["obfs_password"] result.hysteria2_obfs = params["obfs-password"] or params["obfs_password"]
end end
else
log("跳过 Hysteria2 节点,因未适配到 Hysteria2 核心程序,或未正确设置节点使用类型。")
return nil
end end
elseif szType == 'tuic' then elseif szType == 'tuic' then
if has_singbox then
result.type = 'sing-box'
result.protocol = "tuic"
else
log("跳过 Tuic 节点,因未安装 Tuic 核心程序 Sing-box。")
return nil
end
local alias = "" local alias = ""
if content:find("#") then if content:find("#") then
local idx_sp = content:find("#") local idx_sp = content:find("#")
@ -1380,11 +1398,15 @@ local function processData(szType, content, add_mode, add_from)
else else
result.tls_allowInsecure = allowInsecure_default and "1" or "0" result.tls_allowInsecure = allowInsecure_default and "1" or "0"
end end
result.type = 'sing-box'
result.protocol = "tuic"
elseif szType == "anytls" then elseif szType == "anytls" then
result.type = 'sing-box' if has_singbox then
result.protocol = "anytls" result.type = 'sing-box'
result.protocol = "anytls"
else
log("跳过 AnyTLS 节点,因未安装 AnyTLS 核心程序 Sing-box 1.12。")
return nil
end
local alias = "" local alias = ""
if content:find("#") then if content:find("#") then
local idx_sp = content:find("#") local idx_sp = content:find("#")
@ -1812,7 +1834,7 @@ local execute = function()
do do
local subscribe_list = {} local subscribe_list = {}
local fail_list = {} local fail_list = {}
if arg[2] then if arg[2] ~= "all" then
string.gsub(arg[2], '[^' .. "," .. ']+', function(w) string.gsub(arg[2], '[^' .. "," .. ']+', function(w)
subscribe_list[#subscribe_list + 1] = uci:get_all(appname, w) or {} subscribe_list[#subscribe_list + 1] = uci:get_all(appname, w) or {}
end) end)
@ -1822,6 +1844,8 @@ local execute = function()
end) end)
end end
local manual_sub = arg[3] == "manual"
for index, value in ipairs(subscribe_list) do for index, value in ipairs(subscribe_list) do
local cfgid = value[".name"] local cfgid = value[".name"]
local remark = value.remark local remark = value.remark
@ -1890,7 +1914,7 @@ local execute = function()
local old_md5 = value.md5 or "" local old_md5 = value.md5 or ""
local new_md5 = luci.sys.exec("md5sum " .. tmp_file .. " 2>/dev/null | awk '{print $1}'"):gsub("\n", "") local new_md5 = luci.sys.exec("md5sum " .. tmp_file .. " 2>/dev/null | awk '{print $1}'"):gsub("\n", "")
os.remove(tmp_file) os.remove(tmp_file)
if old_md5 == new_md5 then if not manual_sub and old_md5 == new_md5 then
log('订阅:【' .. remark .. '】没有变化,无需更新。') log('订阅:【' .. remark .. '】没有变化,无需更新。')
else else
parse_link(raw_data, "2", remark, cfgid) parse_link(raw_data, "2", remark, cfgid)
@ -1930,7 +1954,7 @@ if arg[1] then
end end
log('发生错误, 正在恢复服务') log('发生错误, 正在恢复服务')
end) end)
log('订阅完毕...') log('订阅完毕...\n')
elseif arg[1] == "add" then elseif arg[1] == "add" then
local f = assert(io.open("/tmp/links.conf", 'r')) local f = assert(io.open("/tmp/links.conf", 'r'))
local raw = f:read('*all') local raw = f:read('*all')