diff --git a/homeproxy/Makefile b/homeproxy/Makefile index 8c84b414..40b792ee 100644 --- a/homeproxy/Makefile +++ b/homeproxy/Makefile @@ -16,7 +16,7 @@ LUCI_DEPENDS:= \ PKG_NAME:=luci-app-homeproxy PKG_VERSION=$(PKG_SRC_VERSION) -PKG_RELEASE:=11 +PKG_RELEASE:=15 PKG_PO_VERSION=$(PKG_SRC_VERSION)-r$(PKG_RELEASE) define Package/luci-app-homeproxy/conffiles diff --git a/homeproxy/htdocs/luci-static/resources/homeproxy.js b/homeproxy/htdocs/luci-static/resources/homeproxy.js index 369b3a4c..9f6f2839 100644 --- a/homeproxy/htdocs/luci-static/resources/homeproxy.js +++ b/homeproxy/htdocs/luci-static/resources/homeproxy.js @@ -325,7 +325,7 @@ return baseclass.extend({ if (!value) return _('Expecting: %s').format(_('non-empty value')); else if (value.match('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$') === null) - return _('Expecting: %s').format(_('valid uuid')); + return _('Expecting: %s').format(_('valid UUID')); } return true; diff --git a/homeproxy/htdocs/luci-static/resources/view/homeproxy/client.js b/homeproxy/htdocs/luci-static/resources/view/homeproxy/client.js index 77405f7e..5ff08103 100644 --- a/homeproxy/htdocs/luci-static/resources/view/homeproxy/client.js +++ b/homeproxy/htdocs/luci-static/resources/view/homeproxy/client.js @@ -221,7 +221,7 @@ return view.extend({ o = s.taboption('routing', form.Value, 'dns_server', _('DNS server'), _('Support UDP, TCP, DoH, DoQ, DoT. TCP protocol will be used if not specified.')); o.value('wan', _('WAN DNS (read from interface)')); - o.value('https://dns.cloudflare.com/dns-query', _('CloudFlare Public DNS (DoH)')); + o.value('https://dns.cloudflare.com/dns-query', _('Cloudflare Public DNS (DoH)')); o.value('https://dns.google/dns-query', _('Google Public DNS (DoH)')); o.value('https://dns.quad9.net/dns-query', _('Quad9 Public DNS (DoH)')); o.value('https://dns.adguard-dns.com/dns-query', _('AdGuard Public DNS (DoH)')); @@ -260,7 +260,7 @@ return view.extend({ o.value('wan', _('WAN DNS (read from interface)')); o.value('https://doh-pure.onedns.net/dns-query', _('ThreatBook Public DNS (DoH)')); o.value('https://doh.pub/dns-query', _('Tencent Public DNS (DoH)')); - o.value('https://dns.alidns.com/dns-query', _('AliYun Public DNS (DoH)')); + o.value('https://dns.alidns.com/dns-query', _('AliDNS Public DNS (DoH)')); o.depends('routing_mode', 'bypass_mainland_china'); o.default = 'https://dns.alidns.com/dns-query'; o.rmempty = false; @@ -313,7 +313,7 @@ return view.extend({ if (!stubValidator.apply('port', i) && !stubValidator.apply('portrange', i)) return _('Expecting: %s').format(_('valid port value')); if (ports.includes(i)) - return _('Port %s alrealy exists!').format(i); + return _('Port %s already exists!').format(i); ports = ports.concat(i); } } @@ -748,7 +748,7 @@ return view.extend({ so.modalonly = true; so = ss.taboption('field_other', form.Value, 'udp_timeout', _('UDP timeout'), - _('Timeout for UDP connections.
Setting a larger value than the UDP timeout in inbounds will have no effect.')); + _('Timeout for UDP connections.
Setting a larger value than the inbound UDP timeout will have no effect.')); so.datatype = 'uinteger'; so.depends('action', 'route'); so.depends('action', 'route-options'); @@ -830,7 +830,7 @@ return view.extend({ so.depends('action', 'resolve'); so.modalonly = true; - so = ss.taboption('field_host', form.DynamicList, 'domain', _('Domain name'), + so = ss.taboption('field_host', form.DynamicList, 'domain', _('Domains'), _('Match full domain.')); so.datatype = 'hostname'; so.modalonly = true; @@ -1206,7 +1206,7 @@ return view.extend({ so.depends('action', 'route'); so.modalonly = true; - so = ss.taboption('field_other', form.Flag, 'dns_disable_cache', _('Disable dns cache'), + so = ss.taboption('field_other', form.Flag, 'dns_disable_cache', _('Disable DNS cache'), _('Disable cache and save cache in this query.')); so.depends('action', 'route'); so.depends('action', 'route-options'); @@ -1267,7 +1267,7 @@ return view.extend({ so.depends('action', 'predefined'); so.modalonly = true; - so = ss.taboption('field_host', form.DynamicList, 'domain', _('Domain name'), + so = ss.taboption('field_host', form.DynamicList, 'domain', _('Domains'), _('Match full domain.')); so.datatype = 'hostname'; so.modalonly = true; @@ -1431,7 +1431,7 @@ return view.extend({ ss = o.subsection; /* Interface control start */ - ss.tab('interface', _('Interface Control')); + ss.tab('interface', _('Interface control')); so = ss.taboption('interface', widgets.DeviceSelect, 'listen_interfaces', _('Listen interfaces'), _('Only process traffic from specific interfaces. Leave empty for all.')); @@ -1454,55 +1454,55 @@ return view.extend({ so.default = 'disabled'; so.rmempty = false; - so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_direct_ipv4_ips', _('Direct IPv4 IP-s'), null, 'ipv4', hosts, true); + so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_direct_ipv4_ips', _('Direct IPv4 addresses'), null, 'ipv4', hosts, true); so.depends('lan_proxy_mode', 'except_listed'); - so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_direct_ipv6_ips', _('Direct IPv6 IP-s'), null, 'ipv6', hosts, true); + so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_direct_ipv6_ips', _('Direct IPv6 addresses'), null, 'ipv6', hosts, true); so.depends({'lan_proxy_mode': 'except_listed', 'homeproxy.config.ipv6_support': '1'}); - so = fwtool.addMACOption(ss, 'lan_ip_policy', 'lan_direct_mac_addrs', _('Direct MAC-s'), null, hosts); + so = fwtool.addMACOption(ss, 'lan_ip_policy', 'lan_direct_mac_addrs', _('Direct MAC addresses'), null, hosts); so.depends('lan_proxy_mode', 'except_listed'); - so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_proxy_ipv4_ips', _('Proxy IPv4 IP-s'), null, 'ipv4', hosts, true); + so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_proxy_ipv4_ips', _('Proxy IPv4 addresses'), null, 'ipv4', hosts, true); so.depends('lan_proxy_mode', 'listed_only'); - so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_proxy_ipv6_ips', _('Proxy IPv6 IP-s'), null, 'ipv6', hosts, true); + so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_proxy_ipv6_ips', _('Proxy IPv6 addresses'), null, 'ipv6', hosts, true); so.depends({'lan_proxy_mode': 'listed_only', 'homeproxy.config.ipv6_support': '1'}); - so = fwtool.addMACOption(ss, 'lan_ip_policy', 'lan_proxy_mac_addrs', _('Proxy MAC-s'), null, hosts); + so = fwtool.addMACOption(ss, 'lan_ip_policy', 'lan_proxy_mac_addrs', _('Proxy MAC addresses'), null, hosts); so.depends('lan_proxy_mode', 'listed_only'); - so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_gaming_mode_ipv4_ips', _('Gaming mode IPv4 IP-s'), null, 'ipv4', hosts, true); + so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_gaming_mode_ipv4_ips', _('Gaming mode IPv4 addresses'), null, 'ipv4', hosts, true); - so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_gaming_mode_ipv6_ips', _('Gaming mode IPv6 IP-s'), null, 'ipv6', hosts, true); + so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_gaming_mode_ipv6_ips', _('Gaming mode IPv6 addresses'), null, 'ipv6', hosts, true); so.depends('homeproxy.config.ipv6_support', '1'); - so = fwtool.addMACOption(ss, 'lan_ip_policy', 'lan_gaming_mode_mac_addrs', _('Gaming mode MAC-s'), null, hosts); + so = fwtool.addMACOption(ss, 'lan_ip_policy', 'lan_gaming_mode_mac_addrs', _('Gaming mode MAC addresses'), null, hosts); - so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_global_proxy_ipv4_ips', _('Global proxy IPv4 IP-s'), null, 'ipv4', hosts, true); + so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_global_proxy_ipv4_ips', _('Global proxy IPv4 addresses'), null, 'ipv4', hosts, true); so.depends({'homeproxy.config.routing_mode': 'custom', '!reverse': true}); - so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_global_proxy_ipv6_ips', _('Global proxy IPv6 IP-s'), null, 'ipv6', hosts, true); + so = fwtool.addIPOption(ss, 'lan_ip_policy', 'lan_global_proxy_ipv6_ips', _('Global proxy IPv6 addresses'), null, 'ipv6', hosts, true); so.depends({'homeproxy.config.routing_mode': /^((?!custom).)+$/, 'homeproxy.config.ipv6_support': '1'}); - so = fwtool.addMACOption(ss, 'lan_ip_policy', 'lan_global_proxy_mac_addrs', _('Global proxy MAC-s'), null, hosts); + so = fwtool.addMACOption(ss, 'lan_ip_policy', 'lan_global_proxy_mac_addrs', _('Global proxy MAC addresses'), null, hosts); so.depends({'homeproxy.config.routing_mode': 'custom', '!reverse': true}); /* LAN IP policy end */ /* WAN IP policy start */ ss.tab('wan_ip_policy', _('WAN IP Policy')); - so = ss.taboption('wan_ip_policy', form.DynamicList, 'wan_proxy_ipv4_ips', _('Proxy IPv4 IP-s')); + so = ss.taboption('wan_ip_policy', form.DynamicList, 'wan_proxy_ipv4_ips', _('Proxy IPv4 addresses')); so.datatype = 'or(ip4addr, cidr4)'; - so = ss.taboption('wan_ip_policy', form.DynamicList, 'wan_proxy_ipv6_ips', _('Proxy IPv6 IP-s')); + so = ss.taboption('wan_ip_policy', form.DynamicList, 'wan_proxy_ipv6_ips', _('Proxy IPv6 addresses')); so.datatype = 'or(ip6addr, cidr6)'; so.depends('homeproxy.config.ipv6_support', '1'); - so = ss.taboption('wan_ip_policy', form.DynamicList, 'wan_direct_ipv4_ips', _('Direct IPv4 IP-s')); + so = ss.taboption('wan_ip_policy', form.DynamicList, 'wan_direct_ipv4_ips', _('Direct IPv4 addresses')); so.datatype = 'or(ip4addr, cidr4)'; - so = ss.taboption('wan_ip_policy', form.DynamicList, 'wan_direct_ipv6_ips', _('Direct IPv6 IP-s')); + so = ss.taboption('wan_ip_policy', form.DynamicList, 'wan_direct_ipv6_ips', _('Direct IPv6 addresses')); so.datatype = 'or(ip6addr, cidr6)'; so.depends('homeproxy.config.ipv6_support', '1'); /* WAN IP policy end */ diff --git a/homeproxy/htdocs/luci-static/resources/view/homeproxy/node.js b/homeproxy/htdocs/luci-static/resources/view/homeproxy/node.js index 69a780b0..9cc2f9b4 100644 --- a/homeproxy/htdocs/luci-static/resources/view/homeproxy/node.js +++ b/homeproxy/htdocs/luci-static/resources/view/homeproxy/node.js @@ -1049,7 +1049,7 @@ function renderNodeSettings(section, data, features, main_node, routing_mode, no o.modalonly = true; o = s.option(form.ListValue, 'shadowsocks_plugin', _('Plugin')); - o.value('', _('none')); + o.value('', _('None')); o.value('obfs-local'); o.value('v2ray-plugin'); o.depends('type', 'shadowsocks'); @@ -1305,9 +1305,9 @@ function renderNodeSettings(section, data, features, main_node, routing_mode, no /* WebSocket config end */ o = s.option(form.ListValue, 'packet_encoding', _('Packet encoding')); - o.value('', _('none')); + o.value('', _('None')); o.value('packetaddr', _('packet addr (v2ray-core v5+)')); - o.value('xudp', _('Xudp (Xray-core)')); + o.value('xudp', _('XUDP (Xray-core)')); o.depends('type', 'vless'); o.depends('type', 'vmess'); o.modalonly = true; @@ -1329,7 +1329,7 @@ function renderNodeSettings(section, data, features, main_node, routing_mode, no o.rmempty = false; o.modalonly = true; - o = s.option(form.Value, 'wireguard_peer_public_key', _('Peer pubkic key'), + o = s.option(form.Value, 'wireguard_peer_public_key', _('Peer public key'), _('WireGuard peer public key.')); o.depends('type', 'wireguard'); o.validate = L.bind(hp.validateBase64Key, this, 44); @@ -1468,7 +1468,7 @@ function renderNodeSettings(section, data, features, main_node, routing_mode, no o = s.option(form.ListValue, 'tls_min_version', _('Minimum TLS version'), _('The minimum TLS version that is acceptable.')); - o.value('', _('default')); + o.value('', _('Default')); for (let i of hp.tls_versions) o.value(i); o.depends('tls', '1'); @@ -1476,7 +1476,7 @@ function renderNodeSettings(section, data, features, main_node, routing_mode, no o = s.option(form.ListValue, 'tls_max_version', _('Maximum TLS version'), _('The maximum TLS version that is acceptable.')); - o.value('', _('default')); + o.value('', _('Default')); for (let i of hp.tls_versions) o.value(i); o.depends('tls', '1'); @@ -1757,7 +1757,7 @@ return view.extend({ s.tab('subscription', _('Subscriptions')); o = s.taboption('subscription', form.Flag, 'auto_update', _('Auto update'), - _('Auto update subscriptions and geodata.')); + _('Auto update subscriptions and resources.')); o.rmempty = false; o = s.taboption('subscription', form.Value, 'auto_update_time', _('Cron expression'), @@ -1777,7 +1777,7 @@ return view.extend({ o.default = 'icmp'; o.rmempty = false; - o = s.taboption('subscription', form.DynamicList, 'subscription_url', _('Subscription URL-s'), + o = s.taboption('subscription', form.DynamicList, 'subscription_url', _('Subscription URLs'), _('Support Hysteria, Shadowsocks, Trojan, v2rayN (VMess), and XTLS (VLESS) online configuration delivery standard.')); o.validate = function(section_id, value) { if (section_id && value) { @@ -1811,16 +1811,16 @@ return view.extend({ o.placeholder = 'Wget/1.21 (HomeProxy, like v2rayN)'; o = s.taboption('subscription', form.Flag, 'allow_insecure', _('Allow insecure'), - _('Allow insecure connection by default when add nodes from subscriptions.') + + _('Allow insecure connection by default when adding nodes from subscriptions.') + '
' + _('This is DANGEROUS, your traffic is almost like PLAIN TEXT! Use at your own risk!')); o.rmempty = false; o.onchange = allowInsecureConfirm; o = s.taboption('subscription', form.ListValue, 'packet_encoding', _('Default packet encoding')); - o.value('', _('none')); + o.value('', _('None')); o.value('packetaddr', _('packet addr (v2ray-core v5+)')); - o.value('xudp', _('Xudp (Xray-core)')); + o.value('xudp', _('XUDP (Xray-core)')); o = s.taboption('subscription', form.Button, '_save_subscriptions', _('Save subscriptions settings'), _('NOTE: Save current settings before updating subscriptions.')); diff --git a/homeproxy/htdocs/luci-static/resources/view/homeproxy/server.js b/homeproxy/htdocs/luci-static/resources/view/homeproxy/server.js index 6144e049..db1c318c 100644 --- a/homeproxy/htdocs/luci-static/resources/view/homeproxy/server.js +++ b/homeproxy/htdocs/luci-static/resources/view/homeproxy/server.js @@ -148,7 +148,7 @@ return view.extend({ o = s.option(form.Flag, 'enabled', _('Enable')); o.rmempty = false; - s = m.section(form.GridSection, 'server', _('Server settings')); + s = m.section(form.GridSection, 'server', _('Server Settings')); s.addremove = true; s.rowcolors = true; s.sortable = true; @@ -329,7 +329,7 @@ return view.extend({ o.modalonly = true; o = s.option(form.Value, 'hysteria_masquerade', _('Masquerade'), - _('HTTP3 server behavior when authentication fails.
A 404 page will be returned if empty.')); + _('HTTP/3 server behavior when authentication fails.
A 404 page will be returned if empty.')); o.depends('type', 'hysteria2'); o.modalonly = true; /* Hysteria (2) config end */ @@ -569,7 +569,7 @@ return view.extend({ o = s.option(form.ListValue, 'tls_min_version', _('Minimum TLS version'), _('The minimum TLS version that is acceptable.')); - o.value('', _('default')); + o.value('', _('Default')); for (let i of hp.tls_versions) o.value(i); o.depends('tls', '1'); @@ -577,7 +577,7 @@ return view.extend({ o = s.option(form.ListValue, 'tls_max_version', _('Maximum TLS version'), _('The maximum TLS version that is acceptable.')); - o.value('', _('default')); + o.value('', _('Default')); for (let i of hp.tls_versions) o.value(i); o.depends('tls', '1'); @@ -632,13 +632,13 @@ return view.extend({ o.rmempty = false; o.modalonly = true; - o = s.option(form.Flag, 'tls_dns01_challenge', _('DNS01 challenge')) + o = s.option(form.Flag, 'tls_dns01_challenge', _('DNS-01 challenge')) o.depends('tls_acme', '1'); o.modalonly = true; o = s.option(form.ListValue, 'tls_dns01_provider', _('DNS provider')); - o.value('alidns', _('AliYun')); - o.value('cfdns', _('CloudFlare')); + o.value('alidns', _('AliDNS')); + o.value('cfdns', _('Cloudflare')); o.depends('tls_dns01_challenge', '1'); o.default = 'cfdns'; o.rmempty = false; @@ -788,7 +788,7 @@ return view.extend({ o.inputstyle = 'action'; o.inputtitle = _('Upload...'); o.depends({'tls': '1', 'tls_key_path': '/etc/homeproxy/certs/server_privatekey.pem'}); - o.onclick = L.bind(hp.uploadCertificate, this, _('private key'), 'server_privatekey'); + o.onclick = L.bind(hp.uploadCertificate, this, _('Private key'), 'server_privatekey'); o.modalonly = true; o = s.option(form.TextValue, 'tls_ech_key', _('ECH key')); diff --git a/homeproxy/htdocs/luci-static/resources/view/homeproxy/status.js b/homeproxy/htdocs/luci-static/resources/view/homeproxy/status.js index fc0a67d4..7dd857f9 100644 --- a/homeproxy/htdocs/luci-static/resources/view/homeproxy/status.js +++ b/homeproxy/htdocs/luci-static/resources/view/homeproxy/status.js @@ -89,11 +89,11 @@ function getConnectionStatus() { if (result?.result) { elements.state.style.setProperty('color', 'green'); - dom.content(elements.state, _('Connected')); - dom.content(elements.latency, _('%d ms').format(result.latency_ms)); + dom.content(elements.state, _('Success')); + dom.content(elements.latency, _('%s ms').format(result.latency_ms)); } else { elements.state.style.setProperty('color', 'red'); - dom.content(elements.state, result?.timed_out ? _('Timed out') : _('Disconnected')); + dom.content(elements.state, result?.timed_out ? _('Timed out') : _('Failed')); dom.content(elements.latency, '-'); } }; diff --git a/homeproxy/po/templates/homeproxy.pot b/homeproxy/po/templates/homeproxy.pot index adfee5d5..c92353b8 100644 --- a/homeproxy/po/templates/homeproxy.pot +++ b/homeproxy/po/templates/homeproxy.pot @@ -1,15 +1,12 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8" -#: htdocs/luci-static/resources/view/homeproxy/status.js:93 -msgid "%d ms" -msgstr "" - #: htdocs/luci-static/resources/view/homeproxy/status.js:364 msgid "%s log" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:500 +#: htdocs/luci-static/resources/view/homeproxy/status.js:93 msgid "%s ms" msgstr "" @@ -110,11 +107,11 @@ msgid "Address" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/server.js:640 -msgid "AliYun" +msgid "AliDNS" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:263 -msgid "AliYun Public DNS (DoH)" +msgid "AliDNS Public DNS (DoH)" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:306 @@ -135,7 +132,8 @@ msgid "Allow insecure connection at TLS client." msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1814 -msgid "Allow insecure connection by default when add nodes from subscriptions." +msgid "" +"Allow insecure connection by default when adding nodes from subscriptions." msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1295 @@ -230,7 +228,7 @@ msgid "Auto update" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1760 -msgid "Auto update subscriptions and geodata." +msgid "Auto update subscriptions and resources." msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1123 @@ -369,11 +367,11 @@ msgid "Client version" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/server.js:641 -msgid "CloudFlare" +msgid "Cloudflare" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:224 -msgid "CloudFlare Public DNS (DoH)" +msgid "Cloudflare Public DNS (DoH)" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:156 @@ -391,10 +389,6 @@ msgstr "" msgid "Congestion control algorithm" msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/status.js:92 -msgid "Connected" -msgstr "" - #: htdocs/luci-static/resources/view/homeproxy/status.js:160 msgid "Connection status" msgstr "" @@ -441,12 +435,12 @@ msgstr "" msgid "DNS server" msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/client.js:228 -msgid "DNS.SB Public DNS (DoH)" +#: htdocs/luci-static/resources/view/homeproxy/server.js:635 +msgid "DNS-01 challenge" msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/server.js:635 -msgid "DNS01 challenge" +#: htdocs/luci-static/resources/view/homeproxy/client.js:228 +msgid "DNS.SB Public DNS (DoH)" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:647 @@ -465,6 +459,10 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1111 #: htdocs/luci-static/resources/view/homeproxy/client.js:1409 #: htdocs/luci-static/resources/view/homeproxy/node.js:1131 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1471 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1479 +#: htdocs/luci-static/resources/view/homeproxy/server.js:572 +#: htdocs/luci-static/resources/view/homeproxy/server.js:580 msgid "Default" msgstr "" @@ -524,16 +522,16 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1457 #: htdocs/luci-static/resources/view/homeproxy/client.js:1502 -msgid "Direct IPv4 IP-s" +msgid "Direct IPv4 addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1460 #: htdocs/luci-static/resources/view/homeproxy/client.js:1505 -msgid "Direct IPv6 IP-s" +msgid "Direct IPv6 addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1463 -msgid "Direct MAC-s" +msgid "Direct MAC addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:165 @@ -554,6 +552,7 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:815 #: htdocs/luci-static/resources/view/homeproxy/client.js:927 +#: htdocs/luci-static/resources/view/homeproxy/client.js:1209 msgid "Disable DNS cache" msgstr "" @@ -586,10 +585,6 @@ msgstr "" msgid "Disable cache expire" msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/client.js:1209 -msgid "Disable dns cache" -msgstr "" - #: htdocs/luci-static/resources/view/homeproxy/node.js:1027 #: htdocs/luci-static/resources/view/homeproxy/server.js:322 msgid "" @@ -597,20 +592,11 @@ msgid "" "(IPv4) / 1232 (IPv6) bytes in size." msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/status.js:96 -msgid "Disconnected" -msgstr "" - #: htdocs/luci-static/resources/view/homeproxy/client.js:842 #: htdocs/luci-static/resources/view/homeproxy/client.js:1279 msgid "Domain keyword" msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/client.js:833 -#: htdocs/luci-static/resources/view/homeproxy/client.js:1270 -msgid "Domain name" -msgstr "" - #: htdocs/luci-static/resources/view/homeproxy/client.js:846 #: htdocs/luci-static/resources/view/homeproxy/client.js:1283 msgid "Domain regex" @@ -637,6 +623,8 @@ msgstr "" msgid "Domain suffix" msgstr "" +#: htdocs/luci-static/resources/view/homeproxy/client.js:833 +#: htdocs/luci-static/resources/view/homeproxy/client.js:1270 #: htdocs/luci-static/resources/view/homeproxy/server.js:600 msgid "Domains" msgstr "" @@ -856,6 +844,10 @@ msgstr "" msgid "Extra records" msgstr "" +#: htdocs/luci-static/resources/view/homeproxy/status.js:96 +msgid "Failed" +msgstr "" + #: htdocs/luci-static/resources/view/homeproxy/server.js:86 msgid "Failed to generate %s, error: %s." msgstr "" @@ -927,15 +919,15 @@ msgid "GFWList" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1475 -msgid "Gaming mode IPv4 IP-s" +msgid "Gaming mode IPv4 addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1477 -msgid "Gaming mode IPv6 IP-s" +msgid "Gaming mode IPv6 addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1480 -msgid "Gaming mode MAC-s" +msgid "Gaming mode MAC addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/server.js:36 @@ -961,15 +953,15 @@ msgid "Global padding" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1482 -msgid "Global proxy IPv4 IP-s" +msgid "Global proxy IPv4 addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1485 -msgid "Global proxy IPv6 IP-s" +msgid "Global proxy IPv6 addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1488 -msgid "Global proxy MAC-s" +msgid "Global proxy MAC addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/server.js:146 @@ -1003,7 +995,7 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/server.js:332 msgid "" -"HTTP3 server behavior when authentication fails.
A 404 page will be " +"HTTP/3 server behavior when authentication fails.
A 404 page will be " "returned if empty." msgstr "" @@ -1234,7 +1226,7 @@ msgid "Info" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1434 -msgid "Interface Control" +msgid "Interface control" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:588 @@ -1689,8 +1681,11 @@ msgid "Nodes" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1022 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1052 #: htdocs/luci-static/resources/view/homeproxy/node.js:1158 #: htdocs/luci-static/resources/view/homeproxy/node.js:1196 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1308 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1821 #: htdocs/luci-static/resources/view/homeproxy/server.js:386 #: htdocs/luci-static/resources/view/homeproxy/server.js:401 msgid "None" @@ -1782,7 +1777,7 @@ msgid "Path" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1332 -msgid "Peer pubkic key" +msgid "Peer public key" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1357 @@ -1810,7 +1805,7 @@ msgid "Port" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:316 -msgid "Port %s alrealy exists!" +msgid "Port %s already exists!" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:610 @@ -1845,6 +1840,7 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1099 #: htdocs/luci-static/resources/view/homeproxy/node.js:1324 +#: htdocs/luci-static/resources/view/homeproxy/server.js:791 msgid "Private key" msgstr "" @@ -1900,16 +1896,16 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1466 #: htdocs/luci-static/resources/view/homeproxy/client.js:1495 -msgid "Proxy IPv4 IP-s" +msgid "Proxy IPv4 addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1469 #: htdocs/luci-static/resources/view/homeproxy/client.js:1498 -msgid "Proxy IPv6 IP-s" +msgid "Proxy IPv6 addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1472 -msgid "Proxy MAC-s" +msgid "Proxy MAC addresses" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:1453 @@ -2204,6 +2200,7 @@ msgstr "" msgid "Server" msgstr "" +#: htdocs/luci-static/resources/view/homeproxy/server.js:151 #: root/usr/share/luci/menu.d/luci-app-homeproxy.json:30 msgid "Server Settings" msgstr "" @@ -2214,10 +2211,6 @@ msgid "" "ServerName field is empty." msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/server.js:151 -msgid "Server settings" -msgstr "" - #: root/usr/share/luci/menu.d/luci-app-homeproxy.json:38 msgid "Service Status" msgstr "" @@ -2351,7 +2344,7 @@ msgid "Sub (%s)" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1780 -msgid "Subscription URL-s" +msgid "Subscription URLs" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1757 @@ -2359,6 +2352,7 @@ msgid "Subscriptions" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:500 +#: htdocs/luci-static/resources/view/homeproxy/status.js:92 msgid "Success" msgstr "" @@ -2735,8 +2729,8 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:751 msgid "" -"Timeout for UDP connections.
Setting a larger value than the UDP timeout " -"in inbounds will have no effect." +"Timeout for UDP connections.
Setting a larger value than the inbound UDP " +"timeout will have no effect." msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:946 @@ -3010,7 +3004,7 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/node.js:1310 #: htdocs/luci-static/resources/view/homeproxy/node.js:1823 -msgid "Xudp (Xray-core)" +msgid "XUDP (Xray-core)" msgstr "" #: htdocs/luci-static/resources/view/homeproxy/status.js:40 @@ -3034,13 +3028,6 @@ msgstr "" msgid "connect UDP connections" msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/node.js:1471 -#: htdocs/luci-static/resources/view/homeproxy/node.js:1479 -#: htdocs/luci-static/resources/view/homeproxy/server.js:572 -#: htdocs/luci-static/resources/view/homeproxy/server.js:580 -msgid "default" -msgstr "" - #: htdocs/luci-static/resources/view/homeproxy/node.js:1197 #: htdocs/luci-static/resources/view/homeproxy/server.js:402 msgid "gRPC" @@ -3071,21 +3058,11 @@ msgstr "" msgid "non-empty value" msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/node.js:1052 -#: htdocs/luci-static/resources/view/homeproxy/node.js:1308 -#: htdocs/luci-static/resources/view/homeproxy/node.js:1821 -msgid "none" -msgstr "" - #: htdocs/luci-static/resources/view/homeproxy/node.js:1309 #: htdocs/luci-static/resources/view/homeproxy/node.js:1822 msgid "packet addr (v2ray-core v5+)" msgstr "" -#: htdocs/luci-static/resources/view/homeproxy/server.js:791 -msgid "private key" -msgstr "" - #: htdocs/luci-static/resources/view/homeproxy/client.js:659 msgid "quic-go / uquic chrome" msgstr "" @@ -3147,6 +3124,10 @@ msgstr "" msgid "valid URL" msgstr "" +#: htdocs/luci-static/resources/homeproxy.js:328 +msgid "valid UUID" +msgstr "" + #: htdocs/luci-static/resources/homeproxy.js:271 msgid "valid base64 key with %d characters" msgstr "" @@ -3163,7 +3144,3 @@ msgstr "" #: htdocs/luci-static/resources/view/homeproxy/client.js:314 msgid "valid port value" msgstr "" - -#: htdocs/luci-static/resources/homeproxy.js:328 -msgid "valid uuid" -msgstr "" diff --git a/homeproxy/po/zh_Hans/homeproxy.po b/homeproxy/po/zh_Hans/homeproxy.po index cb1fc7c6..af80d65a 100644 --- a/homeproxy/po/zh_Hans/homeproxy.po +++ b/homeproxy/po/zh_Hans/homeproxy.po @@ -8,15 +8,12 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" -#: htdocs/luci-static/resources/view/homeproxy/status.js:93 -msgid "%d ms" -msgstr "%d 毫秒" - #: htdocs/luci-static/resources/view/homeproxy/status.js:364 msgid "%s log" msgstr "%s 日志" #: htdocs/luci-static/resources/view/homeproxy/node.js:500 +#: htdocs/luci-static/resources/view/homeproxy/status.js:93 msgid "%s ms" msgstr "%s 毫秒" @@ -70,7 +67,7 @@ msgstr "访问密钥 ID" #: htdocs/luci-static/resources/view/homeproxy/server.js:653 msgid "Access key secret" -msgstr "访问密钥" +msgstr "访问密钥 Secret" #: htdocs/luci-static/resources/view/homeproxy/client.js:697 #: htdocs/luci-static/resources/view/homeproxy/client.js:1174 @@ -119,11 +116,11 @@ msgid "Address" msgstr "地址" #: htdocs/luci-static/resources/view/homeproxy/server.js:640 -msgid "AliYun" -msgstr "AliYun" +msgid "AliDNS" +msgstr "AliDNS" #: htdocs/luci-static/resources/view/homeproxy/client.js:263 -msgid "AliYun Public DNS (DoH)" +msgid "AliDNS Public DNS (DoH)" msgstr "阿里 公共DNS (DoH)" #: htdocs/luci-static/resources/view/homeproxy/client.js:306 @@ -144,8 +141,9 @@ msgid "Allow insecure connection at TLS client." msgstr "允许 TLS 客户端侧的不安全连接。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1814 -msgid "Allow insecure connection by default when add nodes from subscriptions." -msgstr "从订阅获取节点时,默认允许不安全连接。" +msgid "" +"Allow insecure connection by default when adding nodes from subscriptions." +msgstr "从订阅添加节点时,默认允许不安全连接。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1295 #: htdocs/luci-static/resources/view/homeproxy/server.js:482 @@ -167,11 +165,11 @@ msgstr "额外 ID" #: htdocs/luci-static/resources/view/homeproxy/server.js:678 msgid "Alternative HTTP port" -msgstr "替代 HTTP 端口" +msgstr "备用 HTTP 端口" #: htdocs/luci-static/resources/view/homeproxy/server.js:684 msgid "Alternative TLS port" -msgstr "替代 HTTPS 端口" +msgstr "备用 TLS 端口" #: htdocs/luci-static/resources/view/homeproxy/node.js:1850 msgid "An error occurred during updating subscriptions: %s" @@ -179,7 +177,7 @@ msgstr "更新订阅时发生错误:%s" #: htdocs/luci-static/resources/view/homeproxy/client.js:1255 msgid "Answer" -msgstr "回答" +msgstr "应答" #: htdocs/luci-static/resources/view/homeproxy/node.js:859 #: htdocs/luci-static/resources/view/homeproxy/server.js:176 @@ -241,8 +239,8 @@ msgid "Auto update" msgstr "自动更新" #: htdocs/luci-static/resources/view/homeproxy/node.js:1760 -msgid "Auto update subscriptions and geodata." -msgstr "自动更新订阅和地理数据。" +msgid "Auto update subscriptions and resources." +msgstr "自动更新订阅和资源。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1123 msgid "BBR" @@ -380,12 +378,12 @@ msgid "Client version" msgstr "客户端版本" #: htdocs/luci-static/resources/view/homeproxy/server.js:641 -msgid "CloudFlare" -msgstr "CloudFlare" +msgid "Cloudflare" +msgstr "Cloudflare" #: htdocs/luci-static/resources/view/homeproxy/client.js:224 -msgid "CloudFlare Public DNS (DoH)" -msgstr "CloudFlare 公共DNS (DoH)" +msgid "Cloudflare Public DNS (DoH)" +msgstr "Cloudflare 公共DNS (DoH)" #: htdocs/luci-static/resources/view/homeproxy/client.js:156 #: htdocs/luci-static/resources/view/homeproxy/server.js:142 @@ -402,10 +400,6 @@ msgstr "仅常用端口(绕过 P2P 流量)" msgid "Congestion control algorithm" msgstr "拥塞控制算法" -#: htdocs/luci-static/resources/view/homeproxy/status.js:92 -msgid "Connected" -msgstr "连通" - #: htdocs/luci-static/resources/view/homeproxy/status.js:160 msgid "Connection status" msgstr "连接状态" @@ -452,14 +446,14 @@ msgstr "DNS 规则" msgid "DNS server" msgstr "DNS 服务器" +#: htdocs/luci-static/resources/view/homeproxy/server.js:635 +msgid "DNS-01 challenge" +msgstr "DNS-01 质询" + #: htdocs/luci-static/resources/view/homeproxy/client.js:228 msgid "DNS.SB Public DNS (DoH)" msgstr "DNS.SB 公共DNS (DoH)" -#: htdocs/luci-static/resources/view/homeproxy/server.js:635 -msgid "DNS01 challenge" -msgstr "DNS01 验证" - #: htdocs/luci-static/resources/view/homeproxy/client.js:647 #: htdocs/luci-static/resources/view/homeproxy/client.js:1135 msgid "DTLS" @@ -476,6 +470,10 @@ msgstr "调试" #: htdocs/luci-static/resources/view/homeproxy/client.js:1111 #: htdocs/luci-static/resources/view/homeproxy/client.js:1409 #: htdocs/luci-static/resources/view/homeproxy/node.js:1131 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1471 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1479 +#: htdocs/luci-static/resources/view/homeproxy/server.js:572 +#: htdocs/luci-static/resources/view/homeproxy/server.js:580 msgid "Default" msgstr "默认" @@ -535,16 +533,16 @@ msgstr "直连域名列表" #: htdocs/luci-static/resources/view/homeproxy/client.js:1457 #: htdocs/luci-static/resources/view/homeproxy/client.js:1502 -msgid "Direct IPv4 IP-s" +msgid "Direct IPv4 addresses" msgstr "直连 IPv4 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1460 #: htdocs/luci-static/resources/view/homeproxy/client.js:1505 -msgid "Direct IPv6 IP-s" +msgid "Direct IPv6 addresses" msgstr "直连 IPv6 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1463 -msgid "Direct MAC-s" +msgid "Direct MAC addresses" msgstr "直连 MAC 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:165 @@ -565,6 +563,7 @@ msgstr "禁用(服务)" #: htdocs/luci-static/resources/view/homeproxy/client.js:815 #: htdocs/luci-static/resources/view/homeproxy/client.js:927 +#: htdocs/luci-static/resources/view/homeproxy/client.js:1209 msgid "Disable DNS cache" msgstr "禁用 DNS 缓存" @@ -574,7 +573,7 @@ msgstr "在本次查询中禁用 DNS 缓存。" #: htdocs/luci-static/resources/view/homeproxy/server.js:670 msgid "Disable HTTP challenge" -msgstr "禁用 HTTP 验证" +msgstr "禁用 HTTP 质询" #: htdocs/luci-static/resources/view/homeproxy/node.js:1026 #: htdocs/luci-static/resources/view/homeproxy/server.js:321 @@ -583,11 +582,11 @@ msgstr "禁用路径 MTU 探测" #: htdocs/luci-static/resources/view/homeproxy/server.js:674 msgid "Disable TLS ALPN challenge" -msgstr "禁用 TLS ALPN 认证" +msgstr "禁用 TLS-ALPN 质询" #: htdocs/luci-static/resources/view/homeproxy/client.js:738 msgid "Disable UDP domain unmapping" -msgstr "禁用 UDP 域名映射" +msgstr "禁用 UDP 域名反向映射" #: htdocs/luci-static/resources/view/homeproxy/client.js:1210 msgid "Disable cache and save cache in this query." @@ -597,33 +596,20 @@ msgstr "在本次查询中禁用缓存。" msgid "Disable cache expire" msgstr "缓存永不过期" -#: htdocs/luci-static/resources/view/homeproxy/client.js:1209 -msgid "Disable dns cache" -msgstr "禁用 DNS 缓存" - #: htdocs/luci-static/resources/view/homeproxy/node.js:1027 #: htdocs/luci-static/resources/view/homeproxy/server.js:322 msgid "" "Disables Path MTU Discovery (RFC 8899). Packets will then be at most 1252 " "(IPv4) / 1232 (IPv6) bytes in size." msgstr "" -"禁用路径 MTU 发现 (RFC 8899)。 数据包的大小最多为 1252 (IPv4) / 1232 (IPv6) " +"禁用路径 MTU 发现(RFC 8899)。数据包的大小最多为 1252(IPv4)/ 1232(IPv6)" "字节。" -#: htdocs/luci-static/resources/view/homeproxy/status.js:96 -msgid "Disconnected" -msgstr "不通" - #: htdocs/luci-static/resources/view/homeproxy/client.js:842 #: htdocs/luci-static/resources/view/homeproxy/client.js:1279 msgid "Domain keyword" msgstr "域名关键词" -#: htdocs/luci-static/resources/view/homeproxy/client.js:833 -#: htdocs/luci-static/resources/view/homeproxy/client.js:1270 -msgid "Domain name" -msgstr "域名" - #: htdocs/luci-static/resources/view/homeproxy/client.js:846 #: htdocs/luci-static/resources/view/homeproxy/client.js:1283 msgid "Domain regex" @@ -650,6 +636,8 @@ msgstr "目标域名的解析策略。" msgid "Domain suffix" msgstr "域名后缀" +#: htdocs/luci-static/resources/view/homeproxy/client.js:833 +#: htdocs/luci-static/resources/view/homeproxy/client.js:1270 #: htdocs/luci-static/resources/view/homeproxy/server.js:600 msgid "Domains" msgstr "域名" @@ -688,13 +676,13 @@ msgid "" "href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/" "Regular_Expressions\">Regex is supported." msgstr "" -"丢弃/保留 包含指定关键词的节点。支持" "正则表达式。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1798 msgid "Drop/keep specific nodes from subscriptions." -msgstr "从订阅中 丢弃/保留 指定节点" +msgstr "从订阅中丢弃/保留指定节点。" #: htdocs/luci-static/resources/view/homeproxy/server.js:691 msgid "" @@ -703,9 +691,9 @@ msgid "" "bindings are \"used to associate an ACME account with an existing account in " "a non-ACME system, such as a CA customer database." msgstr "" -"EAB(外部帐户绑定)包含将 ACME 帐户绑定或映射到 CA 已知的其他帐户所需的信息。" -"
外部帐户绑定“用于将 ACME 帐户与非 ACME 系统中的现有帐户相关联,例如 CA " -"客户数据库。" +"EAB(外部账户绑定)包含将 ACME 账户绑定或映射到 CA 已知的其他账户所需的信息。" +"
外部账户绑定“用于将 ACME 账户与非 ACME 系统中的现有账户相关联,例如 CA " +"客户数据库”。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1515 msgid "" @@ -713,7 +701,7 @@ msgid "" "encrypt the first part of its ClientHello message." msgstr "" "ECH(Encrypted Client Hello)是一个 TLS 扩展,它允许客户端加密其 ClientHello " -"信息的第一部分。" +"消息的第一部分。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1530 #: htdocs/luci-static/resources/view/homeproxy/server.js:835 @@ -732,7 +720,7 @@ msgstr "ECH 密钥" #: htdocs/luci-static/resources/view/homeproxy/client.js:936 #: htdocs/luci-static/resources/view/homeproxy/client.js:1222 msgid "EDNS Client subnet" -msgstr "ENDS 客户端子网" +msgstr "EDNS 客户端子网" #: htdocs/luci-static/resources/view/homeproxy/node.js:1294 #: htdocs/luci-static/resources/view/homeproxy/server.js:481 @@ -754,7 +742,7 @@ msgstr "修改节点" #: htdocs/luci-static/resources/view/homeproxy/server.js:612 msgid "Email" -msgstr "Email" +msgstr "电子邮件" #: htdocs/luci-static/resources/view/homeproxy/client.js:442 #: htdocs/luci-static/resources/view/homeproxy/client.js:618 @@ -879,6 +867,10 @@ msgstr "外部账户密钥标识符" msgid "Extra records" msgstr "附加记录" +#: htdocs/luci-static/resources/view/homeproxy/status.js:96 +msgid "Failed" +msgstr "失败" + #: htdocs/luci-static/resources/view/homeproxy/server.js:86 msgid "Failed to generate %s, error: %s." msgstr "生成 %s 失败,错误:%s。" @@ -926,7 +918,7 @@ msgstr "格式" #: htdocs/luci-static/resources/view/homeproxy/client.js:758 msgid "Fragment TLS handshake into multiple TLS records." -msgstr "将 TLS 握手分片为多个 TLS 记录" +msgstr "将 TLS 握手分片为多个 TLS 记录。" #: htdocs/luci-static/resources/view/homeproxy/client.js:764 msgid "" @@ -950,15 +942,15 @@ msgid "GFWList" msgstr "GFWList" #: htdocs/luci-static/resources/view/homeproxy/client.js:1475 -msgid "Gaming mode IPv4 IP-s" +msgid "Gaming mode IPv4 addresses" msgstr "游戏模式 IPv4 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1477 -msgid "Gaming mode IPv6 IP-s" +msgid "Gaming mode IPv6 addresses" msgstr "游戏模式 IPv6 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1480 -msgid "Gaming mode MAC-s" +msgid "Gaming mode MAC addresses" msgstr "游戏模式 MAC 地址" #: htdocs/luci-static/resources/view/homeproxy/server.js:36 @@ -984,15 +976,15 @@ msgid "Global padding" msgstr "全局填充" #: htdocs/luci-static/resources/view/homeproxy/client.js:1482 -msgid "Global proxy IPv4 IP-s" +msgid "Global proxy IPv4 addresses" msgstr "全局代理 IPv4 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1485 -msgid "Global proxy IPv6 IP-s" +msgid "Global proxy IPv6 addresses" msgstr "全局代理 IPv6 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1488 -msgid "Global proxy MAC-s" +msgid "Global proxy MAC addresses" msgstr "全局代理 MAC 地址" #: htdocs/luci-static/resources/view/homeproxy/server.js:146 @@ -1026,9 +1018,9 @@ msgstr "HTTP/3" #: htdocs/luci-static/resources/view/homeproxy/server.js:332 msgid "" -"HTTP3 server behavior when authentication fails.
A 404 page will be " +"HTTP/3 server behavior when authentication fails.
A 404 page will be " "returned if empty." -msgstr "身份验证失败时的 HTTP3 服务器响应。默认返回 404 页面。" +msgstr "身份验证失败时的 HTTP/3 服务器响应。留空时返回 404 页面。" #: htdocs/luci-static/resources/view/homeproxy/client.js:979 msgid "HTTPS" @@ -1072,11 +1064,11 @@ msgstr "HomeProxy 服务端" #: htdocs/luci-static/resources/view/homeproxy/node.js:956 msgid "Hop interval" -msgstr "跳跃间隔" +msgstr "端口跳跃间隔" #: htdocs/luci-static/resources/view/homeproxy/node.js:950 msgid "Hopping port" -msgstr "跳跃端口" +msgstr "端口跳跃" #: htdocs/luci-static/resources/view/homeproxy/node.js:1247 #: htdocs/luci-static/resources/view/homeproxy/node.js:1252 @@ -1261,8 +1253,8 @@ msgid "Info" msgstr "信息" #: htdocs/luci-static/resources/view/homeproxy/client.js:1434 -msgid "Interface Control" -msgstr "接口控制" +msgid "Interface control" +msgstr "接口管控" #: htdocs/luci-static/resources/view/homeproxy/client.js:588 msgid "Interrupt existing connections" @@ -1300,7 +1292,7 @@ msgstr "反转" #: htdocs/luci-static/resources/view/homeproxy/client.js:694 #: htdocs/luci-static/resources/view/homeproxy/client.js:1171 msgid "Invert match result." -msgstr "反转匹配结果" +msgstr "反转匹配结果。" #: htdocs/luci-static/resources/view/homeproxy/status.js:37 msgid "JD" @@ -1308,7 +1300,7 @@ msgstr "京东" #: htdocs/luci-static/resources/view/homeproxy/server.js:775 msgid "Key path" -msgstr "证书路径" +msgstr "密钥路径" #: htdocs/luci-static/resources/view/homeproxy/client.js:1448 msgid "LAN IP Policy" @@ -1364,7 +1356,7 @@ msgstr "要测试的节点列表。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1457 #: htdocs/luci-static/resources/view/homeproxy/server.js:566 msgid "List of supported application level protocols, in order of preference." -msgstr "支持的应用层协议协商列表,按顺序排列。" +msgstr "支持的应用层协议列表,按优先级排序。" #: htdocs/luci-static/resources/view/homeproxy/client.js:1256 msgid "List of text DNS record to respond as answers." @@ -1376,7 +1368,7 @@ msgstr "要响应的附加 DNS 记录列表。" #: htdocs/luci-static/resources/view/homeproxy/client.js:1261 msgid "List of text DNS record to respond as name servers." -msgstr "要响应的域名服务器(NS) DNS 记录列表。" +msgstr "作为域名服务器(NS)应答的 DNS 记录列表。" #: htdocs/luci-static/resources/view/homeproxy/server.js:193 msgid "Listen address" @@ -1626,7 +1618,7 @@ msgstr "混合" #: htdocs/luci-static/resources/view/homeproxy/client.js:361 msgid "Mixed system TCP stack and gVisor UDP stack." -msgstr "混合系统 TCP 栈和 gVisor UDP 栈。" +msgstr "混合 system TCP 栈和 gVisor UDP 栈。" #: htdocs/luci-static/resources/view/homeproxy/client.js:623 #: htdocs/luci-static/resources/view/homeproxy/client.js:1103 @@ -1687,7 +1679,7 @@ msgstr "New Reno" #: htdocs/luci-static/resources/view/homeproxy/server.js:400 #: htdocs/luci-static/resources/view/homeproxy/server.js:417 msgid "No TCP transport, plain HTTP is merged into the HTTP transport." -msgstr "无 TCP 传输层, 纯 HTTP 已合并到 HTTP 传输层。" +msgstr "无 TCP 传输层,纯 HTTP 已合并到 HTTP 传输层。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1210 #: htdocs/luci-static/resources/view/homeproxy/server.js:415 @@ -1720,8 +1712,11 @@ msgid "Nodes" msgstr "节点" #: htdocs/luci-static/resources/view/homeproxy/client.js:1022 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1052 #: htdocs/luci-static/resources/view/homeproxy/node.js:1158 #: htdocs/luci-static/resources/view/homeproxy/node.js:1196 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1308 +#: htdocs/luci-static/resources/view/homeproxy/node.js:1821 #: htdocs/luci-static/resources/view/homeproxy/server.js:386 #: htdocs/luci-static/resources/view/homeproxy/server.js:401 msgid "None" @@ -1813,7 +1808,7 @@ msgid "Path" msgstr "路径" #: htdocs/luci-static/resources/view/homeproxy/node.js:1332 -msgid "Peer pubkic key" +msgid "Peer public key" msgstr "对端公钥" #: htdocs/luci-static/resources/view/homeproxy/node.js:1357 @@ -1841,7 +1836,7 @@ msgid "Port" msgstr "端口" #: htdocs/luci-static/resources/view/homeproxy/client.js:316 -msgid "Port %s alrealy exists!" +msgid "Port %s already exists!" msgstr "端口 %s 已存在!" #: htdocs/luci-static/resources/view/homeproxy/client.js:610 @@ -1876,12 +1871,13 @@ msgstr "优先 IPv6" #: htdocs/luci-static/resources/view/homeproxy/node.js:1099 #: htdocs/luci-static/resources/view/homeproxy/node.js:1324 +#: htdocs/luci-static/resources/view/homeproxy/server.js:791 msgid "Private key" msgstr "私钥" #: htdocs/luci-static/resources/view/homeproxy/node.js:1104 msgid "Private key passphrase" -msgstr "私钥指纹" +msgstr "私钥口令" #: htdocs/luci-static/resources/view/homeproxy/node.js:484 msgid "Probe failed" @@ -1923,7 +1919,7 @@ msgstr "协议参数。启用长度块加密。" msgid "" "Protocol parameter. Will waste traffic randomly if enabled (enabled by " "default in v2ray and cannot be disabled)." -msgstr "协议参数。 如启用会随机浪费流量(在 v2ray 中默认启用并且无法禁用)。" +msgstr "协议参数。如启用会随机浪费流量(在 v2ray 中默认启用并且无法禁用)。" #: htdocs/luci-static/resources/view/homeproxy/client.js:1511 msgid "Proxy Domain List" @@ -1931,16 +1927,16 @@ msgstr "代理域名列表" #: htdocs/luci-static/resources/view/homeproxy/client.js:1466 #: htdocs/luci-static/resources/view/homeproxy/client.js:1495 -msgid "Proxy IPv4 IP-s" +msgid "Proxy IPv4 addresses" msgstr "代理 IPv4 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1469 #: htdocs/luci-static/resources/view/homeproxy/client.js:1498 -msgid "Proxy IPv6 IP-s" +msgid "Proxy IPv6 addresses" msgstr "代理 IPv6 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1472 -msgid "Proxy MAC-s" +msgid "Proxy MAC addresses" msgstr "代理 MAC 地址" #: htdocs/luci-static/resources/view/homeproxy/client.js:1453 @@ -1993,7 +1989,7 @@ msgstr "Quad9 公共DNS (DoH)" #: htdocs/luci-static/resources/view/homeproxy/client.js:1123 msgid "Query type" -msgstr "请求类型" +msgstr "查询类型" #: htdocs/luci-static/resources/view/homeproxy/client.js:1243 msgid "RCode" @@ -2183,7 +2179,7 @@ msgstr "规则集" #: htdocs/luci-static/resources/view/homeproxy/client.js:689 #: htdocs/luci-static/resources/view/homeproxy/client.js:1162 msgid "Rule set IP CIDR as source IP" -msgstr "规则集 IP CIDR 作为源 IP" +msgstr "将规则集 IP CIDR 作为源 IP" #: htdocs/luci-static/resources/view/homeproxy/client.js:1381 msgid "Rule set URL" @@ -2235,6 +2231,7 @@ msgstr "保存订阅设置" msgid "Server" msgstr "服务器" +#: htdocs/luci-static/resources/view/homeproxy/server.js:151 #: root/usr/share/luci/menu.d/luci-app-homeproxy.json:30 msgid "Server Settings" msgstr "服务器设置" @@ -2245,10 +2242,6 @@ msgid "" "ServerName field is empty." msgstr "当 ClientHello 的 ServerName 字段为空时,选择证书所使用的服务器名称。" -#: htdocs/luci-static/resources/view/homeproxy/server.js:151 -msgid "Server settings" -msgstr "服务器设置" - #: root/usr/share/luci/menu.d/luci-app-homeproxy.json:38 msgid "Service Status" msgstr "服务状态" @@ -2393,7 +2386,7 @@ msgid "Sub (%s)" msgstr "订阅(%s)" #: htdocs/luci-static/resources/view/homeproxy/node.js:1780 -msgid "Subscription URL-s" +msgid "Subscription URLs" msgstr "订阅地址" #: htdocs/luci-static/resources/view/homeproxy/node.js:1757 @@ -2401,6 +2394,7 @@ msgid "Subscriptions" msgstr "订阅" #: htdocs/luci-static/resources/view/homeproxy/node.js:500 +#: htdocs/luci-static/resources/view/homeproxy/status.js:92 msgid "Success" msgstr "成功" @@ -2576,7 +2570,7 @@ msgstr "使用的 ACME CA 颁发机构。" #: htdocs/luci-static/resources/view/homeproxy/client.js:906 msgid "The DNS strategy for resolving the domain name in the address." -msgstr "解析域名的默认策略。" +msgstr "用于解析地址中域名的 DNS 策略。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1021 #: htdocs/luci-static/resources/view/homeproxy/server.js:308 @@ -2602,14 +2596,14 @@ msgid "" "port will be used instead of 80 to spin up a listener for the HTTP challenge." msgstr "" "用于 ACME HTTP 质询的备用端口;如果非空,将使用此端口而不是 80 来启动 HTTP 质" -"询的侦听器。" +"询的监听器。" #: htdocs/luci-static/resources/view/homeproxy/server.js:685 msgid "" "The alternate port to use for the ACME TLS-ALPN challenge; the system must " "forward 443 to this port for challenge to succeed." msgstr "" -"用于 ACME TLS-ALPN 质询的备用端口; 系统必须将 443 转发到此端口以使质询成功。" +"用于 ACME TLS-ALPN 质询的备用端口;系统必须将 443 转发到此端口以使质询成功。" #: htdocs/luci-static/resources/view/homeproxy/client.js:624 msgid "" @@ -2651,7 +2645,7 @@ msgstr "用于解析国内域名的 DNS 服务器。支持 UDP、TCP、DoH、DoQ #: htdocs/luci-static/resources/view/homeproxy/client.js:475 #: htdocs/luci-static/resources/view/homeproxy/client.js:1049 msgid "The domain strategy for resolving the domain name in the address." -msgstr "用于解析本 DNS 服务器的域名的策略。" +msgstr "用于解析 DNS 服务器地址中域名的策略。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1486 #: htdocs/luci-static/resources/view/homeproxy/server.js:587 @@ -2664,7 +2658,7 @@ msgstr "将在 ECDHE 握手中使用的椭圆曲线,按优先顺序排列。 msgid "" "The email address to use when creating or selecting an existing ACME server " "account." -msgstr "创建或选择现有 ACME 服务器帐户时使用的电子邮件地址。" +msgstr "创建或选择现有 ACME 服务器账户时使用的电子邮件地址。" #: htdocs/luci-static/resources/view/homeproxy/client.js:771 msgid "" @@ -2781,7 +2775,7 @@ msgid "" "This is the TUIC port of the UDP over TCP protocol, designed to provide a " "QUIC stream based UDP relay mode that TUIC does not provide." msgstr "" -"这是 TUIC 的 UDP over TCP 协议移植, 旨在提供 TUIC 不提供的基于 QUIC 流的 " +"这是 TUIC 的 UDP over TCP 协议端口,旨在提供 TUIC 原本不支持的基于 QUIC 流的 " "UDP 中继模式。" #: htdocs/luci-static/resources/view/homeproxy/client.js:261 @@ -2798,9 +2792,9 @@ msgstr "超时" #: htdocs/luci-static/resources/view/homeproxy/client.js:751 msgid "" -"Timeout for UDP connections.
Setting a larger value than the UDP timeout " -"in inbounds will have no effect." -msgstr "UDP 连接的超时时间。
设置比入站的 UDP 超时更大的值将无效。" +"Timeout for UDP connections.
Setting a larger value than the inbound UDP " +"timeout will have no effect." +msgstr "UDP 连接超时时间。
设置大于入站 UDP 超时的值不会生效。" #: htdocs/luci-static/resources/view/homeproxy/client.js:946 msgid "" @@ -3077,8 +3071,8 @@ msgstr "WireGuard 要求 base64 编码的私钥。" #: htdocs/luci-static/resources/view/homeproxy/node.js:1310 #: htdocs/luci-static/resources/view/homeproxy/node.js:1823 -msgid "Xudp (Xray-core)" -msgstr "Xudp (Xray-core)" +msgid "XUDP (Xray-core)" +msgstr "XUDP (Xray-core)" #: htdocs/luci-static/resources/view/homeproxy/status.js:40 msgid "YouTube" @@ -3101,13 +3095,6 @@ msgstr "证书" msgid "connect UDP connections" msgstr "主动连接 UDP" -#: htdocs/luci-static/resources/view/homeproxy/node.js:1471 -#: htdocs/luci-static/resources/view/homeproxy/node.js:1479 -#: htdocs/luci-static/resources/view/homeproxy/server.js:572 -#: htdocs/luci-static/resources/view/homeproxy/server.js:580 -msgid "default" -msgstr "默认" - #: htdocs/luci-static/resources/view/homeproxy/node.js:1197 #: htdocs/luci-static/resources/view/homeproxy/server.js:402 msgid "gRPC" @@ -3138,21 +3125,11 @@ msgstr "gVisor" msgid "non-empty value" msgstr "非空值" -#: htdocs/luci-static/resources/view/homeproxy/node.js:1052 -#: htdocs/luci-static/resources/view/homeproxy/node.js:1308 -#: htdocs/luci-static/resources/view/homeproxy/node.js:1821 -msgid "none" -msgstr "无" - #: htdocs/luci-static/resources/view/homeproxy/node.js:1309 #: htdocs/luci-static/resources/view/homeproxy/node.js:1822 msgid "packet addr (v2ray-core v5+)" msgstr "packet addr (v2ray-core v5+)" -#: htdocs/luci-static/resources/view/homeproxy/server.js:791 -msgid "private key" -msgstr "私钥" - #: htdocs/luci-static/resources/view/homeproxy/client.js:659 msgid "quic-go / uquic chrome" msgstr "quic-go / uquic chrome" @@ -3179,11 +3156,11 @@ msgstr "" #: htdocs/luci-static/resources/homeproxy.js:237 #: htdocs/luci-static/resources/view/homeproxy/node.js:1726 msgid "unique UCI identifier" -msgstr "独立 UCI 标识" +msgstr "唯一 UCI 标识符" #: htdocs/luci-static/resources/homeproxy.js:317 msgid "unique value" -msgstr "独立值" +msgstr "唯一值" #: htdocs/luci-static/resources/view/homeproxy/node.js:1066 #: htdocs/luci-static/resources/view/homeproxy/node.js:1599 @@ -3215,6 +3192,10 @@ msgstr "有效 DNS 服务器地址" msgid "valid URL" msgstr "有效网址" +#: htdocs/luci-static/resources/homeproxy.js:328 +msgid "valid UUID" +msgstr "有效 UUID" + #: htdocs/luci-static/resources/homeproxy.js:271 msgid "valid base64 key with %d characters" msgstr "包含 %d 个字符的有效 base64 密钥" @@ -3231,7 +3212,3 @@ msgstr "有效端口范围(port1:port2)" #: htdocs/luci-static/resources/view/homeproxy/client.js:314 msgid "valid port value" msgstr "有效端口值" - -#: htdocs/luci-static/resources/homeproxy.js:328 -msgid "valid uuid" -msgstr "有效 uuid" diff --git a/homeproxy/root/etc/homeproxy/scripts/update_subscriptions.uc b/homeproxy/root/etc/homeproxy/scripts/update_subscriptions.uc index 2b724199..fd35dcfa 100755 --- a/homeproxy/root/etc/homeproxy/scripts/update_subscriptions.uc +++ b/homeproxy/root/etc/homeproxy/scripts/update_subscriptions.uc @@ -773,10 +773,10 @@ function parse_uri(uri) { /* Unsupported protocol */ if (params.type === 'kcp') { - log(sprintf('Skipping sunsupported %s node: %s.', uri[0], urldecode(url.hash) || url.hostname)); + log(sprintf('Skipping unsupported %s node: %s.', uri[0], urldecode(url.hash) || url.hostname)); return null; } else if (params.type === 'quic' && ((params.quicSecurity && params.quicSecurity !== 'none') || !sing_features.with_quic)) { - log(sprintf('Skipping sunsupported %s node: %s.', uri[0], urldecode(url.hash) || url.hostname)); + log(sprintf('Skipping unsupported %s node: %s.', uri[0], urldecode(url.hash) || url.hostname)); if (!sing_features.with_quic) log(sprintf('Please rebuild sing-box with %s support!', 'QUIC')); diff --git a/homeproxy/root/usr/share/rpcd/ucode/luci.homeproxy b/homeproxy/root/usr/share/rpcd/ucode/luci.homeproxy index df698721..731ebd95 100644 --- a/homeproxy/root/usr/share/rpcd/ucode/luci.homeproxy +++ b/homeproxy/root/usr/share/rpcd/ucode/luci.homeproxy @@ -169,7 +169,7 @@ const methods = { push(commands, sprintf( '/usr/bin/curl --location --silent --output /dev/null --user-agent %s --connect-timeout 5 --max-time 9 --write-out %s %s', shellquote('Mozilla/5.0'), - shellquote(sprintf('%s\\t%%{http_code}\\t%%{time_total}\\n', site)), + shellquote(sprintf('%s\\t%%{http_code}\\t%%{time_appconnect}\\t%%{time_total}\\n', site)), shellquote(CONNECTION_SITES[site]) )); } @@ -188,20 +188,25 @@ const methods = { fd.close(); const responses = {}; + const curlTimeMs = (value) => { + const parts = split(value || '0', '.'); + const fraction = ((parts[1] || '') + '000'); + return int(parts[0] || '0') * 1000 + int(substr(fraction, 0, 3)); + }; + for (let response in split(trim(payload), /[\r\n]+/)) { const fields = split(response, '\t'); - if (length(fields) !== 3 || !CONNECTION_SITES[fields[0]]) + if (length(fields) !== 4 || !CONNECTION_SITES[fields[0]]) continue; - const time_parts = split(fields[2], '.'); - const fraction = ((time_parts[1] || '') + '000'); - const latency_ms = int(time_parts[0] || '0') * 1000 + int(substr(fraction, 0, 3)); + const latency_ms = curlTimeMs(fields[2]); + const total_ms = curlTimeMs(fields[3]); const http_code = int(fields[1] || '0'); responses[fields[0]] = { site: fields[0], result: http_code >= 100 && http_code <= 599, latency_ms, - timed_out: http_code === 0 && latency_ms >= 8900 + timed_out: http_code === 0 && total_ms >= 8900 }; } diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua index ebd69699..d6ba203b 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua @@ -107,6 +107,7 @@ function index() for _, com in ipairs(coms.order) do entry({"admin", "services", appname, "check_" .. com}, call("com_check", com)).leaf = true entry({"admin", "services", appname, "update_" .. com}, call("com_update", com)).leaf = true + entry({"admin", "services", appname, "version_" .. com}, call("com_version", com)).leaf = true end --[[Backup]] @@ -804,6 +805,11 @@ function com_update(comname) http_write_json(json) end +function com_version(comname) + local version = api.get_app_version(comname) + http_write_json_ok(version) +end + function read_rulelist() local rule_type = http.formvalue("type") local rule_path diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/app_update.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/app_update.lua index 9106571e..5f573a9e 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/app_update.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/app_update.lua @@ -1,22 +1,24 @@ local api = require "luci.passwall.api" +local com = require "luci.passwall.com" local appname = "passwall" m = Map(appname) api.set_apply_on_parse(m) -- [[ App Settings ]]-- -s = m:section(TypedSection, "global_app", translate("App Update"), - "" .. - translate("Please confirm that your firmware supports FPU.") .. - "") +s = m:section(TypedSection, "global_app", translate("App Update")) s.anonymous = true -s:append(Template(appname .. "/app_update/app_version")) + +local app_version = Template(appname .. "/app_update/app_version") +app_version.api = api +app_version.config = m.config +app_version.com = com +s:append(app_version) o = s:option(Flag, "github_proxy", translate("GitHub Proxy"), translate("Use gh-proxy instead of proxy nodes for component updates.")) o.default = 0 local k, v -local com = require "luci.passwall.com" for _, k in ipairs(com.order) do v = com[k] if k ~= "chinadns-ng" then diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua index 66dad750..e3d2c44c 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe_config.lua @@ -229,13 +229,8 @@ end o = s:option(Flag, "boot_update", translate("Update Once on Boot"), translate("Updates the subscription the first time PassWall runs automatically after each system boot.")) o.default = 0 ----- Enable auto update subscribe -o = s:option(Flag, "auto_update", translate("Enable auto update subscribe")) -o.default = 0 -o.rmempty = false - ----- Week Update -o = s:option(ListValue, "week_update", translate("Update Mode")) +o = s:option(ListValue, "update_week_mode", translate("Auto Update Mode")) +o:value("", translate("Disable")) o:value(8, translate("Loop Mode")) o:value(7, translate("Every day")) o:value(1, translate("Every Monday")) @@ -245,29 +240,30 @@ o:value(4, translate("Every Thursday")) o:value(5, translate("Every Friday")) o:value(6, translate("Every Saturday")) o:value(0, translate("Every Sunday")) -o.default = 7 -o:depends("auto_update", true) -o.rmempty = true ----- Time Update -o = s:option(ListValue, "time_update", translate("Update Time(every day)")) -for t = 0, 23 do o:value(t, t .. ":00") end -o.default = 0 -o:depends("week_update", "0") -o:depends("week_update", "1") -o:depends("week_update", "2") -o:depends("week_update", "3") -o:depends("week_update", "4") -o:depends("week_update", "5") -o:depends("week_update", "6") -o:depends("week_update", "7") -o.rmempty = true +o = s:option(Value, "update_time_mode", translate("Update Time")) +for t = 0, 23 do o:value(t .. ":00") end +o.default = "0:00" +o.validate = function(self, value) + local b = api.is_timehhmm(value) + if b then + return value + end + return nil +end +o:depends("update_week_mode", "0") +o:depends("update_week_mode", "1") +o:depends("update_week_mode", "2") +o:depends("update_week_mode", "3") +o:depends("update_week_mode", "4") +o:depends("update_week_mode", "5") +o:depends("update_week_mode", "6") +o:depends("update_week_mode", "7") ----- Interval Update -o = s:option(ListValue, "interval_update", translate("Update Interval(hour)")) +o = s:option(ListValue, "update_interval_mode", translate("Update Interval(hour)")) for t = 1, 24 do o:value(t, t .. " " .. translate("hour")) end o.default = 2 -o:depends("week_update", "8") +o:depends("update_week_mode", "8") o.rmempty = true o = s:option(ListValue, "access_mode", translate("Subscribe URL Access Method")) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index 9201d76c..2f53c6ae 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -29,7 +29,9 @@ o.rmempty = true for index, value in ipairs({"stop", "start", "restart"}) do o = s:option(ListValue, value .. "_week_mode", translate(value .. " automatically mode")) o:value("", translate("Disable")) - o:value(8, translate("Loop Mode")) + if value == "restart" then + o:value(8, translate("Loop Mode")) + end o:value(7, translate("Every day")) o:value(1, translate("Every Monday")) o:value(2, translate("Every Tuesday")) @@ -38,9 +40,16 @@ for index, value in ipairs({"stop", "start", "restart"}) do o:value(5, translate("Every Friday")) o:value(6, translate("Every Saturday")) o:value(0, translate("Every Sunday")) - o = s:option(ListValue, value .. "_time_mode", translate(value .. " Time(Every day)")) - for t = 0, 23 do o:value(t, t .. ":00") end - o.default = 0 + o = s:option(Value, value .. "_time_mode", translate(value .. " Time")) + for t = 0, 23 do o:value(t .. ":00") end + o.default = "0:00" + o.validate = function(self, value) + local b = api.is_timehhmm(value) + if b then + return value + end + return nil + end o:depends(value .. "_week_mode", "0") o:depends(value .. "_week_mode", "1") o:depends(value .. "_week_mode", "2") diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua index fa5d6d87..c6e12ed8 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua @@ -97,13 +97,8 @@ if has_xray or has_singbox then end end ----- Auto Update -o = s:option(Flag, "auto_update", translate("Enable auto update rules")) -o.default = 0 -o.rmempty = false - ----- Week Update -o = s:option(ListValue, "week_update", translate("Update Mode")) +o = s:option(ListValue, "update_week_mode", translate("Auto Update Mode")) +o:value("", translate("Disable")) o:value(8, translate("Loop Mode")) o:value(7, translate("Every day")) o:value(1, translate("Every Monday")) @@ -113,29 +108,30 @@ o:value(4, translate("Every Thursday")) o:value(5, translate("Every Friday")) o:value(6, translate("Every Saturday")) o:value(0, translate("Every Sunday")) -o.default = 7 -o:depends("auto_update", true) -o.rmempty = true ----- Time Update -o = s:option(ListValue, "time_update", translate("Update Time(every day)")) -for t = 0, 23 do o:value(t, t .. ":00") end -o.default = 0 -o:depends("week_update", "0") -o:depends("week_update", "1") -o:depends("week_update", "2") -o:depends("week_update", "3") -o:depends("week_update", "4") -o:depends("week_update", "5") -o:depends("week_update", "6") -o:depends("week_update", "7") -o.rmempty = true +o = s:option(Value, "update_time_mode", translate("Update Time")) +for t = 0, 23 do o:value(t .. ":00") end +o.default = "0:00" +o.validate = function(self, value) + local b = api.is_timehhmm(value) + if b then + return value + end + return nil +end +o:depends("update_week_mode", "0") +o:depends("update_week_mode", "1") +o:depends("update_week_mode", "2") +o:depends("update_week_mode", "3") +o:depends("update_week_mode", "4") +o:depends("update_week_mode", "5") +o:depends("update_week_mode", "6") +o:depends("update_week_mode", "7") ----- Interval Update -o = s:option(ListValue, "interval_update", translate("Update Interval(hour)")) +o = s:option(ListValue, "update_interval_mode", translate("Update Interval(hour)")) for t = 1, 24 do o:value(t, t .. " " .. translate("hour")) end o.default = 2 -o:depends("week_update", "8") +o:depends("update_week_mode", "8") o.rmempty = true ---- 更新选项,始终被js隐藏 diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index f7cfe474..dda5e4dd 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -152,7 +152,9 @@ if load_balancing_options then -- [[ Load balancing Start ]] o:depends({ [_n("node_add_mode")] = "batch" }) local descrStr = "Example: ^A && B && !C && D$
" descrStr = descrStr .. "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" - descrStr = descrStr .. "Conditions are joined by &&, and their order does not affect the result." + descrStr = descrStr .. "Conditions are joined by && (AND), and their order does not affect the result.
" + descrStr = descrStr .. "Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" + descrStr = descrStr .. "Example: A && B || C && D means (A AND B) OR (C AND D)." o.description = translate(descrStr) .. string.format("
%s", translate("Keep the match scope small. Too many nodes can impact router performance.")) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index 5284791c..f60f4151 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -151,7 +151,9 @@ if load_urltest_options then -- [[ URLTest Start ]] o:depends({ [_n("node_add_mode")] = "batch" }) local descrStr = "Example: ^A && B && !C && D$
" descrStr = descrStr .. "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" - descrStr = descrStr .. "Conditions are joined by &&, and their order does not affect the result." + descrStr = descrStr .. "Conditions are joined by && (AND), and their order does not affect the result.
" + descrStr = descrStr .. "Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" + descrStr = descrStr .. "Example: A && B || C && D means (A AND B) OR (C AND D)." o.description = translate(descrStr) .. string.format("
%s", translate("Keep the match scope small. Too many nodes can impact router performance.")) diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index 0d3d616e..2e8e8290 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -348,6 +348,18 @@ function strToTable(str) return loadstring("return " .. str)() end +function is_timehhmm(timeStr) + local hour, minute = string.match(timeStr, "^(%d?%d):(%d%d)$") + if hour and minute then + hour = tonumber(hour) + minute = tonumber(minute) + if hour >= 0 and hour <= 23 and minute >= 0 and minute <= 59 then + return true + end + end + return false +end + function is_normal_node(e) if e and e.type and e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt" or e.protocol == "_iface" or e.protocol == "_urltest") then return false @@ -1522,11 +1534,22 @@ end function match_node_rule(name, rule) if not name then return false end if not rule or rule == "" then return true end + -- split rule by || into OR groups + local function split_or(expr) + local t = {} + for part in expr:gmatch("[^|]+") do + part = trim(part) + if part ~= "" then + table.insert(t, part) + end + end + return t + end -- split rule by && local function split_and(expr) local t = {} for part in expr:gmatch("[^&]+") do - part = part:gsub("^%s+", ""):gsub("%s+$", "") + part = trim(part) if part ~= "" then table.insert(t, part) end @@ -1557,13 +1580,22 @@ function match_node_rule(name, rule) -- contains return str:find(cond, 1, true) ~= nil end - -- AND logic - for _, cond in ipairs(split_and(rule)) do - if not match_cond(name, cond) then - return false + -- check if all conditions in AND group match + local function match_and_group(str, group_expr) + for _, cond in ipairs(split_and(group_expr)) do + if not match_cond(str, cond) then + return false + end + end + return true + end + -- OR logic: return true if any group matches + for _, group in ipairs(split_or(rule)) do + if match_and_group(name, group) then + return true end end - return true + return false end function get_core(field, candidates) diff --git a/luci-app-passwall/luasrc/view/passwall/app_update/app_version.htm b/luci-app-passwall/luasrc/view/passwall/app_update/app_version.htm index cda606e7..54f34859 100644 --- a/luci-app-passwall/luasrc/view/passwall/app_update/app_version.htm +++ b/luci-app-passwall/luasrc/view/passwall/app_update/app_version.htm @@ -1,7 +1,7 @@ +
<% -local api = require "luci.passwall.api" -local com = require "luci.passwall.com" -local version = {} +local api = self.api +local com = self.com -%> +
diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po index 62890676..e2780e3a 100644 --- a/luci-app-passwall/po/zh-cn/passwall.po +++ b/luci-app-passwall/po/zh-cn/passwall.po @@ -490,11 +490,15 @@ msgstr "节点匹配规则" msgid "" "Example: ^A && B && !C && D$
" "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" -"Conditions are joined by &&, and their order does not affect the result." +"Conditions are joined by && (AND), and their order does not affect the result.
" +"Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" +"Example: A && B || C && D means (A AND B) OR (C AND D)." msgstr "" "示例:^A && B && !C && D$
" "表示节点备注需同时满足:以 A 开头(^)、包含 B、不包含 C(!)、并以 D 结尾($)。
" -"多个条件使用 && 连接,条件顺序不影响结果。" +"多个条件使用 &&(与)连接,条件顺序不影响结果。
" +"多组条件之间可使用 ||(或)分隔,任意一组匹配即视为成功。
" +"示例:A && B || C && D 表示 (A 且 B) 或 (C 且 D)。" msgid "Keep the match scope small. Too many nodes can impact router performance." msgstr "建议尽量缩小匹配范围,节点过多会增加路由器负载。" @@ -781,8 +785,8 @@ msgstr "单位:分钟" msgid "stop automatically mode" msgstr "定时关闭模式" -msgid "stop Time(Every day)" -msgstr "关闭时间(每天)" +msgid "stop Time" +msgstr "关闭时间" msgid "stop Interval(Hour)" msgstr "关闭间隔(小时)" @@ -790,8 +794,8 @@ msgstr "关闭间隔(小时)" msgid "start automatically mode" msgstr "定时开启模式" -msgid "start Time(Every day)" -msgstr "开启时间(每天)" +msgid "start Time" +msgstr "开启时间" msgid "start Interval(Hour)" msgstr "开启间隔(小时)" @@ -799,8 +803,8 @@ msgstr "开启间隔(小时)" msgid "restart automatically mode" msgstr "定时重启模式" -msgid "restart Time(Every day)" -msgstr "重启时间(每天)" +msgid "restart Time" +msgstr "重启时间" msgid "restart Interval(Hour)" msgstr "重启间隔(小时)" @@ -1015,17 +1019,14 @@ msgstr "中国域名列表(Chnlist)更新URL" msgid "Rule status" msgstr "规则版本" -msgid "Enable auto update rules" -msgstr "开启自动更新规则" - -msgid "Update Time(every day)" -msgstr "更新时间(每天)" +msgid "Update Time" +msgstr "更新时间" msgid "Update Interval(hour)" msgstr "更新间隔(小时)" -msgid "Update Mode" -msgstr "更新模式" +msgid "Auto Update Mode" +msgstr "自动更新模式" msgid "Loop Mode" msgstr "循环" @@ -1135,9 +1136,6 @@ msgstr "移动中" msgid "App Update" msgstr "组件更新" -msgid "Please confirm that your firmware supports FPU." -msgstr "请确认你的固件支持 FPU。" - msgid "if you want to run from memory, change the path, /tmp beginning then save the application and update it manually." msgstr "如果你希望从内存中运行,请更改路径,/tmp 开头,然后保存应用后,再手动更新。" diff --git a/luci-app-passwall/root/usr/share/passwall/0_default_config b/luci-app-passwall/root/usr/share/passwall/0_default_config index 4c532d72..3dd9379e 100644 --- a/luci-app-passwall/root/usr/share/passwall/0_default_config +++ b/luci-app-passwall/root/usr/share/passwall/0_default_config @@ -55,7 +55,6 @@ config global_other option show_node_info '0' config global_rules - option auto_update '0' option chnlist_update '1' option chnroute_update '1' option chnroute6_update '1' diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index 1097200d..b49ab252 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -74,7 +74,7 @@ check_run_environment() { run_ipt2socks() { local flag proto tcp_tproxy local_port socks_address socks_port socks_username socks_password log_file local _extra_param="" - eval_set_val $@ + eval_set_val "$@" [ -n "$log_file" ] || log_file="/dev/null" socks_address=$(get_host_ip "ipv4" ${socks_address}) [ -n "$socks_username" ] && [ -n "$socks_password" ] && _extra_param="${_extra_param} -a $socks_username -k $socks_password" @@ -100,7 +100,7 @@ run_singbox() { local flag type node tcp_redir_port tcp_proxy_way udp_redir_port socks_address socks_port socks_username socks_password http_address http_port http_username http_password local dns_listen_port direct_dns_query_strategy direct_dns_port direct_dns_udp_server direct_dns_tcp_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port local loglevel log_file config_file server_host server_port no_run - eval_set_val $@ + eval_set_val "$@" [ -z "$type" ] && { type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z') [ "$type" != "sing-box" ] && [ -n "$SINGBOX_BIN" ] && type="sing-box" @@ -198,7 +198,7 @@ run_xray() { local flag type node tcp_redir_port tcp_proxy_way udp_redir_port socks_address socks_port socks_username socks_password http_address http_port http_username http_password local dns_listen_port direct_dns_query_strategy direct_dns_port direct_dns_udp_server direct_dns_tcp_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port local loglevel log_file config_file server_host server_port no_run - eval_set_val $@ + eval_set_val "$@" [ -z "$type" ] && { type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z') [ "$type" != "xray" ] && [ -n "$XRAY_BIN" ] && type="xray" @@ -287,7 +287,7 @@ run_xray() { run_dns2socks() { local flag socks socks_address socks_port socks_username socks_password listen_address listen_port dns cache log_file local _extra_param="" - eval_set_val $@ + eval_set_val "$@" [ -n "$flag" ] && flag="_${flag}" [ -n "$log_file" ] || log_file="/dev/null" dns=$(get_first_dns dns 53 | sed 's/#/:/g') @@ -305,11 +305,11 @@ run_dns2socks() { run_chinadns_ng() { local _flag _listen_port _dns_local _dns_trust _no_ipv6_trust _use_direct_list _use_proxy_list _gfwlist _chnlist _default_mode _default_tag _no_logic_log _tcp_node _remote_fakedns _filter_https local _extra_param="" - eval_set_val $@ + eval_set_val "$@" local _CONF_FILE=$TMP_ACL_PATH/$_flag/chinadns_ng.conf local _LOG_FILE="/dev/null" - [ "$(config_t_get global log_chinadns_ng "0")" == "1" ] && _LOG_FILE=$TMP_ACL_PATH/$_flag/chinadns_ng.log + [ "$(config_t_get global log_chinadns_ng "0")" = "1" ] && _LOG_FILE=$TMP_ACL_PATH/$_flag/chinadns_ng.log _extra_param="-FLAG ${_flag} -TCP_NODE ${_tcp_node} -LISTEN_PORT ${_listen_port} -DNS_LOCAL ${_dns_local} -DNS_TRUST ${_dns_trust}" _extra_param="${_extra_param} -USE_DIRECT_LIST ${_use_direct_list} -USE_PROXY_LIST ${_use_proxy_list} -USE_BLOCK_LIST ${_use_block_list}" @@ -323,7 +323,7 @@ run_chinadns_ng() { run_socks() { local flag node bind socks_port config_file http_port http_config_file relay_port log_file no_run - eval_set_val $@ + eval_set_val "$@" [ -n "$config_file" ] && [ -z "$(echo ${config_file} | grep $TMP_PATH)" ] && config_file=$TMP_PATH/$config_file [ -n "$http_port" ] || http_port=0 [ -n "$http_config_file" ] && [ -z "$(echo ${http_config_file} | grep $TMP_PATH)" ] && http_config_file=$TMP_PATH/$http_config_file @@ -367,14 +367,14 @@ run_socks() { error_msg="某种原因,此 Socks 服务的相关配置已失联,启动中止!" fi - if [ "$type" == "sing-box" ] || [ "$type" == "xray" ]; then + if [ "$type" = "sing-box" ] || [ "$type" = "xray" ]; then local protocol=$(config_n_get $node protocol) - if [ "$protocol" == "_balancing" ] || [ "$protocol" == "_shunt" ] || [ "$protocol" == "_iface" ] || [ "$protocol" == "_urltest" ]; then + if [ "$protocol" = "_balancing" ] || [ "$protocol" = "_shunt" ] || [ "$protocol" = "_iface" ] || [ "$protocol" = "_urltest" ]; then unset error_msg fi fi - if [ -n "${error_msg}" ] && ([ -n "$(config_n_get $node hysteria_hop)" ] || [ -n "$(config_n_get $node hysteria2_hop)" ] || [ "$(config_n_get $node hysteria2_realms)" = "1" ]); then + if [ -n "${error_msg}" ] && { [ -n "$(config_n_get $node hysteria_hop)" ] || [ -n "$(config_n_get $node hysteria2_hop)" ] || [ "$(config_n_get $node hysteria2_realms)" = "1" ]; }; then unset error_msg fi @@ -527,7 +527,7 @@ run_socks() { run_redir() { local node proto bind local_port config_file log_file - eval_set_val $@ + eval_set_val "$@" local tcp_node_socks_flag tcp_node_http_flag [ -n "$config_file" ] && [ -z "$(echo ${config_file} | grep $TMP_PATH)" ] && config_file=${GLOBAL_ACL_PATH}/${config_file} if [ -n "$log_file" ] && [ -z "$(echo ${log_file} | grep $TMP_PATH)" ]; then @@ -644,7 +644,7 @@ run_redir() { tcp_node_socks_port=$(get_new_port $(config_t_get global tcp_node_socks_port 1070)) tcp_node_http_port=$(config_t_get global tcp_node_http_port 0) [ "$tcp_node_http_port" != "0" ] && tcp_node_http=1 - if [ $PROXY_IPV6 == "1" ]; then + if [ $PROXY_IPV6 = "1" ]; then echolog "开启实验性IPv6透明代理(TProxy),请确认您的节点及类型支持IPv6!" fi @@ -725,7 +725,7 @@ run_redir() { DNSMASQ_FILTER_PROXY_IPV6=0 local _remote_dns_client_ip=$(config_t_get global remote_dns_client_ip) [ -n "${_remote_dns_client_ip}" ] && _args="${_args} remote_dns_client_ip=${_remote_dns_client_ip}" - [ "${DNS_CACHE}" == "0" ] && _args="${_args} dns_cache=0" + [ "${DNS_CACHE}" = "0" ] && _args="${_args} dns_cache=0" resolve_dns_port=${NEXT_DNS_LISTEN_PORT} _args="${_args} dns_listen_port=${resolve_dns_port}" @@ -811,7 +811,7 @@ run_redir() { DNSMASQ_FILTER_PROXY_IPV6=0 local _remote_dns_client_ip=$(config_t_get global remote_dns_client_ip) [ -n "${_remote_dns_client_ip}" ] && _args="${_args} remote_dns_client_ip=${_remote_dns_client_ip}" - [ "${DNS_CACHE}" == "0" ] && _args="${_args} dns_cache=0" + [ "${DNS_CACHE}" = "0" ] && _args="${_args} dns_cache=0" resolve_dns_port=${NEXT_DNS_LISTEN_PORT} _args="${_args} dns_listen_port=${resolve_dns_port}" @@ -984,7 +984,7 @@ start_socks() { echolog "分析 Socks 服务的节点配置..." for id in $ids; do local enabled=$(config_n_get $id enabled 0) - [ "$enabled" == "0" ] && continue + [ "$enabled" = "0" ] && continue local node=$(config_n_get $id node) [ -z "$node" ] && continue local bind_local=$(config_n_get $id bind_local 0) @@ -994,7 +994,7 @@ start_socks() { local config_file="SOCKS_${id}.json" local log_file="SOCKS_${id}.log" local log=$(config_n_get $id log 1) - [ "$log" == "0" ] && log_file="" + [ "$log" = "0" ] && log_file="" local http_port=$(config_n_get $id http_port 0) local http_config_file="HTTP2SOCKS_${id}.json" local enable_autoswitch=$(config_n_get $id enable_autoswitch 0) @@ -1012,7 +1012,7 @@ start_socks() { socks_node_switch() { local flag new_node - eval_set_val $@ + eval_set_val "$@" [ -n "$flag" ] && [ -n "$new_node" ] && { local prefix pf filename # 结束 SS 插件进程 @@ -1037,7 +1037,7 @@ socks_node_switch() { local config_file="SOCKS_${flag}.json" local log_file="SOCKS_${flag}.log" local log=$(config_n_get $flag log 1) - [ "$log" == "0" ] && log_file="" + [ "$log" = "0" ] && log_file="" local http_port=$(config_n_get $flag http_port 0) local http_config_file="HTTP2SOCKS_${flag}.json" LOG_FILE="/dev/null" @@ -1045,7 +1045,7 @@ socks_node_switch() { set_cache_var "socks_${flag}" "$new_node" local ENABLED_DEFAULT_ACL=$(get_cache_var "ENABLED_DEFAULT_ACL") local ENABLED_ACLS=$(get_cache_var "ENABLED_ACLS") - [ "$ENABLED_DEFAULT_ACL" != "1" -a "$ENABLED_ACLS" != "1" ] && return + [ "$ENABLED_DEFAULT_ACL" != "1" ] && [ "$ENABLED_ACLS" != "1" ] && return local USE_TABLES=$(get_cache_var "USE_TABLES") [ -n "$USE_TABLES" ] && source $APP_PATH/${USE_TABLES}.sh filter_direct_node_list } @@ -1086,19 +1086,29 @@ start_crontab() { build_time() { local w="$1" - local h="$2" - local expr="0 $h * * $w" - [ "$w" = "7" ] && expr="0 $h * * *" + local t="$2" + local h m + if echo "$t" | grep -q ':'; then + h="${t%%:*}" + m="${t##*:}" + else + h="$t" + m=0 + fi + h=$(printf '%d' "$h") + m=$(printf '%d' "$m") + local expr="$m $h * * $w" + [ "$w" = "7" ] && expr="$m $h * * *" echo "$expr" } add_service_cron() { local week="$1" - local hour="$2" + local time="$2" local action="$3" local logmsg="$4" [ -z "$week" ] && return - local svr_t=$(build_time "$week" "$hour") + local svr_t=$(build_time "$week" "$time") if [ "$week" = "8" ]; then update_loop=1 else @@ -1115,12 +1125,11 @@ start_crontab() { add_service_cron "$(config_t_get global_delay restart_week_mode)" "$(config_t_get global_delay restart_time_mode)" "restart" "配置定时任务:自动重启服务。" # ===== rule update ===== - local autoupdate=$(config_t_get global_rules auto_update) - local weekupdate=$(config_t_get global_rules week_update) - local dayupdate=$(config_t_get global_rules time_update) - if [ "$autoupdate" = "1" ]; then - local rule_t=$(build_time "$weekupdate" "$dayupdate") - if [ "$weekupdate" = "8" ]; then + local rules_update_week_mode=$(config_t_get global_rules update_week_mode) + local rules_update_time_mode=$(config_t_get global_rules update_time_mode) + if [ -n "$rules_update_week_mode" ]; then + local rule_t=$(build_time "$rules_update_week_mode" "$rules_update_time_mode") + if [ "$rules_update_week_mode" = "8" ]; then update_loop=1 else echo "$rule_t lua $APP_PATH/rule_update.lua log all cron > /dev/null 2>&1 &" >>/etc/crontabs/root @@ -1131,25 +1140,25 @@ start_crontab() { # ===== subscribe ===== local TMP_SUB_PATH=$TMP_PATH/sub_crontabs mkdir -p "$TMP_SUB_PATH" - local item cfgid remark week_update time_update + local item cfgid remark sub_update_week_mode sub_update_time_mode for item in $(uci show ${CONFIG} | grep "=subscribe_list" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do - if [ "$(config_n_get "$item" auto_update 0)" = "1" ]; then + sub_update_week_mode=$(config_n_get $item update_week_mode) + if [ -n "$sub_update_week_mode" ]; then cfgid=$(uci show ${CONFIG}.$item | head -n 1 | cut -d '.' -sf 2 | cut -d '=' -sf 1) remark=$(config_n_get "$item" remark) - week_update=$(config_n_get "$item" week_update) - time_update=$(config_n_get "$item" time_update) - echo "$cfgid" >> "$TMP_SUB_PATH/${week_update}_${time_update}" + sub_update_time_mode=$(config_n_get $item update_time_mode) + echo "$cfgid" >> "$TMP_SUB_PATH/${sub_update_week_mode}_${sub_update_time_mode}" echolog "配置定时任务:自动更新【$remark】订阅。" fi done if [ -d "$TMP_SUB_PATH" ]; then local name cfgids for name in $(ls "$TMP_SUB_PATH"); do - week_update=${name%_*} - time_update=${name#*_} + sub_update_week_mode=${name%_*} + sub_update_time_mode=${name#*_} cfgids=$(tr '\n' ',' < "$TMP_SUB_PATH/$name" | sed 's/,$//') - local sub_t=$(build_time "$week_update" "$time_update") - if [ "$week_update" = "8" ]; then + local sub_t=$(build_time "$sub_update_week_mode" "$sub_update_time_mode") + if [ "$sub_update_week_mode" = "8" ]; then update_loop=1 else echo "$sub_t lua $APP_PATH/subscribe.lua start $cfgids cron > /dev/null 2>&1 &" >>/etc/crontabs/root @@ -1253,7 +1262,7 @@ start_dns() { local log_file=$TMP_PATH/DNS.log local log_file=/dev/null local _args="type=$DNS_MODE config_file=$config_file log_file=$log_file" - [ "${DNS_CACHE}" == "0" ] && _args="${_args} dns_cache=0" + [ "${DNS_CACHE}" = "0" ] && _args="${_args} dns_cache=0" _args="${_args} direct_dns_query_strategy=${DIRECT_DNS_QUERY_STRATEGY}" _args="${_args} remote_dns_query_strategy=${REMOTE_DNS_QUERY_STRATEGY}" DNSMASQ_FILTER_PROXY_IPV6=0 @@ -1292,7 +1301,7 @@ start_dns() { local log_file=$TMP_PATH/DNS.log local log_file=/dev/null local _args="type=$DNS_MODE config_file=$config_file log_file=$log_file" - [ "${DNS_CACHE}" == "0" ] && _args="${_args} dns_cache=0" + [ "${DNS_CACHE}" = "0" ] && _args="${_args} dns_cache=0" _args="${_args} direct_dns_query_strategy=${DIRECT_DNS_QUERY_STRATEGY}" _args="${_args} remote_dns_query_strategy=${REMOTE_DNS_QUERY_STRATEGY}" DNSMASQ_FILTER_PROXY_IPV6=0 @@ -1363,7 +1372,7 @@ start_dns() { rm -rf $TMP_PATH2/dnsmasq_default* local group_domestic=$(config_t_get global group_domestic) local smartdns_remote_dns=$(config_t_get global smartdns_remote_dns) - if [ -n "${smartdns_remote_dns}" -a "${smartdns_remote_dns}" != "nil" ]; then + if [ -n "${smartdns_remote_dns}" ] && [ "${smartdns_remote_dns}" != "nil" ]; then smartdns_remote_dns=$(echo ${smartdns_remote_dns} | tr -s ' ' '|') else smartdns_remote_dns="tcp://1.1.1.1" @@ -1430,13 +1439,13 @@ start_dns() { [ "$USE_DEFAULT_DNS" = "remote" ] && { dnsmasq_version=$(dnsmasq -v | grep -i "Dnsmasq version " | awk '{print $3}') - [ "$(expr $dnsmasq_version \>= 2.87)" == 0 ] && echolog "Dnsmasq版本低于2.87,有可能无法正常使用!!!" + [ "$(check_ver "$dnsmasq_version" "2.87")" = "1" ] && echolog "Dnsmasq版本低于2.87,有可能无法正常使用!!!" } local DNSMASQ_TUN_DNS=$(get_first_dns TUN_DNS 53) local RUN_NEW_DNSMASQ=1 RUN_NEW_DNSMASQ=${DNS_REDIRECT} - if [ "${RUN_NEW_DNSMASQ}" == "0" ]; then + if [ "${RUN_NEW_DNSMASQ}" = "0" ]; then #The old logic will be removed in the future. #Run a copy dnsmasq instance, DNS hijack that don't need a proxy devices. [ "1" = "0" ] && { @@ -1534,7 +1543,7 @@ acl_app() { local acl_path=${TMP_ACL_PATH}/$sid mkdir -p ${acl_path} - [ -n "${source_list}" ] && echo -e "${source_list}" | sed '/^$/d' > ${acl_path}/source_list + [ -n "${source_list}" ] && printf "%b\n" "${source_list}" | sed '/^$/d' > ${acl_path}/source_list use_global_config=${use_global_config:-0} [ "${use_global_config}" = "1" ] && { @@ -1619,7 +1628,7 @@ acl_app() { _dns_port=$dns_port if [ "$dns_mode" = "dns2socks" ]; then run_dns2socks flag=acl_${sid} socks_address=127.0.0.1 socks_port=$socks_port listen_address=0.0.0.0 listen_port=${_dns_port} dns=$remote_dns cache=1 - elif [ "$dns_mode" = "sing-box" -o "$dns_mode" = "xray" ]; then + elif [ "$dns_mode" = "sing-box" ] || [ "$dns_mode" = "xray" ]; then config_file=$TMP_ACL_PATH/${tcp_node}_SOCKS_${socks_port}_DNS.json remote_dns_doh=${remote_dns_doh:-https://1.1.1.1/dns-query} local type=${dns_mode} @@ -1844,8 +1853,8 @@ start() { nftflag=0 USE_TABLES="" check_run_environment - if [ "$ENABLED_DEFAULT_ACL" == 1 ] || [ "$ENABLED_ACLS" == 1 ]; then - [ "$(uci -q get dhcp.@dnsmasq[0].dns_redirect)" == "1" ] && { + if [ "$ENABLED_DEFAULT_ACL" = 1 ] || [ "$ENABLED_ACLS" = 1 ]; then + [ "$(uci -q get dhcp.@dnsmasq[0].dns_redirect)" = "1" ] && { uci -q set ${CONFIG}.@global[0].dnsmasq_dns_redirect='1' uci -q commit ${CONFIG} uci -q set dhcp.@dnsmasq[0].dns_redirect='0' @@ -1853,7 +1862,7 @@ start() { lua $APP_PATH/helper_dnsmasq.lua restart -LOG 0 } fi - [ "$ENABLED_DEFAULT_ACL" == 1 ] && { + [ "$ENABLED_DEFAULT_ACL" = 1 ] && { mkdir -p ${GLOBAL_ACL_PATH} start_redir TCP start_redir UDP @@ -1861,11 +1870,11 @@ start() { } [ -n "$USE_TABLES" ] && source $APP_PATH/${USE_TABLES}.sh start set_cache_var "USE_TABLES" "$USE_TABLES" - if [ "$ENABLED_DEFAULT_ACL" == 1 ] || [ "$ENABLED_ACLS" == 1 ]; then + if [ "$ENABLED_DEFAULT_ACL" = 1 ] || [ "$ENABLED_ACLS" = 1 ]; then bridge_nf_ipt=$(sysctl -e -n net.bridge.bridge-nf-call-iptables) set_cache_var "bak_bridge_nf_ipt" "$bridge_nf_ipt" sysctl -w net.bridge.bridge-nf-call-iptables=0 >/dev/null 2>&1 - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { bridge_nf_ip6t=$(sysctl -e -n net.bridge.bridge-nf-call-ip6tables) set_cache_var "bak_bridge_nf_ip6t" "$bridge_nf_ip6t" sysctl -w net.bridge.bridge-nf-call-ip6tables=0 >/dev/null 2>&1 @@ -1972,7 +1981,7 @@ get_config() { } ENABLED_ACLS=$(config_t_get global acl_enable 0) [ "$ENABLED_ACLS" = 1 ] && { - [ "$(uci show ${CONFIG} | grep "@acl_rule" | grep "enabled='1'" | wc -l)" == 0 ] && ENABLED_ACLS=0 + [ "$(uci show ${CONFIG} | grep "@acl_rule" | grep "enabled='1'" | wc -l)" = 0 ] && ENABLED_ACLS=0 } set_cache_var ENABLED_DEFAULT_ACL $ENABLED_DEFAULT_ACL set_cache_var ENABLED_ACLS $ENABLED_ACLS @@ -1995,7 +2004,7 @@ get_config() { [ "${TCP_PROXY_MODE}" != "disable" ] && TCP_PROXY_MODE="proxy" [ "${UDP_PROXY_MODE}" != "disable" ] && UDP_PROXY_MODE="proxy" LOCALHOST_PROXY=$(config_t_get global localhost_proxy 1) - [ "${LOCALHOST_PROXY}" == 1 ] && { + [ "${LOCALHOST_PROXY}" = 1 ] && { LOCALHOST_TCP_PROXY_MODE=$TCP_PROXY_MODE LOCALHOST_UDP_PROXY_MODE=$UDP_PROXY_MODE } @@ -2066,13 +2075,13 @@ arg1=$1 shift case $arg1 in run_socks) - run_socks $@ + run_socks "$@" ;; socks_node_switch) - socks_node_switch $@ + socks_node_switch "$@" ;; start) - start $@ + start "$@" ;; stop) stop diff --git a/luci-app-passwall/root/usr/share/passwall/iptables.sh b/luci-app-passwall/root/usr/share/passwall/iptables.sh index 17cc8b15..63e2ee6e 100755 --- a/luci-app-passwall/root/usr/share/passwall/iptables.sh +++ b/luci-app-passwall/root/usr/share/passwall/iptables.sh @@ -38,8 +38,8 @@ ipt_n="$ipt -t nat -w" ipt_m="$ipt -t mangle -w" ip6t_n="$ip6t -t nat -w" ip6t_m="$ip6t -t mangle -w" -[ -z "$ip6t" -o -z "$(lsmod | grep 'ip6table_nat')" ] && ip6t_n="eval #$ip6t_n" -[ -z "$ip6t" -o -z "$(lsmod | grep 'ip6table_mangle')" ] && ip6t_m="eval #$ip6t_m" +[ -z "$ip6t" ] || [ -z "$(lsmod | grep 'ip6table_nat')" ] && ip6t_n="eval #$ip6t_n" +[ -z "$ip6t" ] || [ -z "$(lsmod | grep 'ip6table_mangle')" ] && ip6t_m="eval #$ip6t_m" FWI=$(uci -q get firewall.passwall.path 2>/dev/null) FAKE_IP="198.18.0.0/15" FAKE_IP_6="fc00::/18" @@ -47,7 +47,7 @@ FAKE_IP_6="fc00::/18" factor() { if [ -z "$1" ] || [ -z "$2" ]; then echo "" - elif [ "$1" == "1:65535" ]; then + elif [ "$1" = "1:65535" ]; then echo "" else echo "$2 $1" @@ -168,7 +168,7 @@ REDIRECT() { local s="-j REDIRECT" [ -n "$1" ] && { local s="$s --to-ports $1" - [ "$2" == "TPROXY" ] && { + [ "$2" = "TPROXY" ] && { local mark="-m mark --mark ${FWMARK}" s="${mark} -j TPROXY --on-port $1" } @@ -195,11 +195,11 @@ get_jump_ipt() { } load_acl() { - ([ "$ENABLED_ACLS" == 1 ] || ([ "$ENABLED_DEFAULT_ACL" == 1 ] && [ "$CLIENT_PROXY" == 1 ])) && echolog " - 访问控制:" - [ "$ENABLED_ACLS" == 1 ] && { + { [ "$ENABLED_ACLS" = "1" ] || { [ "$ENABLED_DEFAULT_ACL" = "1" ] && [ "$CLIENT_PROXY" = "1" ]; }; } && echolog " - 访问控制:" + [ "$ENABLED_ACLS" = 1 ] && { acl_app for sid in $(ls -F ${TMP_ACL_PATH} | grep '/$' | awk -F '/' '{print $1}' | grep -v 'default'); do - eval $(uci -q show "${CONFIG}.${sid}" | cut -d'.' -sf 3-) + eval "$(uci -q show "${CONFIG}.${sid}" | cut -d'.' -sf 3-)" tcp_no_redir_ports=${tcp_no_redir_ports:-default} udp_no_redir_ports=${udp_no_redir_ports:-default} @@ -379,7 +379,7 @@ load_acl() { ipset -! create $gfw6_set_name nethash family inet6 maxelem 1048576 timeout 172800 } } - [ "${use_shunt_tcp}" = "1" -o "${use_shunt_udp}" = "1" ] && { + [ "${use_shunt_tcp}" = "1" ] || [ "${use_shunt_udp}" = "1" ] && { [ "${use_global_config}" = "0" ] && { shunt_set_name="psw_${sid}_shunt" shunt6_set_name="psw_${sid}_shunt6" @@ -403,16 +403,16 @@ load_acl() { [ -z "$(get_cache_var "ACL_${sid}_tcp_default")" ] && echolog " - ${msg}使用与全局配置不相同节点,已将DNS强制重定向到专用 DNS 服务器。" fi - [ -n "$tcp_port" -o -n "$udp_port" ] && { + [ -n "$tcp_port" ] || [ -n "$udp_port" ] && { [ "${use_block_list}" = "1" ] && $ipt_m -A PSW $(comment "$remarks") ${_ipt_source} $(dst $IPSET_BLOCK) -j DROP [ "${use_direct_list}" = "1" ] && $ipt_tmp -A PSW $(comment "$remarks") ${_ipt_source} $(dst $IPSET_WHITE) -j RETURN - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_block_list}" = "1" ] && $ip6t_m -A PSW $(comment "$remarks") ${_ipt_source} $(dst $IPSET_BLOCK6) -j DROP 2>/dev/null [ "${use_direct_list}" = "1" ] && $ip6t_m -A PSW $(comment "$remarks") ${_ipt_source} $(dst $IPSET_WHITE6) -j RETURN 2>/dev/null } [ "$tcp_proxy_drop_ports" != "disable" ] && { - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "-d $FAKE_IP_6 -j DROP" 2>/dev/null [ "${use_proxy_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $black6_set_name) -j DROP" 2>/dev/null [ "${use_gfw_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $gfw6_set_name) -j DROP" 2>/dev/null @@ -430,7 +430,7 @@ load_acl() { } [ "$udp_proxy_drop_ports" != "disable" ] && { - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "-d $FAKE_IP_6 -j DROP" 2>/dev/null [ "${use_proxy_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $black6_set_name) -j DROP" 2>/dev/null [ "${use_gfw_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $gfw6_set_name) -j DROP" 2>/dev/null @@ -469,7 +469,7 @@ load_acl() { [ "${tcp_proxy_mode}" != "disable" ] && $ipt_n -A PSW $(comment "$remarks") -p icmp ${_ipt_source} $(REDIRECT) } - [ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} -d $FAKE_IP_6 $(REDIRECT) 2>/dev/null [ "${use_proxy_list}" = "1" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} $(dst $black6_set_name) $(REDIRECT) 2>/dev/null [ "${use_gfw_list}" = "1" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} $(dst $gfw6_set_name) $(REDIRECT) 2>/dev/null @@ -486,7 +486,7 @@ load_acl() { [ "${tcp_proxy_mode}" != "disable" ] && add_port_rules "$ipt_tmp -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "${ipt_j}" [ -n "${is_tproxy}" ] && $ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source} $(REDIRECT $tcp_port TPROXY) - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && $ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source} -d $FAKE_IP_6 -j PSW_RULE 2>/dev/null [ "${use_proxy_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $black6_set_name) -j PSW_RULE" 2>/dev/null [ "${use_gfw_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $gfw6_set_name) -j PSW_RULE" 2>/dev/null @@ -517,7 +517,7 @@ load_acl() { [ "${udp_proxy_mode}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "-j PSW_RULE" $ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source} $(REDIRECT $udp_port TPROXY) - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && $ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source} -d $FAKE_IP_6 -j PSW_RULE 2>/dev/null [ "${use_proxy_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $black6_set_name) -j PSW_RULE" 2>/dev/null [ "${use_gfw_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $gfw6_set_name) -j PSW_RULE" 2>/dev/null @@ -540,7 +540,7 @@ load_acl() { done } - [ "$ENABLED_DEFAULT_ACL" == 1 ] && [ "$CLIENT_PROXY" == 1 ] && { + [ "$ENABLED_DEFAULT_ACL" = 1 ] && [ "$CLIENT_PROXY" = 1 ] && { msg="【默认】," local ipt_tmp=$ipt_n [ -n "${is_tproxy}" ] && ipt_tmp=$ipt_m @@ -586,22 +586,22 @@ load_acl() { $ip6t_n -A PSW_DNS $(comment "默认") -p tcp --dport 53 -j REDIRECT --to-ports ${DNS_REDIRECT} 2>/dev/null fi - [ -n "${TCP_PROXY_MODE}" -o -n "${UDP_PROXY_MODE}" ] && { + [ -n "${TCP_PROXY_MODE}" ] || [ -n "${UDP_PROXY_MODE}" ] && { [ "${USE_BLOCK_LIST}" = "1" ] && $ipt_m -A PSW $(comment "默认") $(dst $IPSET_BLOCK) -j DROP [ "${USE_DIRECT_LIST}" = "1" ] && $ipt_tmp -A PSW $(comment "默认") $(dst $IPSET_WHITE) -j RETURN - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_BLOCK_LIST}" = "1" ] && $ip6t_m -A PSW $(comment "默认") $(dst $IPSET_BLOCK6) -j DROP 2>/dev/null [ "${USE_DIRECT_LIST}" = "1" ] && $ip6t_m -A PSW $(comment "默认") $(dst $IPSET_WHITE6) -j RETURN 2>/dev/null } [ "$TCP_PROXY_DROP_PORTS" != "disable" ] && { - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "-d $FAKE_IP_6 -j DROP" [ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK6) -j DROP" [ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_GFW6) -j DROP" [ "${CHN_LIST}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST} "-j DROP")" - [ "${USE_SHUNT_TCP}" = "1" ] && $ip6t_m -A PSW $(comment "默认") -p tcp $TCP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT6) -j DROP" - [ "${TCP_PROXY_MODE}" != "disable" ] && $ip6t_m -A PSW $(comment "默认") -p tcp $TCP_PROXY_DROP_PORTS "-j DROP" + [ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT6) -j DROP" + [ "${TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "-j DROP" } [ "${USE_FAKEDNS}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "-d $FAKE_IP -j DROP" [ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK) -j DROP" @@ -613,12 +613,12 @@ load_acl() { } [ "$UDP_PROXY_DROP_PORTS" != "disable" ] && { - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "-d $FAKE_IP_6 -j DROP" [ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK6) -j DROP" [ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_GFW6) -j DROP" [ "${CHN_LIST}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST} "-j DROP")" - [ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT6) -j DROP" + [ "${USE_SHUNT_UDP}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT6) -j DROP" [ "${UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "-j DROP" } [ "${USE_FAKEDNS}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "-d $FAKE_IP -j DROP" @@ -656,7 +656,7 @@ load_acl() { [ "${TCP_PROXY_MODE}" != "disable" ] && $ipt_n -A PSW $(comment "默认") -p icmp $(REDIRECT) } - [ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" == "1" ] && { + [ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp -d $FAKE_IP_6 $(REDIRECT) [ "${USE_PROXY_LIST}" = "1" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp $(dst $IPSET_BLACK6) $(REDIRECT) [ "${USE_GFW_LIST}" = "1" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp $(dst $IPSET_GFW6) $(REDIRECT) @@ -673,7 +673,7 @@ load_acl() { [ "${TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_tmp -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "${ipt_j}" [ -n "${is_tproxy}" ]&& $ipt_tmp -A PSW $(comment "默认") -p tcp $(REDIRECT $TCP_REDIR_PORT TPROXY) - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && $ip6t_m -A PSW $(comment "默认") -p tcp -d $FAKE_IP_6 -j PSW_RULE [ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_BLACK6) -j PSW_RULE" [ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_GFW6) -j PSW_RULE" @@ -692,7 +692,7 @@ load_acl() { # 加载UDP默认代理模式 if [ -n "${UDP_PROXY_MODE}" ]; then - [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ] && { + [ -n "$UDP_NODE" ] || [ "$TCP_UDP" = "1" ] && { if is_socks_wrap "$UDP_NODE"; then msg2="${msg}使用 UDP 节点[Socks 配置($(config_n_get ${UDP_NODE#Socks_} port) 端口)](TPROXY:${UDP_REDIR_PORT})" else @@ -707,7 +707,7 @@ load_acl() { [ "${UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "-j PSW_RULE" $ipt_m -A PSW $(comment "默认") -p udp $(REDIRECT $UDP_REDIR_PORT TPROXY) - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && $ip6t_m -A PSW $(comment "默认") -p udp -d $FAKE_IP_6 -j PSW_RULE [ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_BLACK6) -j PSW_RULE" [ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_GFW6) -j PSW_RULE" @@ -782,7 +782,7 @@ filter_node() { local port=$(config_n_get "$node" port) local hop=$(config_n_get "$node" hysteria2_hop) [ -n "$hop" ] && port="${port:+$port,}$hop" - [ -z "$address" -o -z "$port" ] && return 1 + [ -z "$address" ] || [ -z "$port" ] && return 1 filter_server_port "$address" "$port" "$stream" } @@ -1145,7 +1145,7 @@ add_firewall_rule() { [ "$TCP_UDP" = "1" ] && [ -z "$UDP_NODE" ] && UDP_NODE=$TCP_NODE - [ "$ENABLED_DEFAULT_ACL" == 1 ] && { + [ "$ENABLED_DEFAULT_ACL" = 1 ] && { local ipt_tmp=$ipt_n if [ -n "${is_tproxy}" ]; then ipt_tmp=$ipt_m @@ -1186,7 +1186,7 @@ add_firewall_rule() { } fi - [ -n "${LOCALHOST_TCP_PROXY_MODE}" -o -n "${LOCALHOST_UDP_PROXY_MODE}" ] && { + [ -n "${LOCALHOST_TCP_PROXY_MODE}" ] || [ -n "${LOCALHOST_UDP_PROXY_MODE}" ] && { [ "$TCP_PROXY_DROP_PORTS" != "disable" ] && { [ "${USE_FAKEDNS}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p tcp" $TCP_PROXY_DROP_PORTS "-d $FAKE_IP -j DROP" [ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK) -j DROP" @@ -1273,7 +1273,7 @@ add_firewall_rule() { insert_rule_before "$ipt_m" "OUTPUT" "mwan3" "$(comment mangle-OUTPUT-PSW) -p tcp -j PSW_OUTPUT" } - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ -n "${LOCALHOST_TCP_PROXY_MODE}" ] && { [ "${USE_FAKEDNS}" = "1" ] && $ip6t_m -A PSW_OUTPUT -p tcp -d $FAKE_IP_6 -j PSW_RULE [ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_BLACK6) -j PSW_RULE" @@ -1289,12 +1289,12 @@ add_firewall_rule() { fi # 加载路由器自身代理 UDP - if [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ]; then + if [ -n "$UDP_NODE" ] || [ "$TCP_UDP" = "1" ]; then _proxy_udp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then ipset -q test $IPSET_LAN ${2} - [ $? == 0 ] && { + [ $? = 0 ] && { echolog " - 上游 DNS 服务器 ${2} 已在直接访问的列表中,不强制向 UDP 代理转发对该服务器 UDP/${3} 端口的访问" return 0 } @@ -1303,7 +1303,7 @@ add_firewall_rule() { echolog " - [$?]将上游 DNS 服务器 ${2}:${3} 加入到路由器自身代理的 UDP 转发链" else ipset -q test $IPSET_LAN6 ${2} - [ $? == 0 ] && { + [ $? = 0 ] && { echolog " - 上游 DNS 服务器 ${2} 已在直接访问的列表中,不强制向 UDP 代理转发对该服务器 UDP/${3} 端口的访问" return 0 } @@ -1325,7 +1325,7 @@ add_firewall_rule() { $ipt_m -A PSW $(comment "本机") -p udp -i lo -j RETURN insert_rule_before "$ipt_m" "OUTPUT" "mwan3" "$(comment mangle-OUTPUT-PSW) -p udp -j PSW_OUTPUT" - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ -n "$LOCALHOST_UDP_PROXY_MODE" ] && { [ "${USE_FAKEDNS}" = "1" ] && $ip6t_m -A PSW_OUTPUT -p udp -d $FAKE_IP_6 -j PSW_RULE [ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_BLACK6) -j PSW_RULE" @@ -1425,7 +1425,7 @@ gen_include() { flush_include extract_rules() { local _ipt="${ipt}" - [ "$1" == "6" ] && _ipt="${ip6t}" + [ "$1" = "6" ] && _ipt="${ip6t}" [ -z "${_ipt}" ] && return echo "*$2" @@ -1497,7 +1497,7 @@ get_ip6t_bin() { } start() { - [ "$ENABLED_DEFAULT_ACL" == 0 -a "$ENABLED_ACLS" == 0 ] && return + [ "$ENABLED_DEFAULT_ACL" = 0 ] && [ "$ENABLED_ACLS" = 0 ] && return add_firewall_rule gen_include } @@ -1505,7 +1505,7 @@ start() { stop() { [ -z "$(command -v echolog)" ] && . "$UTILS_PATH" del_firewall_rule - [ $(config_t_get global flush_set_on_reboot "0") = "1" -o $(config_t_get global flush_set "0") = "1" ] && { + [ $(config_t_get global flush_set_on_reboot "0") = "1" ] || [ $(config_t_get global flush_set "0") = "1" ] && { uci -q delete ${CONFIG}.@global[0].flush_set uci -q commit ${CONFIG} flush_ipset diff --git a/luci-app-passwall/root/usr/share/passwall/nftables.sh b/luci-app-passwall/root/usr/share/passwall/nftables.sh index 7536d2f3..a11efd7d 100755 --- a/luci-app-passwall/root/usr/share/passwall/nftables.sh +++ b/luci-app-passwall/root/usr/share/passwall/nftables.sh @@ -121,13 +121,13 @@ REDIRECT() { local s="counter redirect" [ -n "$1" ] && { local s="$s to :$1" - [ "$2" == "TPROXY" ] && { + [ "$2" = "TPROXY" ] && { s="counter meta mark ${FWMARK} tproxy to :$1" } - [ "$2" == "TPROXY4" ] && { + [ "$2" = "TPROXY4" ] && { s="counter meta mark ${FWMARK} tproxy ip to :$1" } - [ "$2" == "TPROXY6" ] && { + [ "$2" = "TPROXY6" ] && { s="counter meta mark ${FWMARK} tproxy ip6 to :$1" } } @@ -175,25 +175,28 @@ insert_nftset() { *) suffix=" timeout $timeout_argument" ;; esac { - if [ $# -gt 0 ]; then + if [ $# -gt 0 ] && [ $# -le 1000 ]; then printf "%s\n" "$@" + elif [ $# -gt 1000 ]; then + printf "%s\n" "$*" else cat fi | awk -v s="$suffix" -v n="$nftset_name" -v t="$NFTABLE_NAME" ' BEGIN { RS = "[ \t\n\r]+" + ORS = "" } $0 != "" { - if (first == 0) { - printf "add element %s %s { \n", t, n; + if (!first) { + printf "add element %s %s { \n", t, n first = 1; } else { - printf ",\n"; + print ",\n" } - printf "%s%s", $0, s; + print $0 s } END { - if (first == 1) printf "\n }\n"; + if (first) print "\n }\n" } ' } | nft -f - @@ -211,7 +214,7 @@ gen_nftset() { local gc_interval_time="1h" if ! nft list set $NFTABLE_NAME $nftset_name >/dev/null 2>&1; then - if [ "$timeout_argument_set" == "0" ]; then + if [ "$timeout_argument_set" = "0" ]; then nft "add set $NFTABLE_NAME $nftset_name { type $ip_type; flags interval, timeout; auto-merge; }" else nft "add set $NFTABLE_NAME $nftset_name { type $ip_type; flags interval, timeout; timeout $timeout_argument_set; gc-interval $gc_interval_time; auto-merge; }" @@ -236,11 +239,11 @@ get_jump_nft() { } load_acl() { - ([ "$ENABLED_ACLS" == 1 ] || ([ "$ENABLED_DEFAULT_ACL" == 1 ] && [ "$CLIENT_PROXY" == 1 ])) && echolog " - 访问控制:" - [ "$ENABLED_ACLS" == 1 ] && { + { [ "$ENABLED_ACLS" = "1" ] || { [ "$ENABLED_DEFAULT_ACL" = "1" ] && [ "$CLIENT_PROXY" = "1" ]; }; } && echolog " - 访问控制:" + [ "$ENABLED_ACLS" = 1 ] && { acl_app for sid in $(ls -F ${TMP_ACL_PATH} | grep '/$' | awk -F '/' '{print $1}' | grep -v 'default'); do - eval $(uci -q show "${CONFIG}.${sid}" | cut -d'.' -sf 3-) + eval "$(uci -q show "${CONFIG}.${sid}" | cut -d'.' -sf 3-)" tcp_no_redir_ports=${tcp_no_redir_ports:-default} udp_no_redir_ports=${udp_no_redir_ports:-default} @@ -409,7 +412,7 @@ load_acl() { gen_nftset $gfw6_set_name ipv6_addr "2d" 0 } } - [ "${use_shunt_tcp}" = "1" -o "${use_shunt_udp}" = "1" ] && { + [ "${use_shunt_tcp}" = "1" ] || [ "${use_shunt_udp}" = "1" ] && { [ "${use_global_config}" = "0" ] && { shunt_set_name="psw_${sid}_shunt" shunt6_set_name="psw_${sid}_shunt6" @@ -433,18 +436,18 @@ load_acl() { [ -z "$(get_cache_var "ACL_${sid}_tcp_default")" ] && echolog " - ${msg}使用与全局配置不相同节点,已将DNS强制重定向到专用 DNS 服务器。" fi - [ -n "$tcp_port" -o -n "$udp_port" ] && { + [ -n "$tcp_port" ] || [ -n "$udp_port" ] && { [ "${use_block_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ${_ipt_source} ip daddr @$NFTSET_BLOCK counter drop comment \"$remarks\"" [ "${use_block_list}" = "1" ] && [ -z "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME PSW_NAT ${_ipt_source} ip daddr @$NFTSET_BLOCK counter drop comment \"$remarks\"" [ "${use_direct_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ${_ipt_source} ip daddr @$NFTSET_WHITE counter return comment \"$remarks\"" [ "${use_direct_list}" = "1" ] && [ -z "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME PSW_NAT ${_ipt_source} ip daddr @$NFTSET_WHITE counter return comment \"$remarks\"" - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_block_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 ${_ipt_source} ip6 daddr @$NFTSET_BLOCK6 counter drop comment \"$remarks\"" [ "${use_direct_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 ${_ipt_source} ip6 daddr @$NFTSET_WHITE6 counter return comment \"$remarks\"" } [ "$tcp_proxy_drop_ports" != "disable" ] && { - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip6 daddr $FAKE_IP_6 counter drop comment \"$remarks\"" 2>/dev/null [ "${use_proxy_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip6 daddr @$black6_set_name counter drop comment \"$remarks\"" 2>/dev/null [ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip6 daddr @$gfw6_set_name counter drop comment \"$remarks\"" 2>/dev/null @@ -462,7 +465,7 @@ load_acl() { } [ "$udp_proxy_drop_ports" != "disable" ] && { - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip6 daddr $FAKE_IP_6 counter drop comment \"$remarks\"" 2>/dev/null [ "${use_proxy_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip6 daddr @$black6_set_name counter drop comment \"$remarks\"" 2>/dev/null [ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip6 daddr @$gfw6_set_name counter drop comment \"$remarks\"" 2>/dev/null @@ -504,7 +507,7 @@ load_acl() { nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip protocol icmp ${_ipt_source} return comment \"$remarks\"" } - [ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_direct_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ${_ipt_source} ip6 daddr @$NFTSET_WHITE6 counter return comment \"$remarks\"" 2>/dev/null [ "${use_fakedns}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ${_ipt_source} ip6 daddr $FAKE_IP_6 $(REDIRECT) comment \"$remarks\"" 2>/dev/null [ "${use_proxy_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ${_ipt_source} ip6 daddr @$black6_set_name $(REDIRECT) comment \"$remarks\"" 2>/dev/null @@ -523,7 +526,7 @@ load_acl() { [ "${tcp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ${nft_j} comment \"$remarks\"" [ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp ${_ipt_source} $(REDIRECT $tcp_port TPROXY4) comment \"$remarks\"" - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} ip6 daddr $FAKE_IP_6 counter jump PSW_RULE comment \"$remarks\"" [ "${use_proxy_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip6 daddr @$black6_set_name counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null [ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip6 daddr @$gfw6_set_name counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null @@ -554,7 +557,7 @@ load_acl() { [ "${udp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") counter jump PSW_RULE comment \"$remarks\"" nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} $(REDIRECT $udp_port TPROXY4) comment \"$remarks\"" - [ "$PROXY_IPV6" == "1" ] && [ "$_ipv4" != "1" ] && { + [ "$PROXY_IPV6" = "1" ] && [ "$_ipv4" != "1" ] && { [ "${use_fakedns}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} ip6 daddr $FAKE_IP_6 counter jump PSW_RULE comment \"$remarks\"" [ "${use_proxy_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip6 daddr @$black6_set_name counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null [ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip6 daddr @$gfw6_set_name counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null @@ -577,7 +580,7 @@ load_acl() { done } - [ "$ENABLED_DEFAULT_ACL" == 1 ] && [ "$CLIENT_PROXY" == 1 ] && { + [ "$ENABLED_DEFAULT_ACL" = 1 ] && [ "$CLIENT_PROXY" = 1 ] && { msg="【默认】," [ "$TCP_NO_REDIR_PORTS" != "disable" ] && { nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp $(factor $TCP_NO_REDIR_PORTS "tcp dport") counter return comment \"默认\"" @@ -620,18 +623,18 @@ load_acl() { nft "add rule $NFTABLE_NAME PSW_DNS meta l4proto tcp tcp dport 53 counter redirect to :${DNS_REDIRECT} comment \"默认\"" fi - [ -n "${TCP_PROXY_MODE}" -o -n "${UDP_PROXY_MODE}" ] && { + [ -n "${TCP_PROXY_MODE}" ] || [ -n "${UDP_PROXY_MODE}" ] && { [ "${USE_BLOCK_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip daddr @$NFTSET_BLOCK counter drop comment \"默认\"" [ "${USE_BLOCK_LIST}" = "1" ] && [ -z "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME PSW_NAT ip daddr @$NFTSET_BLOCK counter drop comment \"默认\"" [ "${USE_DIRECT_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip daddr @$NFTSET_WHITE counter return comment \"默认\"" [ "${USE_DIRECT_LIST}" = "1" ] && [ -z "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME PSW_NAT ip daddr @$NFTSET_WHITE counter return comment \"默认\"" - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_BLOCK_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 ip6 daddr @$NFTSET_BLOCK6 counter drop comment \"默认\"" [ "${USE_DIRECT_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 ip6 daddr @$NFTSET_WHITE6 counter return comment \"默认\"" } [ "$TCP_PROXY_DROP_PORTS" != "disable" ] && { - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip6 daddr $FAKE_IP_6 counter drop comment \"默认\"" [ "${USE_PROXY_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip6 daddr @$NFTSET_BLACK6 counter drop comment \"默认\"" [ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip6 daddr @$NFTSET_GFW6 counter drop comment \"默认\"" @@ -650,7 +653,7 @@ load_acl() { } [ "$UDP_PROXY_DROP_PORTS" != "disable" ] && { - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip6 daddr $FAKE_IP_6 counter drop comment \"默认\"" [ "${USE_PROXY_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip6 daddr @$NFTSET_BLACK6 counter drop comment \"默认\"" [ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip6 daddr @$NFTSET_GFW6 counter drop comment \"默认\"" @@ -697,7 +700,7 @@ load_acl() { nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip protocol icmp return comment \"默认\"" } - [ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" == "1" ] && { + [ "$accept_icmpv6" = "1" ] && [ "$PROXY_IPV6" = "1" ] && { [ "${USE_DIRECT_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip6 daddr @$NFTSET_WHITE6 counter return comment \"默认\"" [ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ip6 daddr $FAKE_IP_6 $(REDIRECT) comment \"默认\"" [ "${USE_PROXY_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ip6 daddr @$NFTSET_BLACK6 $(REDIRECT) comment \"默认\"" @@ -717,7 +720,7 @@ load_acl() { [ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp $(REDIRECT $TCP_REDIR_PORT TPROXY4) comment \"默认\"" nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp counter return comment \"默认\"" - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ip6 daddr $FAKE_IP_6 counter jump PSW_RULE comment \"默认\"" [ "${USE_PROXY_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip6 daddr @$NFTSET_BLACK6 counter jump PSW_RULE comment \"默认\"" [ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip6 daddr @$NFTSET_GFW6 counter jump PSW_RULE comment \"默认\"" @@ -734,7 +737,7 @@ load_acl() { # 加载UDP默认代理模式 if [ -n "${UDP_PROXY_MODE}" ]; then - [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ] && { + [ -n "$UDP_NODE" ] || [ "$TCP_UDP" = "1" ] && { if is_socks_wrap "$UDP_NODE"; then msg2="${msg}使用 UDP 节点[Socks 配置($(config_n_get ${UDP_NODE#Socks_} port) 端口)](TPROXY:${UDP_REDIR_PORT})" else @@ -750,7 +753,7 @@ load_acl() { nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(REDIRECT $UDP_REDIR_PORT TPROXY4) comment \"默认\"" nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp counter return comment \"默认\"" - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ip6 daddr $FAKE_IP_6 counter jump PSW_RULE comment \"默认\"" [ "${USE_PROXY_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") ip6 daddr @$NFTSET_BLACK6 counter jump PSW_RULE comment \"默认\"" [ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") ip6 daddr @$NFTSET_GFW6 counter jump PSW_RULE comment \"默认\"" @@ -823,7 +826,7 @@ filter_node() { local port=$(config_n_get "$node" port) local hop=$(config_n_get "$node" hysteria2_hop) [ -n "$hop" ] && port="${port:+$port,}$hop" - [ -z "$address" -o -z "$port" ] && return 1 + [ -z "$address" ] || [ -z "$port" ] && return 1 filter_server_port "$address" "$port" "$stream" } @@ -1201,7 +1204,7 @@ add_firewall_rule() { } # jump chains - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { nft "add rule $NFTABLE_NAME mangle_prerouting meta nfproto {ipv6} counter jump PSW_MANGLE_V6" nft "add rule $NFTABLE_NAME mangle_output meta nfproto {ipv6} counter jump PSW_OUTPUT_MANGLE_V6 comment \"PSW_OUTPUT_MANGLE\"" @@ -1213,7 +1216,7 @@ add_firewall_rule() { [ "$TCP_UDP" = "1" ] && [ -z "$UDP_NODE" ] && UDP_NODE=$TCP_NODE - [ "$ENABLED_DEFAULT_ACL" == 1 ] && { + [ "$ENABLED_DEFAULT_ACL" = 1 ] && { msg="【路由器本机】," [ "$TCP_NO_REDIR_PORTS" != "disable" ] && { @@ -1247,7 +1250,7 @@ add_firewall_rule() { } fi - [ -n "${LOCALHOST_TCP_PROXY_MODE}" -o -n "${LOCALHOST_UDP_PROXY_MODE}" ] && { + [ -n "${LOCALHOST_TCP_PROXY_MODE}" ] || [ -n "${LOCALHOST_UDP_PROXY_MODE}" ] && { [ "$TCP_PROXY_DROP_PORTS" != "disable" ] && { [ "${USE_FAKEDNS}" = "1" ] && nft add rule $NFTABLE_NAME $nft_output_chain ip protocol tcp ip daddr $FAKE_IP $(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter drop [ "${USE_PROXY_LIST}" = "1" ] && nft add rule $NFTABLE_NAME $nft_output_chain ip protocol tcp ip daddr @$NFTSET_BLACK $(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter drop @@ -1297,7 +1300,7 @@ add_firewall_rule() { echolog " - [$?]将上游 DNS 服务器 [${2}]:${3} 加入到路由器自身代理的 TCP 转发链,请确保您的节点支持IPv6,并开启IPv6透明代理!" fi } - [ "$TCP_PROXY_DNS" == 1 ] && hosts_foreach REMOTE_DNS _proxy_tcp_access 53 + [ "$TCP_PROXY_DNS" = 1 ] && hosts_foreach REMOTE_DNS _proxy_tcp_access 53 [ "$accept_icmp" = "1" ] && { [ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT oif lo ip protocol icmp ip daddr $FAKE_IP counter redirect" @@ -1340,7 +1343,7 @@ add_firewall_rule() { [ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME mangle_output ip protocol tcp counter jump PSW_OUTPUT_MANGLE comment \"PSW_OUTPUT_MANGLE\"" [ -z "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME nat_output ip protocol tcp counter jump PSW_OUTPUT_NAT" - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ -n "${LOCALHOST_TCP_PROXY_MODE}" ] && { [ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto tcp ip6 daddr $FAKE_IP_6 counter jump PSW_RULE" [ "${USE_PROXY_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto tcp ip6 daddr @$NFTSET_BLACK6 $(factor $TCP_REDIR_PORTS "tcp dport") counter jump PSW_RULE" @@ -1355,12 +1358,12 @@ add_firewall_rule() { fi # 加载路由器自身代理 UDP - if [ -n "$UDP_NODE" -o "$TCP_UDP" = "1" ]; then + if [ -n "$UDP_NODE" ] || [ "$TCP_UDP" = "1" ]; then _proxy_udp_access() { [ -n "${2}" ] || return 0 if echo "${2}" | grep -q -v ':'; then nft "get element $NFTABLE_NAME $NFTSET_LAN {${2}}" &>/dev/null - [ $? == 0 ] && { + [ $? = 0 ] && { echolog " - 上游 DNS 服务器 ${2} 已在直接访问的列表中,不强制向 UDP 代理转发对该服务器 UDP/${3} 端口的访问" return 0 } @@ -1369,7 +1372,7 @@ add_firewall_rule() { echolog " - [$?]将上游 DNS 服务器 ${2}:${3} 加入到路由器自身代理的 UDP 转发链" else nft "get element $NFTABLE_NAME $NFTSET_LAN6 {${2}}" &>/dev/null - [ $? == 0 ] && { + [ $? = 0 ] && { echolog " - 上游 DNS 服务器 ${2} 已在直接访问的列表中,不强制向 UDP 代理转发对该服务器 UDP/${3} 端口的访问" return 0 } @@ -1391,7 +1394,7 @@ add_firewall_rule() { nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp iif lo counter return comment \"本机\"" nft "add rule $NFTABLE_NAME mangle_output ip protocol udp counter jump PSW_OUTPUT_MANGLE comment \"PSW_OUTPUT_MANGLE\"" - [ "$PROXY_IPV6" == "1" ] && { + [ "$PROXY_IPV6" = "1" ] && { [ -n "${LOCALHOST_UDP_PROXY_MODE}" ] && { [ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto udp ip6 daddr $FAKE_IP_6 counter jump PSW_RULE" [ "${USE_PROXY_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto udp ip6 daddr @$NFTSET_BLACK6 $(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE" @@ -1512,7 +1515,7 @@ gen_include() { } start() { - [ "$ENABLED_DEFAULT_ACL" == 0 -a "$ENABLED_ACLS" == 0 ] && return + [ "$ENABLED_DEFAULT_ACL" = 0 ] && [ "$ENABLED_ACLS" = 0 ] && return add_firewall_rule gen_include } @@ -1520,7 +1523,7 @@ start() { stop() { [ -z "$(command -v echolog)" ] && . "$UTILS_PATH" del_firewall_rule - [ $(config_t_get global flush_set_on_reboot "0") = "1" -o $(config_t_get global flush_set "0") = "1" ] && { + [ $(config_t_get global flush_set_on_reboot "0") = "1" ] || [ $(config_t_get global flush_set "0") = "1" ] && { uci -q delete ${CONFIG}.@global[0].flush_set uci -q commit ${CONFIG} #flush_table diff --git a/luci-app-passwall/root/usr/share/passwall/tasks.sh b/luci-app-passwall/root/usr/share/passwall/tasks.sh index 564caee4..25d2320e 100755 --- a/luci-app-passwall/root/usr/share/passwall/tasks.sh +++ b/luci-app-passwall/root/usr/share/passwall/tasks.sh @@ -18,24 +18,6 @@ do if [ "$CFG_UPDATE_INT" -ne 0 ]; then - stop_week_mode=$(config_t_get global_delay stop_week_mode) - stop_interval_mode=$(config_t_get global_delay stop_interval_mode) - stop_interval_mode=$(expr "$stop_interval_mode" \* 60) - if [ -n "$stop_week_mode" ]; then - [ "$stop_week_mode" = "8" ] && { - [ "$(expr "$CFG_UPDATE_INT" % "$stop_interval_mode")" -eq 0 ] && { /etc/init.d/$CONFIG stop > /dev/null 2>&1 & } - } - fi - - start_week_mode=$(config_t_get global_delay start_week_mode) - start_interval_mode=$(config_t_get global_delay start_interval_mode) - start_interval_mode=$(expr "$start_interval_mode" \* 60) - if [ -n "$start_week_mode" ]; then - [ "$start_week_mode" = "8" ] && { - [ "$(expr "$CFG_UPDATE_INT" % "$start_interval_mode")" -eq 0 ] && { /etc/init.d/$CONFIG start > /dev/null 2>&1 & } - } - fi - restart_week_mode=$(config_t_get global_delay restart_week_mode) restart_interval_mode=$(config_t_get global_delay restart_interval_mode) restart_interval_mode=$(expr "$restart_interval_mode" \* 60) @@ -45,36 +27,35 @@ do } fi - autoupdate=$(config_t_get global_rules auto_update) - weekupdate=$(config_t_get global_rules week_update) - hourupdate=$(config_t_get global_rules interval_update) - hourupdate=$(expr "$hourupdate" \* 60) - if [ "$autoupdate" = "1" ]; then - [ "$weekupdate" = "8" ] && { - [ "$(expr "$CFG_UPDATE_INT" % "$hourupdate")" -eq 0 ] && { lua $APP_PATH/rule_update.lua log all cron > /dev/null 2>&1 & } + rules_update_week_mode=$(config_t_get global_rules update_week_mode) + rules_update_interval_mode=$(config_t_get global_rules update_interval_mode) + rules_update_interval_mode=$(expr "$rules_update_interval_mode" \* 60) + if [ -n "$rules_update_week_mode" ]; then + [ "$rules_update_week_mode" = "8" ] && { + [ "$(expr "$CFG_UPDATE_INT" % "$rules_update_interval_mode")" -eq 0 ] && { lua $APP_PATH/rule_update.lua log all cron > /dev/null 2>&1 & } } fi TMP_SUB_PATH=$TMP_PATH/sub_tasks mkdir -p $TMP_SUB_PATH for item in $(uci show ${CONFIG} | grep "=subscribe_list" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do - if [ "$(config_n_get $item auto_update 0)" = "1" ]; then + sub_update_week_mode=$(config_n_get $item update_week_mode) + if [ -n "$sub_update_week_mode" ]; then cfgid=$(uci show ${CONFIG}.$item | head -n 1 | cut -d '.' -sf 2 | cut -d '=' -sf 1) remark=$(config_n_get $item remark) - week_update=$(config_n_get $item week_update) - hour_update=$(config_n_get $item interval_update) - echo "$cfgid" >> $TMP_SUB_PATH/${week_update}_${hour_update} + sub_update_interval_mode=$(config_n_get $item update_interval_mode) + echo "$cfgid" >> $TMP_SUB_PATH/${sub_update_week_mode}_${sub_update_interval_mode} fi done [ -d "${TMP_SUB_PATH}" ] && { for name in $(ls ${TMP_SUB_PATH}); do - week_update=$(echo $name | awk -F '_' '{print $1}') - hour_update=$(echo $name | awk -F '_' '{print $2}') - hour_update=$(expr "$hour_update" \* 60) + sub_update_week_mode=${name%_*} + sub_update_interval_mode=${name#*_} + sub_update_interval_mode=$(expr "$sub_update_interval_mode" \* 60) cfgids=$(echo -n $(cat ${TMP_SUB_PATH}/${name}) | sed 's# #,#g') - [ "$week_update" = "8" ] && { - [ "$(expr "$CFG_UPDATE_INT" % "$hour_update")" -eq 0 ] && { lua $APP_PATH/subscribe.lua start $cfgids cron > /dev/null 2>&1 & } + [ "$sub_update_week_mode" = "8" ] && { + [ "$(expr "$CFG_UPDATE_INT" % "$sub_update_interval_mode")" -eq 0 ] && { lua $APP_PATH/subscribe.lua start $cfgids cron > /dev/null 2>&1 & } } done diff --git a/luci-app-passwall/root/usr/share/passwall/utils.sh b/luci-app-passwall/root/usr/share/passwall/utils.sh index e2847193..e9b5aeba 100755 --- a/luci-app-passwall/root/usr/share/passwall/utils.sh +++ b/luci-app-passwall/root/usr/share/passwall/utils.sh @@ -89,7 +89,7 @@ get_host_ip() { [ -z "$count" ] && count=3 local isip="" local ip="" - if [ "$1" == "ipv6" ]; then + if [ "$1" = "ipv6" ]; then isip=$(echo $host | grep -E "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}") if [ -n "$isip" ]; then ip=$(echo "$host" | tr -d '[]') @@ -100,7 +100,7 @@ get_host_ip() { fi [ -z "$isip" ] && { local t=4 - [ "$1" == "ipv6" ] && t=6 + [ "$1" = "ipv6" ] && t=6 local vpsrip=$(resolveip -$t -t $count $host | awk 'NR==1{print}') ip=$vpsrip } @@ -113,7 +113,7 @@ get_node_host_ip() { [ -n "$address" ] && { local use_ipv6=$(config_n_get $1 use_ipv6) local network_type="ipv4" - [ "$use_ipv6" == "1" ] && network_type="ipv6" + [ "$use_ipv6" = "1" ] && network_type="ipv6" ip=$(get_host_ip $network_type $address) } echo $ip @@ -220,7 +220,7 @@ get_first_dns() { echo "${2}#${3}" return 1 } - eval "hosts_foreach \"${__hosts_val}\" __first \"$@\"" + hosts_foreach "${__hosts_val}" __first "$@" } get_last_dns() { @@ -231,8 +231,8 @@ get_last_dns() { __last="${2}#${3}" __first=${__first:-${__last}} } - eval "hosts_foreach \"${__hosts_val}\" __every \"$@\"" - [ "${__first}" == "${__last}" ] || echo "${__last}" + hosts_foreach "${__hosts_val}" __first "$@" + [ "${__first}" = "${__last}" ] || echo "${__last}" } normalize_dns() { @@ -319,7 +319,7 @@ get_new_port() { fi fi fi - [ "$port" -lt $min_port -o "$port" -gt $max_port ] && port=$default_start_port + [ "$port" -lt $min_port ] || [ "$port" -gt $max_port ] && port=$default_start_port local start_port="$port" while :; do if [ "$(check_port_exists "$port" "$protocol")" = 0 ]; then @@ -346,9 +346,11 @@ check_ver() { local version1="$1" local version2="$2" local i v1 v1_1 v1_2 v1_3 v2 v2_1 v2_2 v2_3 - IFS='.'; set -- $version1; v1_1=${1:-0}; v1_2=${2:-0}; v1_3=${3:-0} - IFS='.'; set -- $version2; v2_1=${1:-0}; v2_2=${2:-0}; v2_3=${3:-0} - IFS= + local old_ifs="$IFS" + IFS='.' + set -- $version1; v1_1=${1:-0}; v1_2=${2:-0}; v1_3=${3:-0} + set -- $version2; v2_1=${1:-0}; v2_2=${2:-0}; v2_3=${3:-0} + IFS="$old_ifs" for i in 1 2 3; do eval v1=\$v1_$i eval v2=\$v2_$i @@ -481,8 +483,10 @@ ln_run() { if [ -z "$persist_log_path" ] && [ "$sys_log" != "1" ]; then ${file_func:-echolog " - ${ln_name}"} "$@" >${output} 2>&1 & else - [ "${output: -1, -7}" == "TCP.log" ] && local protocol="TCP" - [ "${output: -1, -7}" == "UDP.log" ] && local protocol="UDP" + case "$output" in + *TCP.log) local protocol="TCP" ;; + *UDP.log) local protocol="UDP" ;; + esac if [ -n "${persist_log_path}" ]; then mkdir -p ${persist_log_path} local log_file=${persist_log_path}/passwall_${protocol}_${ln_name}_$(date '+%F').log @@ -490,7 +494,7 @@ ln_run() { ${file_func:-echolog " - ${ln_name}"} "$@" >> ${log_file} 2>&1 & sys_log=0 fi - if [ "${sys_log}" == "1" ]; then + if [ "${sys_log}" = "1" ]; then echolog "记录 ${ln_name}_${protocol} 到系统日志" ${file_func:-echolog " - ${ln_name}"} "$@" 2>&1 | logger -t PASSWALL_${protocol}_${ln_name} & fi diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua index 641b9169..49308c64 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/ray.lua @@ -152,7 +152,9 @@ if load_balancing_options then -- [[ Load balancing Start ]] o:depends({ [_n("node_add_mode")] = "batch" }) local descrStr = "Example: ^A && B && !C && D$
" descrStr = descrStr .. "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" - descrStr = descrStr .. "Conditions are joined by &&, and their order does not affect the result." + descrStr = descrStr .. "Conditions are joined by && (AND), and their order does not affect the result.
" + descrStr = descrStr .. "Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" + descrStr = descrStr .. "Example: A && B || C && D means (A AND B) OR (C AND D)." o.description = translate(descrStr) o = s:option(ListValue, _n("balancingStrategy"), translate("Balancing Strategy")) diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua index e1023ae8..8dde7edd 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua @@ -154,7 +154,9 @@ if load_urltest_options then -- [[ URLTest Start ]] o:depends({ [_n("node_add_mode")] = "batch" }) local descrStr = "Example: ^A && B && !C && D$
" descrStr = descrStr .. "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" - descrStr = descrStr .. "Conditions are joined by &&, and their order does not affect the result." + descrStr = descrStr .. "Conditions are joined by && (AND), and their order does not affect the result.
" + descrStr = descrStr .. "Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" + descrStr = descrStr .. "Example: A && B || C && D means (A AND B) OR (C AND D)." o.description = translate(descrStr) o = s:option(Value, _n("urltest_url"), translate("Probe URL")) diff --git a/luci-app-passwall2/luasrc/passwall2/api.lua b/luci-app-passwall2/luasrc/passwall2/api.lua index 561b7555..f5bfffc8 100644 --- a/luci-app-passwall2/luasrc/passwall2/api.lua +++ b/luci-app-passwall2/luasrc/passwall2/api.lua @@ -1521,11 +1521,22 @@ end function match_node_rule(name, rule) if not name then return false end if not rule or rule == "" then return true end + -- split rule by || into OR groups + local function split_or(expr) + local t = {} + for part in expr:gmatch("[^|]+") do + part = trim(part) + if part ~= "" then + table.insert(t, part) + end + end + return t + end -- split rule by && local function split_and(expr) local t = {} for part in expr:gmatch("[^&]+") do - part = part:gsub("^%s+", ""):gsub("%s+$", "") + part = trim(part) if part ~= "" then table.insert(t, part) end @@ -1556,13 +1567,22 @@ function match_node_rule(name, rule) -- contains return str:find(cond, 1, true) ~= nil end - -- AND logic - for _, cond in ipairs(split_and(rule)) do - if not match_cond(name, cond) then - return false + -- check if all conditions in AND group match + local function match_and_group(str, group_expr) + for _, cond in ipairs(split_and(group_expr)) do + if not match_cond(str, cond) then + return false + end + end + return true + end + -- OR logic: return true if any group matches + for _, group in ipairs(split_or(rule)) do + if match_and_group(name, group) then + return true end end - return true + return false end function get_core(field, candidates) diff --git a/luci-app-passwall2/po/fa/passwall2.po b/luci-app-passwall2/po/fa/passwall2.po index f464183a..3c185094 100644 --- a/luci-app-passwall2/po/fa/passwall2.po +++ b/luci-app-passwall2/po/fa/passwall2.po @@ -394,11 +394,15 @@ msgstr "قوانین تطبیق گره" msgid "" "Example: ^A && B && !C && D$
" "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" -"Conditions are joined by &&, and their order does not affect the result." +"Conditions are joined by && (AND), and their order does not affect the result.
" +"Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" +"Example: A && B || C && D means (A AND B) OR (C AND D)." msgstr "" "مثال: ^A && B && !C && D$
" "این بدان معناست که توضیحات گره باید با A شروع شود (^)، شامل B باشد، فاقد C باشد (!)، و با D پایان یابد ($).
" -"شرط‌ها با && به هم متصل می‌شوند و ترتیب آنها تاثیری در نتیجه ندارد." +"شرط‌ها با && (و) به هم متصل می‌شوند و ترتیب آنها تاثیری در نتیجه ندارد.
" +"چندین گروه شرط می‌توانند با || (یا) از هم جدا شوند؛ اگر هر گروهی مطابقت داشته باشد، نتیجه موفقیت‌آمیز است.
" +"مثال: A && B || C && D به معنای (A و B) یا (C و D) است." msgid "Balancing Strategy" diff --git a/luci-app-passwall2/po/ru/passwall2.po b/luci-app-passwall2/po/ru/passwall2.po index 1465593f..4bea8828 100644 --- a/luci-app-passwall2/po/ru/passwall2.po +++ b/luci-app-passwall2/po/ru/passwall2.po @@ -391,11 +391,15 @@ msgstr "Правила отбора узлов" msgid "" "Example: ^A && B && !C && D$
" "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" -"Conditions are joined by &&, and their order does not affect the result." +"Conditions are joined by && (AND), and their order does not affect the result.
" +"Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" +"Example: A && B || C && D means (A AND B) OR (C AND D)." msgstr "" "Пример: ^A && B && !C && D$
" "Описание узла должно: начинаться с A (^), содержать B, не содержать C (!), заканчиваться на D ($).
" -"Условия соединяются оператором &&, порядок условий не влияет на результат." +"Условия соединяются оператором && (И), порядок условий не влияет на результат.
" +"Несколько групп условий можно разделить оператором || (ИЛИ); совпадение любой группы считается успехом.
" +"Пример: A && B || C && D означает (A И B) ИЛИ (C И D)." msgid "Balancing Strategy" msgstr "Алгоритм балансировки" diff --git a/luci-app-passwall2/po/zh-cn/passwall2.po b/luci-app-passwall2/po/zh-cn/passwall2.po index 4949ab1d..da052b98 100644 --- a/luci-app-passwall2/po/zh-cn/passwall2.po +++ b/luci-app-passwall2/po/zh-cn/passwall2.po @@ -391,11 +391,15 @@ msgstr "节点匹配规则" msgid "" "Example: ^A && B && !C && D$
" "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" -"Conditions are joined by &&, and their order does not affect the result." +"Conditions are joined by && (AND), and their order does not affect the result.
" +"Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" +"Example: A && B || C && D means (A AND B) OR (C AND D)." msgstr "" "示例:^A && B && !C && D$
" "表示节点备注需同时满足:以 A 开头(^)、包含 B、不包含 C(!)、并以 D 结尾($)。
" -"多个条件使用 && 连接,条件顺序不影响结果。" +"多个条件使用 &&(与)连接,条件顺序不影响结果。
" +"多组条件之间可使用 ||(或)分隔,任意一组匹配即视为成功。
" +"示例:A && B || C && D 表示 (A 且 B) 或 (C 且 D)。" msgid "Balancing Strategy" msgstr "负载均衡策略" diff --git a/luci-app-passwall2/po/zh-tw/passwall2.po b/luci-app-passwall2/po/zh-tw/passwall2.po index c82781b9..9245e80e 100644 --- a/luci-app-passwall2/po/zh-tw/passwall2.po +++ b/luci-app-passwall2/po/zh-tw/passwall2.po @@ -391,11 +391,15 @@ msgstr "節點匹配規則" msgid "" "Example: ^A && B && !C && D$
" "This means the node remark must start with A (^), include B, exclude C (!), and end with D ($).
" -"Conditions are joined by &&, and their order does not affect the result." +"Conditions are joined by && (AND), and their order does not affect the result.
" +"Multiple groups can be separated by || (OR), matching succeeds if any group matches.
" +"Example: A && B || C && D means (A AND B) OR (C AND D)." msgstr "" "示例:^A && B && !C && D$
" "表示節點備註需同時滿足:以 A 開頭(^)、包含 B、不包含 C(!)、並以 D 結尾($)。
" -"多個條件使用 && 連接,條件順序不影響結果。" +"多個條件使用 &&(與)連接,條件順序不影響結果。
" +"多組條件之間可使用 ||(或)分隔,任意一組匹配即視為成功。
" +"示例:A && B || C && D 表示 (A 且 B) 或 (C 且 D)。" msgid "Balancing Strategy" msgstr "負載均衡策略" diff --git a/luci-app-syncthing/Makefile b/luci-app-syncthing/Makefile new file mode 100644 index 00000000..2219fcb2 --- /dev/null +++ b/luci-app-syncthing/Makefile @@ -0,0 +1,22 @@ +# Copyright (C) 2020 Gyj1109 +# 适配 OpenWrt 25.12 修改版 + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-syncthing +PKG_VERSION:=1.0 +PKG_RELEASE:=3 + +LUCI_TITLE:=LuCI support for Syncthing +LUCI_PKGARCH:=all +# 适配 25.12:确保安装了 syncthing 后,LuCI 界面能正确拉起 +LUCI_DEPENDS:=+syncthing + +include $(TOPDIR)/feeds/luci/luci.mk + +# 明确定义配置文件的归属,这对 25.12 的 apk 管理器非常重要 +define Package/$(PKG_NAME)/conffiles +/etc/config/syncthing +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/luci-app-syncthing/README.md b/luci-app-syncthing/README.md new file mode 100644 index 00000000..b07298c1 --- /dev/null +++ b/luci-app-syncthing/README.md @@ -0,0 +1,2 @@ +# luci-app-syncthing +在Potat0000源码基础上进行了汉化优化,官方openwrt23.05.3编译后可使用 diff --git a/luci-app-syncthing/luasrc/controller/syncthing.lua b/luci-app-syncthing/luasrc/controller/syncthing.lua new file mode 100644 index 00000000..ee2ca7ef --- /dev/null +++ b/luci-app-syncthing/luasrc/controller/syncthing.lua @@ -0,0 +1,17 @@ +module("luci.controller.syncthing", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/syncthing") then + return + end + + entry({"admin", "services", "syncthing"}, cbi("syncthing"), _("文件同步"), 10).dependent = true + entry({"admin", "services", "syncthing", "status"}, call("act_status")).leaf = true +end + +function act_status() + local e = {} + e.running = luci.sys.call("pgrep syncthing >/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" ] + } + } +} diff --git a/v2ray-geodata/Makefile b/v2ray-geodata/Makefile index b6590237..dbd69e43 100644 --- a/v2ray-geodata/Makefile +++ b/v2ray-geodata/Makefile @@ -21,13 +21,13 @@ define Download/geoip HASH:=b71d1999439dde2de2d2b6844a2befa50c50211ff739785c005ca7c230a17d6a endef -GEOSITE_VER:=20260711103457 +GEOSITE_VER:=20260712115932 GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER) define Download/geosite URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/ URL_FILE:=dlc.dat FILE:=$(GEOSITE_FILE) - HASH:=1d09df82a533dd9bcdeaa8ddabb81be4cfa031dea211102ab09d115f984fbe36 + HASH:=9c75264410e1cc0dc2de2ba66283f7724c38f2b7476eb8207f7e4cf69ecbb633 endef GEOSITE_IRAN_VER:=202607060129