Merge pull request #6888 from stangri/master-luci-app-adblock-fast

luci-app-adblock-fast: bugfix: prevent runtime errors on empty strings
This commit is contained in:
Stan Grishin 2024-02-05 14:55:57 -07:00 committed by GitHub
commit 0fbe58e84e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 64 additions and 51 deletions

View file

@ -201,8 +201,11 @@ var status = baseclass.extend({
); );
var text = ""; var text = "";
reply.status.warnings.forEach((element) => { reply.status.warnings.forEach((element) => {
text += if (element.id && warningTable[element.id])
warningTable[element.id].format(element.extra || " ") + "<br />"; text +=
warningTable[element.id].format(element.extra || " ") +
"<br />";
else text += _("Unknown warning") + "<br />";
}); });
var warningsText = E("div", {}, text); var warningsText = E("div", {}, text);
var warningsField = E( var warningsField = E(
@ -292,8 +295,10 @@ var status = baseclass.extend({
); );
var text = ""; var text = "";
reply.status.errors.forEach((element) => { reply.status.errors.forEach((element) => {
text += if (element.id && errorTable[element.id])
errorTable[element.id].format(element.extra || " ") + "!<br />"; text +=
errorTable[element.id].format(element.extra || " ") + "!<br />";
else text += _("Unknown error") + "<br />";
}); });
text += _("Errors encountered, please check the %sREADME%s").format( text += _("Errors encountered, please check the %sREADME%s").format(
'<a href="' + pkg.URL + '" target="_blank">', '<a href="' + pkg.URL + '" target="_blank">',

View file

@ -1,7 +1,7 @@
msgid "" msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8" msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:225 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:228
msgid "%s is currently disabled" msgid "%s is currently disabled"
msgstr "" msgstr ""
@ -137,7 +137,7 @@ msgstr ""
msgid "Compressed cache file found." msgid "Compressed cache file found."
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:223 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:226
msgid "Config (%s) validation failure!" msgid "Config (%s) validation failure!"
msgstr "" msgstr ""
@ -171,7 +171,7 @@ msgid ""
"Directory for compressed cache file of block-list in the persistent memory." "Directory for compressed cache file of block-list in the persistent memory."
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:424 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:429
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:356 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:356
msgid "Disable" msgid "Disable"
msgstr "" msgstr ""
@ -184,7 +184,7 @@ msgstr ""
msgid "Disabled" msgid "Disabled"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:418 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:423
msgid "Disabling %s service" msgid "Disabling %s service"
msgstr "" msgstr ""
@ -213,7 +213,7 @@ msgstr ""
msgid "Downloading lists" msgid "Downloading lists"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:405 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:410
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:357 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:357
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:511 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:511
msgid "Enable" msgid "Enable"
@ -228,7 +228,7 @@ msgstr ""
msgid "Enables debug output to /tmp/adblock-fast.log." msgid "Enables debug output to /tmp/adblock-fast.log."
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:399 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:404
msgid "Enabling %s service" msgid "Enabling %s service"
msgstr "" msgstr ""
@ -236,7 +236,7 @@ msgstr ""
msgid "Error" msgid "Error"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:298 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:303
msgid "Errors encountered, please check the %sREADME%s" msgid "Errors encountered, please check the %sREADME%s"
msgstr "" msgstr ""
@ -244,83 +244,83 @@ msgstr ""
msgid "Fail" msgid "Fail"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:248 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:251
msgid "Failed to access shared memory" msgid "Failed to access shared memory"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:244 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:247
msgid "Failed to create '%s' file" msgid "Failed to create '%s' file"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:266 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:269
msgid "Failed to create block-list or restart DNS resolver" msgid "Failed to create block-list or restart DNS resolver"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:257 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:260
msgid "Failed to create compressed cache" msgid "Failed to create compressed cache"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:243 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:246
msgid "Failed to create directory for %s file" msgid "Failed to create directory for %s file"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:278 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:281
msgid "Failed to create output/cache/gzip file directory" msgid "Failed to create output/cache/gzip file directory"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:280 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:283
msgid "Failed to detect format %s" msgid "Failed to detect format %s"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:273 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:276
msgid "Failed to download %s" msgid "Failed to download %s"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:271 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:274
msgid "Failed to download Config Update file" msgid "Failed to download Config Update file"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:252 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:255
msgid "Failed to format data file" msgid "Failed to format data file"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:261 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:264
msgid "Failed to move '%s' to '%s'" msgid "Failed to move '%s' to '%s'"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:254 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:257
msgid "Failed to move temporary data file to '%s'" msgid "Failed to move temporary data file to '%s'"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:250 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:253
msgid "Failed to optimize data file" msgid "Failed to optimize data file"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:275 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:278
msgid "Failed to parse %s" msgid "Failed to parse %s"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:274 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:277
msgid "Failed to parse Config Update file" msgid "Failed to parse Config Update file"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:251 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:254
msgid "Failed to process allow-list" msgid "Failed to process allow-list"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:269 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:272
msgid "Failed to reload/restart DNS resolver" msgid "Failed to reload/restart DNS resolver"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:259 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:262
msgid "Failed to remove temporary files" msgid "Failed to remove temporary files"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:247 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:250
msgid "Failed to restart/reload DNS resolver" msgid "Failed to restart/reload DNS resolver"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:249 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:252
msgid "Failed to sort data file" msgid "Failed to sort data file"
msgstr "" msgstr ""
@ -328,11 +328,11 @@ msgstr ""
msgid "Failed to start" msgid "Failed to start"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:268 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:271
msgid "Failed to stop %s" msgid "Failed to stop %s"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:260 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:263
msgid "Failed to unpack compressed cache" msgid "Failed to unpack compressed cache"
msgstr "" msgstr ""
@ -357,7 +357,7 @@ msgstr ""
msgid "Force Router DNS server to all local devices" msgid "Force Router DNS server to all local devices"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:346 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:351
msgid "Force redownloading %s block lists" msgid "Force redownloading %s block lists"
msgstr "" msgstr ""
@ -365,7 +365,7 @@ msgstr ""
msgid "Forces Router DNS use on local devices, also known as DNS Hijacking." msgid "Forces Router DNS use on local devices, also known as DNS Hijacking."
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:285 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:288
msgid "Free ram (%s) is not enough to process all enabled block-lists" msgid "Free ram (%s) is not enough to process all enabled block-lists"
msgstr "" msgstr ""
@ -423,11 +423,11 @@ msgstr ""
msgid "No AdBlock on dnsmasq" msgid "No AdBlock on dnsmasq"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:276 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:279
msgid "No HTTPS/SSL support on device" msgid "No HTTPS/SSL support on device"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:282 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:285
msgid "No blocked list URLs nor blocked-domains enabled" msgid "No blocked list URLs nor blocked-domains enabled"
msgstr "" msgstr ""
@ -439,11 +439,11 @@ msgstr ""
msgid "Output Verbosity Setting" msgid "Output Verbosity Setting"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:367 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:372
msgid "Pause" msgid "Pause"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:362 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:367
msgid "Pausing %s" msgid "Pausing %s"
msgstr "" msgstr ""
@ -481,7 +481,7 @@ msgstr ""
msgid "Processing lists" msgid "Processing lists"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:352 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:357
msgid "Redownload" msgid "Redownload"
msgstr "" msgstr ""
@ -490,11 +490,11 @@ msgstr ""
msgid "Restarting" msgid "Restarting"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:465 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:470
msgid "Service Control" msgid "Service Control"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:291 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:294
msgid "Service Errors" msgid "Service Errors"
msgstr "" msgstr ""
@ -526,7 +526,7 @@ msgstr ""
msgid "Some recommended packages are missing" msgid "Some recommended packages are missing"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:333 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:338
msgid "Start" msgid "Start"
msgstr "" msgstr ""
@ -535,7 +535,7 @@ msgstr ""
msgid "Starting" msgid "Starting"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:327 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:332
msgid "Starting %s service" msgid "Starting %s service"
msgstr "" msgstr ""
@ -543,7 +543,7 @@ msgstr ""
msgid "Status" msgid "Status"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:386 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:391
msgid "Stop" msgid "Stop"
msgstr "" msgstr ""
@ -556,7 +556,7 @@ msgstr ""
msgid "Stopped" msgid "Stopped"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:380 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:385
msgid "Stopping %s service" msgid "Stopping %s service"
msgstr "" msgstr ""
@ -572,29 +572,29 @@ msgstr ""
msgid "Suppress output" msgid "Suppress output"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:241 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:244
msgid "The %s failed to discover WAN gateway" msgid "The %s failed to discover WAN gateway"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:229 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:232
msgid "" msgid ""
"The dnsmasq ipset support is enabled, but dnsmasq is either not installed or " "The dnsmasq ipset support is enabled, but dnsmasq is either not installed or "
"installed dnsmasq does not support ipset" "installed dnsmasq does not support ipset"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:232 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:235
msgid "" msgid ""
"The dnsmasq ipset support is enabled, but ipset is either not installed or " "The dnsmasq ipset support is enabled, but ipset is either not installed or "
"installed ipset does not support '%s' type" "installed ipset does not support '%s' type"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:235 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:238
msgid "" msgid ""
"The dnsmasq nft set support is enabled, but dnsmasq is either not installed " "The dnsmasq nft set support is enabled, but dnsmasq is either not installed "
"or installed dnsmasq does not support nft set" "or installed dnsmasq does not support nft set"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:238 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:241
msgid "The dnsmasq nft sets support is enabled, but nft is not installed" msgid "The dnsmasq nft sets support is enabled, but nft is not installed"
msgstr "" msgstr ""
@ -616,6 +616,14 @@ msgstr ""
msgid "Unknown" msgid "Unknown"
msgstr "" msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:301
msgid "Unknown error"
msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/adblock-fast/status.js:208
msgid "Unknown warning"
msgstr ""
#: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:253 #: applications/luci-app-adblock-fast/htdocs/luci-static/resources/view/adblock-fast/overview.js:253
msgid "Use AdBlocking on the SmartDNS instance(s)" msgid "Use AdBlocking on the SmartDNS instance(s)"
msgstr "" msgstr ""