Merge pull request #2389 from dibdot/adblock
luci-app-adblock: minor fixes
This commit is contained in:
commit
31d259a361
2 changed files with 4 additions and 4 deletions
|
@ -54,7 +54,7 @@ function adb_action(name, domain)
|
||||||
local file = uci:get("adblock", "blacklist", "adb_src") or "/etc/adblock/adblock.blacklist"
|
local file = uci:get("adblock", "blacklist", "adb_src") or "/etc/adblock/adblock.blacklist"
|
||||||
if nixio.fs.access(file) then
|
if nixio.fs.access(file) then
|
||||||
local blacklist = nixio.fs.readfile(file)
|
local blacklist = nixio.fs.readfile(file)
|
||||||
if not string.find(blacklist, domain, 1, plain)
|
if not string.find(blacklist, domain, 1, true)
|
||||||
then
|
then
|
||||||
nixio.fs.writefile(file, blacklist.. domain.. "\n")
|
nixio.fs.writefile(file, blacklist.. domain.. "\n")
|
||||||
end
|
end
|
||||||
|
@ -63,7 +63,7 @@ function adb_action(name, domain)
|
||||||
local file = uci:get("adblock", "global", "adb_whitelist") or "/etc/adblock/adblock.whitelist"
|
local file = uci:get("adblock", "global", "adb_whitelist") or "/etc/adblock/adblock.whitelist"
|
||||||
if nixio.fs.access(file) then
|
if nixio.fs.access(file) then
|
||||||
local whitelist = nixio.fs.readfile(file)
|
local whitelist = nixio.fs.readfile(file)
|
||||||
if not string.find(whitelist, domain, 1, plain)
|
if not string.find(whitelist, domain, 1, true)
|
||||||
then
|
then
|
||||||
nixio.fs.writefile(file, whitelist.. domain.. "\n")
|
nixio.fs.writefile(file, whitelist.. domain.. "\n")
|
||||||
end
|
end
|
||||||
|
|
|
@ -166,7 +166,7 @@ This is free software, licensed under the Apache License, Version 2.0
|
||||||
report_json(json_info);
|
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)
|
function(x, json_info)
|
||||||
{
|
{
|
||||||
if (!x || !json_info || !json_info.data)
|
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);
|
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)
|
function(x)
|
||||||
{
|
{
|
||||||
if (!x || !x.responseText)
|
if (!x || !x.responseText)
|
||||||
|
|
Loading…
Reference in a new issue