From 0299b132928afcc32a58f772e7f510086b3efca0 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sat, 22 Dec 2018 18:37:45 +0100 Subject: [PATCH] luci-app-adblock: minor fixes * use new XHR default on report page * fix wrong string.find syntax Signed-off-by: Dirk Brenken --- applications/luci-app-adblock/luasrc/controller/adblock.lua | 4 ++-- applications/luci-app-adblock/luasrc/view/adblock/report.htm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/luci-app-adblock/luasrc/controller/adblock.lua b/applications/luci-app-adblock/luasrc/controller/adblock.lua index 0cfb8fc80..e5061bc9d 100644 --- a/applications/luci-app-adblock/luasrc/controller/adblock.lua +++ b/applications/luci-app-adblock/luasrc/controller/adblock.lua @@ -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 diff --git a/applications/luci-app-adblock/luasrc/view/adblock/report.htm b/applications/luci-app-adblock/luasrc/view/adblock/report.htm index a28ca171b..4e3d65ba7 100644 --- a/applications/luci-app-adblock/luasrc/view/adblock/report.htm +++ b/applications/luci-app-adblock/luasrc/view/adblock/report.htm @@ -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) -- 2.25.1