From 9028e829a13f675982f5ad8617f99e1fffb89c30 Mon Sep 17 00:00:00 2001 From: action Date: Sun, 23 Aug 2026 00:16:41 +0800 Subject: [PATCH] update 2026-08-23 00:16:41 --- internet-detector-mod-email/Makefile | 2 +- internet-detector-mod-modem-restart/Makefile | 2 +- internet-detector-mod-telegram/Makefile | 2 +- internet-detector/Makefile | 2 +- .../usr/lib/lua/internet-detector/main.lua | 61 +++++++----- .../modules/mod_public_ip.lua | 2 +- luci-app-internet-detector/Makefile | 2 +- luci-app-mosdns/Makefile | 2 +- .../resources/view/mosdns/basic.js | 24 +++++ luci-app-mosdns/po/templates/mosdns.pot | 96 +++++++++++++------ luci-app-mosdns/po/zh_Hans/mosdns.po | 96 +++++++++++++------ luci-app-mosdns/root/etc/init.d/mosdns | 10 ++ luci-app-syncthing/Makefile | 22 +++++ luci-app-syncthing/README.md | 2 + .../luasrc/controller/syncthing.lua | 17 ++++ .../luasrc/model/cbi/syncthing.lua | 48 ++++++++++ .../view/syncthing/syncthing_status.htm | 27 ++++++ .../root/etc/uci-defaults/luci-syncthing | 12 +++ .../share/rpcd/acl.d/luci-app-syncthing.json | 11 +++ 19 files changed, 349 insertions(+), 91 deletions(-) create mode 100644 luci-app-syncthing/Makefile create mode 100644 luci-app-syncthing/README.md create mode 100644 luci-app-syncthing/luasrc/controller/syncthing.lua create mode 100644 luci-app-syncthing/luasrc/model/cbi/syncthing.lua create mode 100644 luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm create mode 100644 luci-app-syncthing/root/etc/uci-defaults/luci-syncthing create mode 100644 luci-app-syncthing/root/usr/share/rpcd/acl.d/luci-app-syncthing.json diff --git a/internet-detector-mod-email/Makefile b/internet-detector-mod-email/Makefile index a904f9fc..6fe9b53e 100644 --- a/internet-detector-mod-email/Makefile +++ b/internet-detector-mod-email/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector-mod-email -PKG_VERSION:=1.7.3 +PKG_VERSION:=1.7.4 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/internet-detector-mod-modem-restart/Makefile b/internet-detector-mod-modem-restart/Makefile index af76c45e..1ad71540 100644 --- a/internet-detector-mod-modem-restart/Makefile +++ b/internet-detector-mod-modem-restart/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector-mod-modem-restart -PKG_VERSION:=1.7.3 +PKG_VERSION:=1.7.4 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/internet-detector-mod-telegram/Makefile b/internet-detector-mod-telegram/Makefile index 89cb020c..3d04cf5c 100644 --- a/internet-detector-mod-telegram/Makefile +++ b/internet-detector-mod-telegram/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector-mod-telegram -PKG_VERSION:=1.7.3 +PKG_VERSION:=1.7.4 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/internet-detector/Makefile b/internet-detector/Makefile index 19da95a7..70f96703 100644 --- a/internet-detector/Makefile +++ b/internet-detector/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector -PKG_VERSION:=1.7.3 +PKG_VERSION:=1.7.4 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/internet-detector/files/usr/lib/lua/internet-detector/main.lua b/internet-detector/files/usr/lib/lua/internet-detector/main.lua index d4c90cb1..6ff4c7f9 100644 --- a/internet-detector/files/usr/lib/lua/internet-detector/main.lua +++ b/internet-detector/files/usr/lib/lua/internet-detector/main.lua @@ -12,8 +12,8 @@ local uci = require("uci") -- Default settings local InternetDetector = { - appName = "internet-detector", - libDir = "/usr/lib/lua", + appName = "internet-detector", + libDir = "/usr/lib/lua", logLevels = { emerg = { level = syslog.LOG_EMERG, num = 0 }, alert = { level = syslog.LOG_ALERT, num = 1 }, @@ -24,18 +24,32 @@ local InternetDetector = { info = { level = syslog.LOG_INFO, num = 6 }, debug = { level = syslog.LOG_DEBUG, num = 7 }, }, - pingCmd = "/bin/ping", - pingParams = "-c 1", - curlExec = "/usr/bin/curl", - curlParams = '-s -g --no-keepalive --head --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0"', - mode = 0, -- 0: disabled, 1: Service, 2: UI detector - loggingLevel = 6, - hostname = "OpenWrt", - uiRunTime = 30, - noModules = false, - uiAvailModules = { mod_public_ip = true }, - debug = false, - serviceConfig = { + pingCmd = "/bin/ping", + pingParams = "-c 1", + curlExec = "/usr/bin/curl", + curlParams = '-s -g --no-keepalive --head --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:153.0) Gecko/20100101 Firefox/153.0"', + curlHttpOkCodes = { + [200] = true, + [202] = true, + [203] = true, + [204] = true, + [206] = true, + [300] = true, + [301] = true, + [302] = true, + [303] = true, + [304] = true, + [307] = true, + [308] = true, + }, + mode = 0, -- 0: disabled, 1: Service, 2: UI detector + loggingLevel = 6, + hostname = "OpenWrt", + uiRunTime = 30, + noModules = false, + uiAvailModules = { mod_public_ip = true }, + debug = false, + serviceConfig = { hosts = { [1] = "8.8.8.8", [2] = "1.1.1.1", @@ -43,7 +57,7 @@ local InternetDetector = { urls = { [1] = "https://www.google.com", }, - check_type = 0, -- 0: TCP, 1: ICMP + check_type = 0, -- 0: TCP, 1: ICMP, 2: URL test tcp_port = 53, icmp_packet_size = 56, interval_up = 30, @@ -58,13 +72,13 @@ local InternetDetector = { iface = nil, instance = nil, }, - modules = {}, - parsedHosts = {}, - proxyAuthString = "", - proxyString = "", - uiCounter = 0, - pidFile = nil, - statusFile = nil, + modules = {}, + parsedHosts = {}, + proxyAuthString = "", + proxyString = "", + uiCounter = 0, + pidFile = nil, + statusFile = nil, } InternetDetector.configDir = string.format("/etc/%s", InternetDetector.appName) InternetDetector.modulesDir = string.format( @@ -280,7 +294,6 @@ function InternetDetector:TCPConnectionToHost(host, port) if not ok then self:debugOutput(string.format( "SOCKET ERROR: %s, %s", errMsg, errNum)) - unistd.close(sock) return retCode end @@ -380,7 +393,7 @@ function InternetDetector:checkURL(url) if retCode == 0 and data then httpCode = self:getHTTPCode(data) end - return (httpCode ~= 200) and 1 or 0 + return (not self.curlHttpOkCodes[httpCode]) and 1 or 0 end function InternetDetector:exit() diff --git a/internet-detector/files/usr/lib/lua/internet-detector/modules/mod_public_ip.lua b/internet-detector/files/usr/lib/lua/internet-detector/modules/mod_public_ip.lua index 1affda95..10e0415c 100644 --- a/internet-detector/files/usr/lib/lua/internet-detector/modules/mod_public_ip.lua +++ b/internet-detector/files/usr/lib/lua/internet-detector/modules/mod_public_ip.lua @@ -27,7 +27,7 @@ local Module = { requestAttempts = 2, timeout = 3, curlExec = "/usr/bin/curl", - curlParams = '-s -g --no-keepalive --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0"', + curlParams = '-s -g --no-keepalive --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:153.0) Gecko/20100101 Firefox/153.0"', providers = { opendns1 = { name = "opendns1", type = "dns", host = "myip.opendns.com", diff --git a/luci-app-internet-detector/Makefile b/luci-app-internet-detector/Makefile index 411cedc2..1538fc44 100644 --- a/luci-app-internet-detector/Makefile +++ b/luci-app-internet-detector/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-internet-detector -PKG_VERSION:=1.7.3 +PKG_VERSION:=1.7.4 PKG_RELEASE:=1 LUCI_TITLE:=LuCI support for internet-detector LUCI_DEPENDS:=+internet-detector diff --git a/luci-app-mosdns/Makefile b/luci-app-mosdns/Makefile index 3e4b0c3c..82858e60 100644 --- a/luci-app-mosdns/Makefile +++ b/luci-app-mosdns/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-mosdns -PKG_VERSION:=1.7.6 +PKG_VERSION:=1.7.7 PKG_RELEASE:=1 LUCI_TITLE:=LuCI Support for mosdns diff --git a/luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js b/luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js index 8d9adc02..b09eafc2 100644 --- a/luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js +++ b/luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js @@ -320,6 +320,30 @@ return view.extend({ o.default = 86400; o.depends('cache', '1'); + o = s.taboption('advanced', form.Flag, 'prefetch', _('Cache Prefetching'), + _('Proactively refresh hot cache entries in the background before they expire.')); + o.rmempty = false; + o.default = false; + o.depends('cache', '1'); + + o = s.taboption('advanced', form.Value, 'prefetch_before_expire', _('Prefetch Before Expire'), + _('Prefetch when the remaining TTL is less than this value (in seconds).')); + o.datatype = 'and(uinteger,min(1))'; + o.default = 10; + o.depends('prefetch', '1'); + + o = s.taboption('advanced', form.Value, 'prefetch_min_hits', _('Prefetch Min Hits'), + _('Minimum cache hits required since the last refresh to trigger a prefetch.')); + o.datatype = 'and(uinteger,min(1))'; + o.default = 3; + o.depends('prefetch', '1'); + + o = s.taboption('advanced', form.Value, 'prefetch_scan_interval', _('Prefetch Scan Interval'), + _('Interval for the background thread to scan the cache for prefetching (in seconds).')); + o.datatype = 'and(uinteger,min(1))'; + o.default = 5; + o.depends('prefetch', '1'); + o = s.taboption('advanced', form.Flag, 'dump_file', _('Cache Dump'), _('Save the cache locally and reload the cache dump on the next startup')); o.rmempty = false; diff --git a/luci-app-mosdns/po/templates/mosdns.pot b/luci-app-mosdns/po/templates/mosdns.pot index aa79b681..ca471c20 100644 --- a/luci-app-mosdns/po/templates/mosdns.pot +++ b/luci-app-mosdns/po/templates/mosdns.pot @@ -5,11 +5,11 @@ msgstr "Content-Type: text/plain; charset=UTF-8" msgid "360 Public DNS (DNS over HTTPS)" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:356 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:380 msgid "ADblock Source" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:395 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:419 msgid "API Listen port" msgstr "" @@ -82,7 +82,7 @@ msgstr "" msgid "Apple domains optimization" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:330 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:354 msgid "Auto Save Cache Interval" msgstr "" @@ -105,7 +105,7 @@ msgstr "" msgid "Basic Setting" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:348 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:372 msgid "" "Block DNS RR Type 65 records (HTTPS/SVCB, used for HTTP/3, ECH, etc.), force " "using only A/AAAA records." @@ -129,10 +129,14 @@ msgid "" "resolvers you specify as upstreams" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:323 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:347 msgid "Cache Dump" msgstr "" +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:323 +msgid "Cache Prefetching" +msgstr "" + #: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/update.js:150 msgid "Check And Update" msgstr "" @@ -178,7 +182,7 @@ msgstr "" msgid "CloudFlare Public DNS (1.1.1.1)" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:380 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:404 msgid "Cloudflare IP Ranges" msgstr "" @@ -198,7 +202,7 @@ msgstr "" msgid "Config File" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:426 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:450 msgid "Configuration Editor" msgstr "" @@ -216,7 +220,7 @@ msgid "" "supports domain matching rules)." msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:375 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:399 msgid "Custom IP" msgstr "" @@ -258,7 +262,7 @@ msgstr "" msgid "Default Config" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:347 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:371 msgid "Disable RR Type 65 (HTTPS/SVCB)" msgstr "" @@ -280,7 +284,7 @@ msgstr "" msgid "Enable Auto Database Update" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:352 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:376 msgid "Enable DNS ADblock" msgstr "" @@ -302,15 +306,15 @@ msgid "Enable this option fallback policy forces forwarding to remote DNS" msgstr "" #: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:142 -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:368 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:392 msgid "Enabled" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:453 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:477 msgid "Enter the GeoIP.dat category to be exported, Allow add multiple tags" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:448 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:472 msgid "Enter the GeoSite.dat category to be exported, Allow add multiple tags" msgstr "" @@ -350,8 +354,8 @@ msgstr "" msgid "Every Wednesday" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:449 -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:454 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:473 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:478 msgid "Export directory: /var/mosdns" msgstr "" @@ -363,7 +367,7 @@ msgstr "" msgid "Failed to start update." msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:403 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:427 msgid "Flush DNS Cache" msgstr "" @@ -375,7 +379,7 @@ msgstr "" msgid "Flushing DNS Cache Success." msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:401 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:425 msgid "" "Flushing DNS Cache will clear any IP addresses or DNS records from MosDNS " "cache." @@ -411,7 +415,7 @@ msgstr "" msgid "GeoData Export" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:452 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:476 msgid "GeoIP Tags" msgstr "" @@ -419,7 +423,7 @@ msgstr "" msgid "GeoIP Type" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:447 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:471 msgid "GeoSite Tags" msgstr "" @@ -458,7 +462,7 @@ msgstr "" msgid "IP Address" msgstr "" -#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:381 +#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:405 msgid "" "IPv4 CIDR: https://www.cloudflare.com/ips-v4
IPv6 CIDR: https://www.cloudflare.com/ips-v4
IPv6 CIDR: /dev/null") == 0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/luci-app-syncthing/luasrc/model/cbi/syncthing.lua b/luci-app-syncthing/luasrc/model/cbi/syncthing.lua new file mode 100644 index 00000000..324ea054 --- /dev/null +++ b/luci-app-syncthing/luasrc/model/cbi/syncthing.lua @@ -0,0 +1,48 @@ +require("nixio.fs") + +m = Map("syncthing", translate("Syncthing同步工具")) + +m:section(SimpleSection).template = "syncthing/syncthing_status" + +s = m:section(TypedSection, "syncthing") + +s.anonymous = true + +o = s:option(Flag, "enabled", translate("启用")) +o.default = 0 +o.rmempty = false + +gui_address = s:option(Value, "gui_address", translate("GUI访问地址")) +gui_address.description = translate("使用0.0.0.0以监控所有访问。") +gui_address.default = "http://0.0.0.0:8384" +gui_address.placeholder = "http://0.0.0.0:8384" +gui_address.rmempty = false + +home = s:option(Value, "home", translate("配置文件目录")) +home.description = translate("只有保存在/etc/syncthing中的配置会自动备份!") +home.default = "/etc/syncthing" +home.placeholder = "/etc/syncthing" +home.rmempty = false + +user = s:option(ListValue, "user", translate("用户")) +user.description = translate("默认是syncthing,但这可能会导致权限被拒绝。Syncthing官方不建议以root身份运行。") +user:value("", translate("syncthing")) +for u in luci.util.execi("cat /etc/passwd | cut -d ':' -f1") do + user:value(u) +end + +macprocs = s:option(Value, "macprocs", translate("线程限制")) +macprocs.description = translate("0表示匹配CPU数量(默认),>0表示显式指定并发数。") +macprocs.default = "0" +macprocs.placeholder = "0" +macprocs.datatype = "range(0,32)" +macprocs.rmempty = false + +nice = s:option(Value, "nice", translate("优先级")) +nice.description = translate("显式指定优先级值。0是最高,19是最低。(暂时不允许设置负值)") +nice.default = "19" +nice.placeholder = "19" +nice.datatype = "range(0,19)" +nice.rmempty = false + +return m diff --git a/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm b/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm new file mode 100644 index 00000000..566cc020 --- /dev/null +++ b/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm @@ -0,0 +1,27 @@ + + +
+

+ <%:正在收集数据...%> +

+
diff --git a/luci-app-syncthing/root/etc/uci-defaults/luci-syncthing b/luci-app-syncthing/root/etc/uci-defaults/luci-syncthing new file mode 100644 index 00000000..3adb7997 --- /dev/null +++ b/luci-app-syncthing/root/etc/uci-defaults/luci-syncthing @@ -0,0 +1,12 @@ +#!/bin/sh +touch /etc/config/syncthing + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@syncthing[-1] + add ucitrack syncthing + set ucitrack.@syncthing[-1].exec='/etc/init.d/syncthing stop && /etc/init.d/syncthing start' + commit ucitrack +EOF +# remove LuCI cache +rm -f /tmp/luci* +exit 0 diff --git a/luci-app-syncthing/root/usr/share/rpcd/acl.d/luci-app-syncthing.json b/luci-app-syncthing/root/usr/share/rpcd/acl.d/luci-app-syncthing.json new file mode 100644 index 00000000..9fc9cc54 --- /dev/null +++ b/luci-app-syncthing/root/usr/share/rpcd/acl.d/luci-app-syncthing.json @@ -0,0 +1,11 @@ +{ + "luci-app-syncthing": { + "description": "Grant UCI access for luci-app-syncthing", + "read": { + "uci": [ "syncthing" ] + }, + "write": { + "uci": [ "syncthing" ] + } + } +}