diff options
5 files changed, 143 insertions, 102 deletions
diff --git a/applications/luci-app-pbr/Makefile b/applications/luci-app-pbr/Makefile index e5f88c44dc..ce6e02fc99 100644 --- a/applications/luci-app-pbr/Makefile +++ b/applications/luci-app-pbr/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca> -PKG_VERSION:=1.1.0-1 +PKG_VERSION:=1.1.1-1 LUCI_TITLE:=Policy Based Routing Service Web UI LUCI_DESCRIPTION:=Provides Web UI for Policy Based Routing Service. diff --git a/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js b/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js index dcb3c3ec50..24f624c945 100644 --- a/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js +++ b/applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js @@ -181,17 +181,19 @@ var status = baseclass.extend({ warningTorUnsetProto: _("Please unset 'proto' or set 'proto' to 'all' for policy '%s'"), warningTorUnsetChainIpt: _("Please unset 'chain' or set 'chain' to 'PREROUTING' for policy '%s'"), warningTorUnsetChainNft: _("Please unset 'chain' or set 'chain' to 'prerouting' for policy '%s'"), + warningInvalidOVPNConfig: _("Invalid OpenVPN config for %s interface"), + warningOutdatedWebUIApp: _("The WebUI application is outdated (version %s), please update it"), }; var warningsTitle = E('label', { class: 'cbi-value-title' }, _("Service Warnings")); var text = ""; (reply.warnings).forEach(element => { if (element.id && textLabelsTable[element.id]) { if (element.id !== 'warningPolicyProcessCMD') { - text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />"; + text += (textLabelsTable[element.id] + '.').format(element.extra || ' ') + "<br />"; } } else { - text += _("Unknown Warning!") + "<br />"; + text += _("Unknown Warning.") + "<br />"; } }); var warningsText = E('div', {}, text); @@ -202,28 +204,28 @@ var status = baseclass.extend({ var errorsDiv = []; if (reply.errors && reply.errors.length) { var textLabelsTable = { - errorConfigValidation: _("Config (%s) validation failure!").format('/etc/config/' + pkg.Name), - errorNoIpFull: _("%s binary cannot be found!").format('ip-full'), - errorNoIptables: _("%s binary cannot be found!").format('iptables'), - errorNoIpset: _("Resolver set support (%s) requires ipset, but ipset binary cannot be found!").format(uci.get(pkg.Name, 'config', 'resolver_set')), - errorNoNft: _("Resolver set support (%s) requires nftables, but nft binary cannot be found!").format(uci.get(pkg.Name, 'config', 'resolver_set')), - errorResolverNotSupported: _("Resolver set (%s) is not supported on this system!").format(uci.get(pkg.Name, 'config', 'resolver_set')), - errorServiceDisabled: _("The %s service is currently disabled!").format(pkg.Name), - errorNoWanGateway: _("The %s service failed to discover WAN gateway!").format(pkg.Name), - errorIpsetNameTooLong: _("The ipset name '%s' is longer than allowed 31 characters!"), - errorNftsetNameTooLong: _("The nft set name '%s' is longer than allowed 31 characters!"), - errorUnexpectedExit: _("Unexpected exit or service termination: '%s'!"), - errorPolicyNoSrcDest: _("Policy '%s' has no source/destination parameters!"), - errorPolicyNoInterface: _("Policy '%s' has no assigned interface!"), - errorPolicyUnknownInterface: _("Policy '%s' has an unknown interface!"), + errorConfigValidation: _("Config (%s) validation failure").format('/etc/config/' + pkg.Name), + errorNoIpFull: _("%s binary cannot be found").format('ip-full'), + errorNoIptables: _("%s binary cannot be found").format('iptables'), + errorNoIpset: _("Resolver set support (%s) requires ipset, but ipset binary cannot be found").format(uci.get(pkg.Name, 'config', 'resolver_set')), + errorNoNft: _("Resolver set support (%s) requires nftables, but nft binary cannot be found").format(uci.get(pkg.Name, 'config', 'resolver_set')), + errorResolverNotSupported: _("Resolver set (%s) is not supported on this system").format(uci.get(pkg.Name, 'config', 'resolver_set')), + errorServiceDisabled: _("The %s service is currently disabled").format(pkg.Name), + errorNoWanGateway: _("The %s service failed to discover WAN gateway").format(pkg.Name), + errorIpsetNameTooLong: _("The ipset name '%s' is longer than allowed 31 characters"), + errorNftsetNameTooLong: _("The nft set name '%s' is longer than allowed 31 characters"), + errorUnexpectedExit: _("Unexpected exit or service termination: '%s'"), + errorPolicyNoSrcDest: _("Policy '%s' has no source/destination parameters"), + errorPolicyNoInterface: _("Policy '%s' has no assigned interface"), + errorPolicyUnknownInterface: _("Policy '%s' has an unknown interface"), errorPolicyProcessCMD: _("%s"), - errorFailedSetup: _("Failed to set up '%s'!"), - errorFailedReload: _("Failed to reload '%s'!"), - errorUserFileNotFound: _("Custom user file '%s' not found or empty!"), - ererrorUserFileSyntax: _("Syntax error in custom user file '%s'!"), - errorUserFileRunning: _("Error running custom user file '%s'!"), - errorUserFileNoCurl: _("Use of 'curl' is detected in custom user file '%s', but 'curl' isn't installed!"), - errorNoGateways: _("Failed to set up any gateway!"), + errorFailedSetup: _("Failed to set up '%s'"), + errorFailedReload: _("Failed to reload '%s'"), + errorUserFileNotFound: _("Custom user file '%s' not found or empty"), + errorUserFileSyntax: _("Syntax error in custom user file '%s'"), + errorUserFileRunning: _("Error running custom user file '%s'"), + errorUserFileNoCurl: _("Use of 'curl' is detected in custom user file '%s', but 'curl' isn't installed"), + errorNoGateways: _("Failed to set up any gateway"), errorResolver: _("Resolver %s"), errorPolicyProcessNoIpv6: _("Skipping IPv6 policy '%s' as IPv6 support is disabled"), errorPolicyProcessUnknownFwmark: _("Unknown packet mark for interface '%s'"), @@ -233,13 +235,14 @@ var status = baseclass.extend({ errorPolicyProcessInsertionFailedIpv4: _("Insertion failed for IPv4 for policy %s"), errorInterfaceRoutingEmptyValues: _("Received empty tid/mark or interface name when setting up routing"), errorFailedToResolve: _("Failed to resolve %s"), + errorInvalidOVPNConfig: _("Invalid OpenVPN config for %s interface"), }; var errorsTitle = E('label', { class: 'cbi-value-title' }, _("Service Errors")); var text = ""; (reply.errors).forEach(element => { if (element.id && textLabelsTable[element.id]) { if (element.id !== 'errorPolicyProcessCMD') { - text += (textLabelsTable[element.id]).format(element.extra || ' ') + "<br />"; + text += (textLabelsTable[element.id] + '!').format(element.extra || ' ') + "<br />"; } } else { diff --git a/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js b/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js index 5ddf263a1e..2b5adaeb2e 100644 --- a/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js +++ b/applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js @@ -61,7 +61,7 @@ return view.extend({ _("%sWARNING:%s Please make sure to check the %sREADME%s before changing anything in this section! " + "Change any of the settings below with extreme caution!%s").format( "<br/>    <b>", "</b>", - "<a href=\"" + pkg.URL + "#service-configuration-settings \" target=\"_blank\">", "</a>", "<br/><br/>")); + "<a href=\"" + pkg.URL + "#service-configuration-settings\" target=\"_blank\">", "</a>", "<br/><br/>")); s.tab("tab_webui", _("Web UI Configuration")) o = s.taboption("tab_basic", form.ListValue, "verbosity", _("Output verbosity"), diff --git a/applications/luci-app-pbr/po/templates/pbr.pot b/applications/luci-app-pbr/po/templates/pbr.pot index f8827ce543..8c5194160a 100644 --- a/applications/luci-app-pbr/po/templates/pbr.pot +++ b/applications/luci-app-pbr/po/templates/pbr.pot @@ -2,13 +2,13 @@ msgid "" msgstr "Content-Type: text/plain; charset=UTF-8" #: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:179 -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:219 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:221 msgid "%s" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:206 -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:207 -msgid "%s binary cannot be found!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:208 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:209 +msgid "%s binary cannot be found" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:61 @@ -67,8 +67,8 @@ msgstr "" msgid "Condensed output" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:205 -msgid "Config (%s) validation failure!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:207 +msgid "Config (%s) validation failure" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:68 @@ -79,8 +79,8 @@ msgstr "" msgid "Custom User File Includes" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:222 -msgid "Custom user file '%s' not found or empty!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:224 +msgid "Custom user file '%s' not found or empty" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:254 @@ -95,7 +95,7 @@ msgstr "" msgid "Default ICMP Interface" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:310 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:313 msgid "Disable" msgstr "" @@ -105,7 +105,7 @@ msgstr "" msgid "Disabled" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:306 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:309 msgid "Disabling %s service" msgstr "" @@ -127,7 +127,7 @@ msgstr "" msgid "Do not enforce policies when their gateway is down" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:299 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:302 msgid "Enable" msgstr "" @@ -138,12 +138,12 @@ msgstr "" msgid "Enabled" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:295 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:298 msgid "Enabling %s service" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:224 -msgid "Error running custom user file '%s'!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:226 +msgid "Error running custom user file '%s'" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:162 @@ -152,20 +152,20 @@ msgid "" "QoS. Change with caution together with" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:221 -msgid "Failed to reload '%s'!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:223 +msgid "Failed to reload '%s'" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:235 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:237 msgid "Failed to resolve %s" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:220 -msgid "Failed to set up '%s'!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:222 +msgid "Failed to set up '%s'" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:226 -msgid "Failed to set up any gateway!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:228 +msgid "Failed to set up any gateway" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:138 @@ -188,11 +188,11 @@ msgstr "" msgid "Insert" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:233 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:235 msgid "Insertion failed for IPv4 for policy %s" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:232 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:234 msgid "Insertion failed for both IPv4 and IPv6 for policy %s" msgstr "" @@ -204,6 +204,11 @@ msgstr "" msgid "Interface" msgstr "" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:184 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:238 +msgid "Invalid OpenVPN config for %s interface" +msgstr "" + #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:195 msgid "Local addresses / devices" msgstr "" @@ -212,7 +217,7 @@ msgstr "" msgid "Local ports" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:230 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:232 msgid "Mismatched IP family between in policy %s" msgstr "" @@ -268,16 +273,16 @@ msgstr "" msgid "Policies" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:218 -msgid "Policy '%s' has an unknown interface!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:220 +msgid "Policy '%s' has an unknown interface" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:217 -msgid "Policy '%s' has no assigned interface!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:219 +msgid "Policy '%s' has no assigned interface" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:216 -msgid "Policy '%s' has no source/destination parameters!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:218 +msgid "Policy '%s' has no source/destination parameters" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:56 @@ -296,7 +301,7 @@ msgstr "" msgid "Protocol" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:234 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:236 msgid "Received empty tid/mark or interface name when setting up routing" msgstr "" @@ -308,33 +313,33 @@ msgstr "" msgid "Remote ports" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:227 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:229 msgid "Resolver %s" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:210 -msgid "Resolver set (%s) is not supported on this system!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:212 +msgid "Resolver set (%s) is not supported on this system" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:177 msgid "Resolver set (%s) is not supported on this system." msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:208 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:210 msgid "" -"Resolver set support (%s) requires ipset, but ipset binary cannot be found!" +"Resolver set support (%s) requires ipset, but ipset binary cannot be found" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:209 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:211 msgid "" -"Resolver set support (%s) requires nftables, but nft binary cannot be found!" +"Resolver set support (%s) requires nftables, but nft binary cannot be found" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:277 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:280 msgid "Restart" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:273 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:276 msgid "Restarting %s service" msgstr "" @@ -368,11 +373,11 @@ msgstr "" msgid "Select Add for -A/add and Insert for -I/Insert." msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:334 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:337 msgid "Service Control" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:237 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:240 msgid "Service Errors" msgstr "" @@ -389,7 +394,7 @@ msgstr "" msgid "Service Status" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:185 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:187 msgid "Service Warnings" msgstr "" @@ -399,15 +404,15 @@ msgid "" "%sREADME%s for details." msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:228 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:230 msgid "Skipping IPv6 policy '%s' as IPv6 support is disabled" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:266 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:269 msgid "Start" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:262 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:265 msgid "Starting %s service" msgstr "" @@ -421,7 +426,7 @@ msgstr "" msgid "Starting (WAN) Table ID number for tables created by the service." msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:288 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:291 msgid "Stop" msgstr "" @@ -433,7 +438,7 @@ msgstr "" msgid "Stopped (version: %s)" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:284 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:287 msgid "Stopping %s service" msgstr "" @@ -457,8 +462,8 @@ msgstr "" msgid "Suppress/No output" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:223 -msgid "Syntax error in custom user file '%s'!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:225 +msgid "Syntax error in custom user file '%s'" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:166 @@ -471,12 +476,12 @@ msgstr "" msgid "The %s is not supported on this system." msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:212 -msgid "The %s service failed to discover WAN gateway!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:214 +msgid "The %s service failed to discover WAN gateway" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:211 -msgid "The %s service is currently disabled!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:213 +msgid "The %s service is currently disabled" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:83 @@ -485,38 +490,42 @@ msgstr "" msgid "The %s support is unknown." msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:213 -msgid "The ipset name '%s' is longer than allowed 31 characters!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:185 +msgid "The WebUI application is outdated (version %s), please update it" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:214 -msgid "The nft set name '%s' is longer than allowed 31 characters!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:215 +msgid "The ipset name '%s' is longer than allowed 31 characters" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:215 -msgid "Unexpected exit or service termination: '%s'!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:216 +msgid "The nft set name '%s' is longer than allowed 31 characters" +msgstr "" + +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:217 +msgid "Unexpected exit or service termination: '%s'" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:246 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:249 msgid "Unknown Error!" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:194 -msgid "Unknown Warning!" +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:196 +msgid "Unknown Warning." msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:229 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:231 msgid "Unknown packet mark for interface '%s'" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:231 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:233 msgid "Unknown protocol in policy %s" msgstr "" -#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:225 +#: applications/luci-app-pbr/htdocs/luci-static/resources/pbr/status.js:227 msgid "" "Use of 'curl' is detected in custom user file '%s', but 'curl' isn't " -"installed!" +"installed" msgstr "" #: applications/luci-app-pbr/htdocs/luci-static/resources/view/pbr/overview.js:102 diff --git a/applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr b/applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr index bd7700c277..630bddf59c 100755 --- a/applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr +++ b/applications/luci-app-pbr/root/usr/libexec/rpcd/luci.pbr @@ -34,7 +34,9 @@ print_json_string() { json_init; json_add_string "$1" "$2"; json_dump; json_clea logger() { /usr/bin/logger -t "$packageName" "$@"; } ubus_get_status() { ubus call service list "{ 'name': '$packageName' }" | jsonfilter -e "@['${packageName}'].instances.main.data.status.${1}"; } ubus_get_gateway() { ubus call service list "{ 'name': '$packageName' }" | jsonfilter -e "@['${packageName}'].instances.main.data.gateways[@.name='${1}']${2:+.$2}"; } +is_greater() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } is_greater_or_equal() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" = "$2"; } +opkg_get_version() { grep -m1 -A1 "$1" '/usr/lib/opkg/status' | grep -m1 'Version: ' | sed 's|Version: \(.*\)|\1|'; } get_init_list() { local name @@ -130,20 +132,26 @@ EOF if [ -n "$warnings" ]; then while read -r line; do if str_contains "$line" ' '; then - error_id="${line% *}" - error_extra="${line#* }" + warning_id="${line% *}" + warning_extra="${line#* }" else - error_id="$line" - unset error_extra + warning_id="$line" + unset warning_extra fi json_add_object - json_add_string 'id' "$error_id" - json_add_string 'extra' "$error_extra" + json_add_string 'id' "$warning_id" + json_add_string 'extra' "$warning_extra" json_close_object done <<EOF $(echo "$warnings" | tr \# \\n) EOF fi + if is_greater "$(opkg_get_version "${name}")" "$(opkg_get_version "luci-app-${name}")"; then + json_add_object + json_add_string 'id' 'warningOutdatedWebUIApp' + json_add_string 'extra' "$(opkg_get_version "luci-app-${name}")" + json_close_object + fi json_close_array json_close_object json_dump @@ -158,7 +166,7 @@ check_unbound() { command -v unbound >/dev/null 2>&1; } check_agh_ipset() { check_ipset || return 1 check_agh || return 1 - is_greater_or_equal "$($agh --version | sed 's|AdGuard Home, version v\(.*\)|\1|')" '0.107.13' + is_greater_or_equal "$($agh --version | sed 's|AdGuard Home, version v\(.*\)|\1|' | sed 's|-.*||')" '0.107.13' } check_dnsmasq_ipset() { local o; @@ -246,6 +254,15 @@ is_ovpn() { local dev; network_get_device dev "$1"; [ "${dev:0:3}" = "tun" ] || is_pptp() { local proto; proto=$(uci -q get network."$1".proto); [ "${proto:0:4}" = "pptp" ]; } is_softether() { local dev; network_get_device dev "$1"; [ "${dev:0:4}" = "vpn_" ]; } is_tor() { [ "$(str_to_lower "$1")" = "tor" ]; } +is_tor_running() { + local ret=0 + if [ -s "/etc/tor/torrc" ]; then + json_load "$(ubus call service list "{ 'name': 'tor' }")" + json_select 'tor'; json_select 'instances'; json_select 'instance1'; + json_get_var ret 'running'; json_cleanup + fi + if [ "$ret" = "0" ]; then return 1; else return 0; fi +} is_wg() { local proto; proto=$(uci -q get network."$1".proto); [ "${proto:0:9}" = "wireguard" ]; } is_tunnel() { is_dslite "$1" || is_l2tp "$1" || is_oc "$1" || is_ovpn "$1" || is_pptp "$1" || is_softether "$1" || is_tor "$1" || is_wg "$1"; } is_wan() { [ "$1" = "$wanIface4" ] || { [ "${1##wan}" != "$1" ] && [ "${1##wan6}" = "$1" ]; } || [ "${1%%wan}" != "$1" ]; } @@ -264,25 +281,37 @@ pbr_find_iface() { fi eval "$1"='${iface:-$i}' } +_find_firewall_wan_zone() { [ "$(uci -q get "firewall.${1}.name")" = "wan" ] && firewallWanZone="$1"; } _build_ifaces_all() { ifacesAll="${ifacesAll}${1} "; } -_build_ifaces_supported() { is_supported_interface "$1" && ifacesSupported="${ifacesSupported}${1} "; } +_build_ifaces_supported() { is_supported_interface "$1" && ! str_contains "$ifacesSupported" "$1" && ifacesSupported="${ifacesSupported}${1} "; } get_supported_interfaces() { local name i name="$(basename "$1")" name="${name:-$packageName}" + local firewallWanZone local ifacesAll ifacesSupported local webui_show_ignore_target local ignored_interface supported_interface local wanIface4 wanIface6 - config_load "$name" + config_load "$packageName" config_get_bool webui_show_ignore_target 'config' 'webui_show_ignore_target' '0' config_get ignored_interface 'config' 'ignored_interface' config_get supported_interface 'config' 'supported_interface' + local i config_load 'network' config_foreach _build_ifaces_all 'interface' pbr_find_iface wanIface4 'wan' pbr_find_iface wanIface6 'wan6' + config_load 'firewall' + config_foreach _find_firewall_wan_zone 'zone' + for i in $(uci -q get "firewall.${firewallWanZone}.network"); do + is_supported_interface "$i" && ! str_contains "$ifacesSupported" "$1" && ifacesSupported="${ifacesSupported}${i} " + done + config_load 'network' config_foreach _build_ifaces_supported 'interface' + if is_tor_running; then + ifacesSupported="$ifacesSupported tor" + fi if [ "$webui_show_ignore_target" -eq "1" ]; then ifacesSupported="$ifacesSupported ignore" fi |