mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-01 16:44:45 +08:00
update 2026-10-15 16:45:49
This commit is contained in:
1 parent
ebedf5b446
commit
eaef2c6d95
6 files changed
+48
-64
No files matched your search
@@ -472,6 +472,7 @@ diagnose() {
|
||||
check_network >/dev/null 2>&1 || errors="$errors lan_network_unavailable"
|
||||
network_settings >/dev/null 2>&1 || errors="$errors lan_ipv4_unavailable"
|
||||
check_kernel >/dev/null 2>&1 || errors="$errors kernel_requirements_unmet"
|
||||
command -v curl >/dev/null 2>&1 || errors="$errors curl_missing"
|
||||
if [ "$running" != 1 ]; then
|
||||
no_honk_resources >/dev/null 2>&1 || errors="$errors honk_resources_occupied"
|
||||
pidof honk-core >/dev/null 2>&1 && errors="$errors unmanaged_core_running"
|
||||
@@ -669,6 +670,7 @@ initialize_preflight() {
|
||||
read_credentials || { echo '{"ok":false,"message":"invalid_credentials"}'; return 1; }
|
||||
fi
|
||||
[ -x "$HONK_CORE" ] || { echo '{"ok":false,"message":"core_missing"}'; return 1; }
|
||||
command -v curl >/dev/null 2>&1 || { echo '{"ok":false,"message":"curl_missing"}'; return 1; }
|
||||
pidof honk-core >/dev/null 2>&1 && { echo '{"ok":false,"message":"core_already_running"}'; return 1; }
|
||||
no_honk_resources || { echo '{"ok":false,"message":"honk_resources_already_exist"}'; return 1; }
|
||||
check_port || { echo '{"ok":false,"message":"listen_port_occupied"}'; return 1; }
|
||||
|
||||
@@ -22,7 +22,7 @@ PKG_NAME:=luci-app-amlogic
|
||||
# DD = day (01 = 1st)
|
||||
# NN = daily release sequence (01 = first release of the day, 02 = second, ...)
|
||||
# Example below: 26.10.0101 = October 1, 2026, 1st release of the day
|
||||
PKG_VERSION:=26.10.0301
|
||||
PKG_VERSION:=26.10.1501
|
||||
# PKG_RELEASE marks the LuCI variant; onekey-install.sh relies on it (do NOT bump)
|
||||
# 1 = Lua version (lua branch) → tag: 26.10.0101
|
||||
# 2 = JS version (main branch) → tag: 26.10.0101-js
|
||||
|
||||
@@ -181,25 +181,40 @@ check_updated() {
|
||||
https://github.com/${server_firmware_url}/releases/expanded_assets/${firmware_releases_tag}
|
||||
)"
|
||||
|
||||
# Set the regular expression for the OpenWrt filename
|
||||
op_file_pattern=".*_${BOARD}_.*k${main_line_version}\.[0-9]+.*${firmware_suffix}"
|
||||
# Find the <li> list item where the OpenWrt file is located
|
||||
li_block=$(awk -v pattern="${op_file_pattern}" -v RS='</li>' '$0 ~ pattern { print $0 "</li>"; exit }' <<<"${html_code}")
|
||||
[[ -z "${li_block}" ]] && tolog "02.03.01 No matching download links found." "1"
|
||||
# Find the <li> list items where the OpenWrt file is located.
|
||||
asset_records="$(awk -v board="${BOARD}" -v kver="${main_line_version}" -v suffix="${firmware_suffix}" -v RS='</li>' '
|
||||
BEGIN {
|
||||
href_pattern = "/releases/download/[^\"]*_" board "_[^\"]*k" kver "\\.[0-9]+[^\"]*" suffix
|
||||
block_pattern = ".*_" board "_.*k" kver "\\.[0-9]+.*" suffix
|
||||
}
|
||||
$0 ~ block_pattern {
|
||||
file_name = ""; file_date = ""; file_sha256 = ""
|
||||
if (match($0, href_pattern)) {
|
||||
file_path = substr($0, RSTART, RLENGTH)
|
||||
file_name = file_path; sub(/.*\//, "", file_name)
|
||||
}
|
||||
if (match($0, /datetime="[^"]*"/)) { file_date = substr($0, RSTART + 10, RLENGTH - 11) }
|
||||
if (match($0, /value="sha256:[^"]*/)) { file_sha256 = substr($0, RSTART + 14, RLENGTH - 14) }
|
||||
if (file_name != "") { printf "%s\t%s\t%s\n", file_date, file_name, file_sha256 }
|
||||
}' <<<"${html_code}")"
|
||||
[[ -z "${asset_records}" ]] && tolog "02.03.01 No matching download links found." "1"
|
||||
|
||||
# Select the OpenWrt file with the newest upload date.
|
||||
latest_record="$(echo "${asset_records}" | sort -t$'\t' -k1,1 | tail -n 1)"
|
||||
|
||||
# Find the OpenWrt filename
|
||||
latest_url=$(echo "${li_block}" | grep -oE "/[^\"]*_${BOARD}_.*k${main_line_version}\.[0-9]+[^\"]*${firmware_suffix}" | sort -urV | head -n 1 | xargs basename 2>/dev/null)
|
||||
latest_url="$(echo "${latest_record}" | cut -f2)"
|
||||
tolog "02.03.02 OpenWrt file: ${latest_url}"
|
||||
|
||||
# Find the date of the latest update
|
||||
latest_updated_at=$(echo "${li_block}" | grep -o 'datetime="[^"]*"' | sed 's/datetime="//; s/"//')
|
||||
latest_updated_at="$(echo "${latest_record}" | cut -f1)"
|
||||
tolog "02.03.03 Latest updated at: ${latest_updated_at}"
|
||||
# Format the date for display
|
||||
date_display_format="$(echo ${latest_updated_at} | tr 'T' '(' | tr 'Z' ')')"
|
||||
[[ -z "${latest_url}" || -z "${latest_updated_at}" ]] && tolog "02.03.04 The download URL or date is invalid." "1"
|
||||
|
||||
# Find the firmware sha256 value
|
||||
latest_firmware_sha256="$(echo "${li_block}" | grep -o 'value="sha256:[^"]*' | sed 's/value="sha256://')"
|
||||
latest_firmware_sha256="$(echo "${latest_record}" | cut -f3)"
|
||||
tolog "02.03.05 OpenWrt sha256: ${latest_firmware_sha256}"
|
||||
|
||||
# Check the firmware update code
|
||||
|
||||
@@ -189,6 +189,7 @@ function tokenMessage(token) {
|
||||
dae_upload_changed: _('The uploaded dae file changed. Upload it again.'),
|
||||
upload_unavailable: _('A private upload location could not be prepared.'),
|
||||
settings_write_failed: _('Could not save Honk settings.'),
|
||||
curl_missing: _('The curl command is missing. Install the curl package and try again.'),
|
||||
start_failed: _('Honk could not start.'),
|
||||
stop_failed: _('Honk could not stop.'),
|
||||
restart_failed: _('Honk could not restart.'),
|
||||
|
||||
@@ -33,6 +33,9 @@ msgstr "无法读取 Honk 状态。"
|
||||
msgid "Could not save Honk settings."
|
||||
msgstr "无法保存 Honk 设置。"
|
||||
|
||||
msgid "The curl command is missing. Install the curl package and try again."
|
||||
msgstr "缺少 curl 命令,请先安装 curl 包(apk add curl 或 opkg install curl)后重试。"
|
||||
|
||||
msgid "Save failed. Check the settings and system status."
|
||||
msgstr "保存失败,请检查设置和系统状态。"
|
||||
|
||||
|
||||
@@ -133,7 +133,6 @@ if data_dir ~= SMARTDNS_DATA_PATH then
|
||||
end
|
||||
|
||||
local LOCAL_SERVERS = {}
|
||||
local SERVER_TYPES = {udp = "server", tcp = "server-tcp"}
|
||||
for endpoint in string.gmatch(LOCAL_DNS or "", "[^,]+") do
|
||||
endpoint = api.trim(endpoint)
|
||||
local protocol, address = endpoint:match("^(%w+)://(.+)$")
|
||||
@@ -146,8 +145,8 @@ for endpoint in string.gmatch(LOCAL_DNS or "", "[^,]+") do
|
||||
elseif datatypes.ip6addr(address) and not address:find("[", 1, true) then
|
||||
address = "[" .. address .. "]"
|
||||
end
|
||||
if SERVER_TYPES[protocol] and address ~= "" then
|
||||
table.insert(LOCAL_SERVERS, SERVER_TYPES[protocol] .. " " .. address)
|
||||
if (protocol == "udp" or protocol == "tcp") and address ~= "" then
|
||||
table.insert(LOCAL_SERVERS, "server " .. (protocol == "tcp" and "tcp://" or "") .. address)
|
||||
end
|
||||
end
|
||||
if #LOCAL_SERVERS == 0 then
|
||||
@@ -160,6 +159,8 @@ if REMOTE_DNS then
|
||||
end
|
||||
local AUTO_GROUP = "auto"
|
||||
local auto_config_lines = {}
|
||||
-- 直连规则显式覆盖远程兜底的缓存、IPv6、测速和双栈优选设置。
|
||||
local DIRECT_RULE_OPTIONS = " -enable-cache -address -6 -speed-check-mode ping,tcp:80,tcp:443 -response-mode first-ping -d yes"
|
||||
--设置默认 DNS 分组(兜底组),全局代理模式仍使用远程组。
|
||||
local DEFAULT_DNS_GROUP = (USE_DEFAULT_DNS == "direct" and "direct") or
|
||||
(USE_DEFAULT_DNS == "remote" and "proxy") or
|
||||
@@ -240,48 +241,12 @@ end
|
||||
|
||||
if DNS_MODE == "socks" then
|
||||
for w in string.gmatch(REMOTE_DNS, '[^|]+') do
|
||||
local server_dns = api.trim(w)
|
||||
local server_param
|
||||
|
||||
local dnsType = string.match(server_dns, "^(.-)://")
|
||||
dnsType = dnsType and string.lower(dnsType) or nil
|
||||
local dnsServer = string.match(server_dns, "://(.+)") or server_dns
|
||||
|
||||
if dnsType and dnsType ~= "" and dnsType ~= "udp" then
|
||||
if dnsType == "tcp" then
|
||||
server_param = "server-tcp " .. dnsServer
|
||||
elseif dnsType == "tls" then
|
||||
server_param = "server-tls " .. dnsServer
|
||||
elseif dnsType == "quic" then
|
||||
server_param = "server-quic " .. dnsServer
|
||||
elseif dnsType == "https" or dnsType == "h3" then
|
||||
local http_host = nil
|
||||
local url = w
|
||||
local port = 443
|
||||
local s = api.split(w, ",")
|
||||
if s and #s > 1 then
|
||||
url = s[1]
|
||||
local dns_ip = s[2]
|
||||
local host_port = api.get_domain_from_url(s[1])
|
||||
if host_port and #host_port > 0 then
|
||||
http_host = host_port
|
||||
local s2 = api.split(host_port, ":")
|
||||
if s2 and #s2 > 1 then
|
||||
http_host = s2[1]
|
||||
port = s2[2]
|
||||
end
|
||||
url = url:gsub(http_host, dns_ip)
|
||||
end
|
||||
end
|
||||
server_dns = url
|
||||
if http_host then
|
||||
server_dns = server_dns .. " -http-host " .. http_host
|
||||
end
|
||||
server_param = (dnsType == "https" and "server-https " or "server-h3 ") .. server_dns
|
||||
end
|
||||
else
|
||||
server_param = "server " .. dnsServer
|
||||
|
||||
-- 协议和默认端口由 SmartDNS 根据原始 URL 识别。
|
||||
local dns = api.split(api.trim(w), ",")
|
||||
local server_param = "server " .. api.trim(dns[1])
|
||||
if dns[2] and dns[2] ~= "" then
|
||||
-- 保留 URL 中的域名,固定连接 IP 交给 SmartDNS 处理,避免手动替换影响 SNI 和 HTTP Host。
|
||||
server_param = server_param .. " -host-ip " .. api.trim(dns[2]):gsub("^%[(.*)%]$", "%1")
|
||||
end
|
||||
|
||||
if not api.is_local_ip(w) then
|
||||
@@ -326,7 +291,8 @@ table.insert(config_lines, force_qtype_soa)
|
||||
if DEFAULT_DNS_GROUP then
|
||||
local domain_rules_str = "domain-rules /./ -nameserver " .. DEFAULT_DNS_GROUP
|
||||
if DEFAULT_DNS_GROUP == "proxy" then
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no -no-serve-expired"
|
||||
-- 代理仍禁止写入缓存,去掉会被直连继承且无法反向覆盖的过期缓存限制。
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no"
|
||||
domain_rules_str = domain_rules_str .. " -address " .. ((only_global and IS_SHUNT_NODE) and "-6" or (NO_PROXY_IPV6 == "1" and "#6" or "-6"))
|
||||
end
|
||||
table.insert(config_lines, domain_rules_str)
|
||||
@@ -430,7 +396,7 @@ if is_file_nonzero(file_vpslist) then
|
||||
"#4:" .. setflag .. "psw_vps",
|
||||
"#6:" .. setflag .. "psw_vps6"
|
||||
}
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver direct', domain_set_name)
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver direct', domain_set_name) .. DIRECT_RULE_OPTIONS
|
||||
domain_rules_str = domain_rules_str .. " " .. set_type .. " " .. table.concat(sets, ",")
|
||||
table.insert(tmp_lines, domain_rules_str)
|
||||
insert_array_after(config_lines, tmp_lines, "#--9")
|
||||
@@ -495,7 +461,7 @@ if USE_DIRECT_LIST == "1" and is_file_nonzero(file_direct_host) then
|
||||
"#4:" .. setflag .. "psw_white",
|
||||
"#6:" .. setflag .. "psw_white6"
|
||||
}
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver direct', domain_set_name)
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver direct', domain_set_name) .. DIRECT_RULE_OPTIONS
|
||||
domain_rules_str = domain_rules_str .. " " .. set_type .. " " .. table.concat(sets, ",")
|
||||
table.insert(tmp_lines, domain_rules_str)
|
||||
insert_array_after(config_lines, tmp_lines, "#--7")
|
||||
@@ -558,7 +524,6 @@ if USE_PROXY_LIST == "1" and is_file_nonzero(file_proxy_host) then
|
||||
}
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver proxy', domain_set_name)
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no"
|
||||
domain_rules_str = domain_rules_str .. " -no-serve-expired"
|
||||
local sets = {
|
||||
"#4:" .. setflag .. "psw_black"
|
||||
}
|
||||
@@ -581,7 +546,6 @@ if USE_GFW_LIST == "1" and is_file_nonzero(RULES_PATH .. "/gfwlist") then
|
||||
}
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver proxy', domain_set_name)
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no"
|
||||
domain_rules_str = domain_rules_str .. " -no-serve-expired"
|
||||
local sets = {
|
||||
"#4:" .. setflag .. "psw_gfw"
|
||||
}
|
||||
@@ -608,7 +572,7 @@ if CHN_LIST ~= "0" and is_file_nonzero(RULES_PATH .. "/chnlist") then
|
||||
"#4:" .. setflag .. "psw_chn",
|
||||
"#6:" .. setflag .. "psw_chn6"
|
||||
}
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver direct', domain_set_name)
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver direct', domain_set_name) .. DIRECT_RULE_OPTIONS
|
||||
domain_rules_str = domain_rules_str .. " " .. set_type .. " " .. table.concat(sets, ",")
|
||||
table.insert(tmp_lines, domain_rules_str)
|
||||
insert_array_after(config_lines, tmp_lines, "#--4")
|
||||
@@ -619,7 +583,6 @@ if CHN_LIST ~= "0" and is_file_nonzero(RULES_PATH .. "/chnlist") then
|
||||
if CHN_LIST == "proxy" then
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver proxy', domain_set_name)
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no"
|
||||
domain_rules_str = domain_rules_str .. " -no-serve-expired"
|
||||
local sets = {
|
||||
"#4:" .. setflag .. "psw_chn"
|
||||
}
|
||||
@@ -768,7 +731,7 @@ if IS_SHUNT_NODE and not only_global then
|
||||
string.format("domain-set -name %s -file %s", domain_set_name, shunt_direct_host)
|
||||
}
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver proxy', domain_set_name)
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no -no-serve-expired"
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no"
|
||||
local sets = {
|
||||
"#4:" .. setflag .. "psw_shunt",
|
||||
"#6:" .. setflag .. "psw_shunt6"
|
||||
@@ -784,7 +747,7 @@ if IS_SHUNT_NODE and not only_global then
|
||||
string.format("domain-set -name %s -file %s", domain_set_name, shunt_proxy_host)
|
||||
}
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver proxy', domain_set_name)
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no -no-serve-expired"
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no"
|
||||
local sets = {
|
||||
"#4:" .. setflag .. "psw_shunt",
|
||||
"#6:" .. setflag .. "psw_shunt6"
|
||||
@@ -800,7 +763,7 @@ if IS_SHUNT_NODE and not only_global then
|
||||
string.format("domain-set -name %s -file %s", domain_set_name, shunt_black_host)
|
||||
}
|
||||
local domain_rules_str = string.format('domain-rules /domain-set:%s/ -nameserver proxy', domain_set_name)
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no -no-serve-expired"
|
||||
domain_rules_str = domain_rules_str .. " -no-cache -speed-check-mode none -d no"
|
||||
local sets = {
|
||||
"#4:" .. setflag .. "psw_shunt",
|
||||
"#6:" .. setflag .. "psw_shunt6"
|
||||
|
||||
Reference in new issue
Block a user