luci-app-adblock: minor fixes 2389/head
authorDirk Brenken <dev@brenken.org>
Sat, 22 Dec 2018 17:37:45 +0000 (18:37 +0100)
committerDirk Brenken <dev@brenken.org>
Sat, 22 Dec 2018 17:37:45 +0000 (18:37 +0100)
* use new XHR default on report page
* fix wrong string.find syntax

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

index 0cfb8fc80c2563e308b8ef843090983ca29dd07a..e5061bc9d9537bf0d9a650175d89c972475967c0 100644 (file)
@@ -54,7 +54,7 @@ function adb_action(name, domain)
                local file = uci:get("adblock", "blacklist", "adb_src") or "/etc/adblock/adblock.blacklist"
                if nixio.fs.access(file) then
                        local blacklist = nixio.fs.readfile(file)
-                       if not string.find(blacklist, domain, 1, plain)
+                       if not string.find(blacklist, domain, 1, true)
                        then
                                nixio.fs.writefile(file, blacklist.. domain.. "\n")
                        end
@@ -63,7 +63,7 @@ function adb_action(name, domain)
                local file = uci:get("adblock", "global", "adb_whitelist") or "/etc/adblock/adblock.whitelist"
                if nixio.fs.access(file) then
                        local whitelist = nixio.fs.readfile(file)
-                       if not string.find(whitelist, domain, 1, plain)
+                       if not string.find(whitelist, domain, 1, true)
                        then
                                nixio.fs.writefile(file, whitelist.. domain.. "\n")
                        end
index a28ca171b6b91b3fef70d80054ede069518ac713..4e3d65ba75e4970fd024cbd55650683135bc20e4 100644 (file)
@@ -166,7 +166,7 @@ This is free software, licensed under the Apache License, Version 2.0
                report_json(json_info);
        });
 
-       XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_json")%>', null,
+       XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_json")%>', null,
        function(x, json_info)
        {
                if (!x || !json_info || !json_info.data)
@@ -188,7 +188,7 @@ This is free software, licensed under the Apache License, Version 2.0
                report_text(x.responseText);
        });
 
-       XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_text")%>', null,
+       XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_text")%>', null,
        function(x)
        {
                if (!x || !x.responseText)