luci-app-adblock: sync with adblock 3.8.3 3012/head
authorDirk Brenken <dev@brenken.org>
Mon, 26 Aug 2019 09:46:33 +0000 (11:46 +0200)
committerDirk Brenken <dev@brenken.org>
Mon, 26 Aug 2019 12:09:39 +0000 (14:09 +0200)
* fix a suspend/resume issue
* format overall domains with a thousands separator

Signed-off-by: Dirk Brenken <dev@brenken.org>
applications/luci-app-adblock/luasrc/controller/adblock.lua
applications/luci-app-adblock/luasrc/view/adblock/runtime.htm

index d75296275f14586a1505aca08ed8ae50ba7ec53c..bee1d14396664c03b4a3b79f99b332a2958fe3d3 100644 (file)
@@ -53,12 +53,6 @@ function adb_action(name, ...)
                luci.sys.call("/etc/init.d/adblock resume >/dev/null 2>&1")
        elseif name == "do_refresh" then
                luci.sys.call("/etc/init.d/adblock reload >/dev/null 2>&1")
-               local pid_file = "/var/run/adblock.pid"
-               if nixio.fs.access(pid_file) then
-                       repeat
-                               nixio.nanosleep(1)
-                       until nixio.fs.readfile(pid_file) == ""
-               end
        elseif name == "do_report" then
                luci.sys.call("/etc/init.d/adblock report " ..table.concat(report_params, " ").. " >/dev/null 2>&1")
                local rep_dir  = uci:get("adblock", "extra", "adb_repdir") or "/tmp"
@@ -90,6 +84,14 @@ function adb_action(name, ...)
                        end
                end
        end
+       if name == "do_suspend" or name == "do_resume" or name == "do_refresh" then
+               local pid_file = "/var/run/adblock.pid"
+               if nixio.fs.access(pid_file) then
+                       repeat
+                               nixio.nanosleep(1)
+                       until nixio.fs.readfile(pid_file) == ""
+               end
+       end
        luci.http.prepare_content("text/plain") 
        luci.http.write("0")
 end
index b5cf832913428da53217a5e789373e6cf307ff27..2cec5733460f811aeb0bbcbde4eb9e1e5d6e628f 100644 (file)
@@ -6,6 +6,12 @@ This is free software, licensed under the Apache License, Version 2.0
 <%+adblock/adblock_css%>
 <script type="text/javascript">
 //<![CDATA[
+       function format(number)
+       {
+               var string = number.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.');
+               return string;
+       }
+
        function status_update(json)
        {
                var btn1         = document.getElementById("btn1");
@@ -52,7 +58,7 @@ This is free software, licensed under the Apache License, Version 2.0
                document.getElementById("value_4").innerHTML = json.data.dns_backend || "-";
                document.getElementById("value_5").innerHTML = json.data.dns_variant || "-";
                document.getElementById("value_6").innerHTML = json.data.backup_dir || "-";
-               document.getElementById("value_7").innerHTML = json.data.overall_domains || "-";
+               document.getElementById("value_7").innerHTML = format(json.data.overall_domains) || "-";
                document.getElementById("value_8").innerHTML = json.data.last_rundate || "-";
        }