luci-app-adblock: sync with adblock 3.4.1
* refine logfile search term * textarea 'autoscroll down' in logfile view * left-align blocklist source table plus a more compact design Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
033e903097
commit
931531310e
4 changed files with 95 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
-- Copyright 2017 Dirk Brenken (dev@brenken.org)
|
-- Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
|
||||||
-- This is free software, licensed under the Apache License, Version 2.0
|
-- This is free software, licensed under the Apache License, Version 2.0
|
||||||
|
|
||||||
module("luci.controller.adblock", package.seeall)
|
module("luci.controller.adblock", package.seeall)
|
||||||
|
@ -27,9 +27,9 @@ function logread()
|
||||||
local logfile
|
local logfile
|
||||||
|
|
||||||
if nixio.fs.access("/var/log/messages") then
|
if nixio.fs.access("/var/log/messages") then
|
||||||
logfile = util.trim(util.exec("cat /var/log/messages | grep 'adblock'"))
|
logfile = util.trim(util.exec("cat /var/log/messages | grep -F 'adblock-'"))
|
||||||
else
|
else
|
||||||
logfile = util.trim(util.exec("logread -e 'adblock'"))
|
logfile = util.trim(util.exec("logread -e 'adblock-'"))
|
||||||
end
|
end
|
||||||
templ.render("adblock/logread", {title = i18n.translate("Adblock Logfile"), content = logfile})
|
templ.render("adblock/logread", {title = i18n.translate("Adblock Logfile"), content = logfile})
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- Copyright 2017 Dirk Brenken (dev@brenken.org)
|
-- Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
|
||||||
-- This is free software, licensed under the Apache License, Version 2.0
|
-- This is free software, licensed under the Apache License, Version 2.0
|
||||||
|
|
||||||
local fs = require("nixio.fs")
|
local fs = require("nixio.fs")
|
||||||
|
@ -162,8 +162,8 @@ end
|
||||||
bl = m:section(TypedSection, "source", translate("Blocklist Sources"),
|
bl = m:section(TypedSection, "source", translate("Blocklist Sources"),
|
||||||
translate("Available blocklist sources. ")
|
translate("Available blocklist sources. ")
|
||||||
.. translate("List URLs and Shallalist category selections are configurable in the 'Advanced' section.<br />")
|
.. translate("List URLs and Shallalist category selections are configurable in the 'Advanced' section.<br />")
|
||||||
.. translate("Caution: To prevent OOM exceptions on low memory devices with less than 64 MB free RAM, please do not select too many lists - 5-6 should be sufficient!"))
|
.. translate("Caution: To prevent OOM exceptions on low memory devices with less than 64 MB free RAM, please do not select more than five blocklist sources!"))
|
||||||
bl.template = "cbi/tblsection"
|
bl.template = "adblock/blocklist"
|
||||||
|
|
||||||
name = bl:option(Flag, "enabled", translate("Enabled"))
|
name = bl:option(Flag, "enabled", translate("Enabled"))
|
||||||
name.rmempty = false
|
name.rmempty = false
|
||||||
|
@ -234,7 +234,8 @@ e9.default = e9.disabled
|
||||||
e9.rmempty = true
|
e9.rmempty = true
|
||||||
|
|
||||||
e10 = e:option(Value, "adb_notifycnt", translate("Email Notification Count"),
|
e10 = e:option(Value, "adb_notifycnt", translate("Email Notification Count"),
|
||||||
translate("Raise minimum domain count email notification trigger, to get emails if the overall count is ≤ the given limit (default 0)."))
|
translate("Raise the minimum email notification count, to get emails if the overall count is less or equal to the given limit (default 0),<br />")
|
||||||
|
.. translate("e.g. to receive an email notification with every adblock update set this value to 150000."))
|
||||||
e10.default = 0
|
e10.default = 0
|
||||||
e10.datatype = "min(0)"
|
e10.datatype = "min(0)"
|
||||||
e10.optional = true
|
e10.optional = true
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
<%#
|
||||||
|
Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
|
||||||
|
This is free software, licensed under the Apache License, Version 2.0
|
||||||
|
-%>
|
||||||
|
|
||||||
|
<%-
|
||||||
|
local rowcnt = 1
|
||||||
|
function rowstyle()
|
||||||
|
rowcnt = rowcnt + 1
|
||||||
|
return (rowcnt % 2) + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function width(o)
|
||||||
|
if o.width then
|
||||||
|
if type(o.width) == 'number' then
|
||||||
|
return ' style="width:%dpx"' % o.width
|
||||||
|
end
|
||||||
|
return ' style="width:%s"' % o.width
|
||||||
|
end
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
-%>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
.cbi-section-table-cell,
|
||||||
|
.cbi-section-table-row
|
||||||
|
{
|
||||||
|
text-align:left;
|
||||||
|
margin-right:auto;
|
||||||
|
margin-left:0px;
|
||||||
|
}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
|
||||||
|
<% if self.title then -%>
|
||||||
|
<legend><%=self.title%></legend>
|
||||||
|
<%- end %>
|
||||||
|
<div class="cbi-section-descr"><%=self.description%></div>
|
||||||
|
<div class="cbi-section-node">
|
||||||
|
<%- local count = 0 -%>
|
||||||
|
<table class="cbi-section-table">
|
||||||
|
<tr class="cbi-section-table-titles">
|
||||||
|
<%- if self.sectionhead then -%>
|
||||||
|
<th class="cbi-section-table-cell"><%=self.sectionhead%></th>
|
||||||
|
<%- else -%>
|
||||||
|
<th> </th>
|
||||||
|
<%- end -%>
|
||||||
|
<%- for i, k in pairs(self.children) do -%>
|
||||||
|
<th class="cbi-section-table-cell"<%=width(k)%>>
|
||||||
|
<%-=k.title-%>
|
||||||
|
</th>
|
||||||
|
<%- count = count + 1; end; -%>
|
||||||
|
</tr>
|
||||||
|
<%- local isempty = true
|
||||||
|
for i, k in ipairs(self:cfgsections()) do
|
||||||
|
section = k
|
||||||
|
isempty = false
|
||||||
|
scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" }
|
||||||
|
-%>
|
||||||
|
<tr class="cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>">
|
||||||
|
<th><%=k%></th>
|
||||||
|
<%-
|
||||||
|
for k, node in ipairs(self.children) do
|
||||||
|
if not node.optional then
|
||||||
|
node:render(section, scope or {})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-%>
|
||||||
|
</tr>
|
||||||
|
<%- end -%>
|
||||||
|
<%- if isempty then -%>
|
||||||
|
<tr class="cbi-section-table-row">
|
||||||
|
<td colspan="<%=count%>"><em><br /><%:This section contains no values yet%></em></td>
|
||||||
|
</tr>
|
||||||
|
<%- end -%>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
|
@ -1,5 +1,5 @@
|
||||||
<%#
|
<%#
|
||||||
Copyright 2017 Dirk Brenken (dev@brenken.org)
|
Copyright 2017-2018 Dirk Brenken (dev@brenken.org)
|
||||||
This is free software, licensed under the Apache License, Version 2.0
|
This is free software, licensed under the Apache License, Version 2.0
|
||||||
-%>
|
-%>
|
||||||
|
|
||||||
|
@ -11,4 +11,10 @@ This is free software, licensed under the Apache License, Version 2.0
|
||||||
<textarea id="logread_id" style="width: 100%; height: 450px; border: 1px solid #cccccc; padding: 5px; font-size: 12px; font-family: monospace; resize: none;" readonly="readonly" wrap="off" rows="<%=content:cmatch("\n")+2%>"><%=content:pcdata()%></textarea>
|
<textarea id="logread_id" style="width: 100%; height: 450px; border: 1px solid #cccccc; padding: 5px; font-size: 12px; font-family: monospace; resize: none;" readonly="readonly" wrap="off" rows="<%=content:cmatch("\n")+2%>"><%=content:pcdata()%></textarea>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var textarea = document.getElementById('logread_id');
|
||||||
|
textarea.scrollTop = textarea.scrollHeight;
|
||||||
|
</script>
|
||||||
|
|
||||||
<%+footer%>
|
<%+footer%>
|
||||||
|
|
Loading…
Reference in a new issue