diff options
Diffstat (limited to 'applications/luci-app-adblock/luasrc/view/adblock')
6 files changed, 0 insertions, 756 deletions
diff --git a/applications/luci-app-adblock/luasrc/view/adblock/adblock_css.htm b/applications/luci-app-adblock/luasrc/view/adblock/adblock_css.htm deleted file mode 100644 index 5467c8763..000000000 --- a/applications/luci-app-adblock/luasrc/view/adblock/adblock_css.htm +++ /dev/null @@ -1,86 +0,0 @@ -<style type="text/css"> - textarea - { - width: 100% !important; - height: 450px !important; - border: 1px solid #cccccc; - padding: 5px; - font-size: 12px; - font-family: monospace; - resize: none; - white-space: pre; - overflow-wrap: normal; - overflow-x: scroll; - } - - select[readonly], - textarea[readonly] - { - width: 100% !important; - height: 450px !important; - border: 1px solid #cccccc; - padding: 5px; - font-size: 12px; - font-family: monospace; - resize: none; - pointer-events: auto; - cursor: auto; - } - - .table.cbi-section-table .th, - .table.cbi-section-table .td, - .cbi-section-table-cell, - .cbi-section-table-row, - .tr[data-title]::before - { - text-align: left !important; - vertical-align: top; - margin-left: 0px; - padding-left: 2px; - } - - .table.cbi-section-table .th - { - white-space: nowrap; - } - - .cbi-section-table-row > .cbi-value-field .cbi-input-select, - .table.cbi-section-table select - { - width: 70px; - } - - .item, - .add-item - { - white-space: nowrap; - width: 8.2em; - } - - .cbi-input-checkbox - { - height: 1em; - } - - .cbi-button - { - -webkit-appearance: menulist; - } - - .runtime - { - color: #37c; - font-weight: bold; - display: inline-block; - width: 100%; - padding-top: 0.5rem; - } - - .button_running - { - display: inline-block; - width: 16px; - height: 16px; - margin: 0 5px; - } -</style> diff --git a/applications/luci-app-adblock/luasrc/view/adblock/blocklist.htm b/applications/luci-app-adblock/luasrc/view/adblock/blocklist.htm deleted file mode 100644 index c90afe768..000000000 --- a/applications/luci-app-adblock/luasrc/view/adblock/blocklist.htm +++ /dev/null @@ -1,47 +0,0 @@ -<%# -Copyright 2017-2018 Dirk Brenken (dev@brenken.org) -This is free software, licensed under the Apache License, Version 2.0 --%> - -<%- -local anonclass = (not self.anonymous or self.sectiontitle) and "named" or "anonymous" --%> - -<%+adblock/adblock_css%> - -<div class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>"> - <% if self.title then -%> - <h3><%=self.title%></h3> - <%- end %> - <div class="cbi-section-descr"><%=self.description%></div> - <div class="cbi-section-node"> - <div class="table cbi-section-table"> - <div class="tr cbi-section-table-titles <%=anonclass%>"> - <%- for i, k in pairs(self.children) do -%> - <div class="th cbi-section-table-cell"> - <%-=k.title-%> - </div> - <%- end -%> - </div> - <%- local section, scope, isempty = true - for i, k in ipairs(self:cfgsections()) do - section = k - local sectionname = striptags((type(self.sectiontitle) == "function") and self:sectiontitle(section) or k) - local sectiontitle = ifattr(sectionname and (not self.anonymous or self.sectiontitle), "data-title", sectionname, true) - isempty = false - scope = { valueheader = "cbi/cell_valueheader", valuefooter = "cbi/cell_valuefooter" } - -%> - <div class="tr cbi-section-table-row" id="cbi-<%=self.config%>-<%=section%>"<%=sectiontitle%>> - <%- - for k, node in ipairs(self.children) do - node:render(section, scope or {}) - end - if not scope.cbid:match("adb_src_cat") then - -%> - <div class="td cbi-value-field"> </div> - <%- end -%> - </div> - <%- end -%> - </div> - </div> -</div> diff --git a/applications/luci-app-adblock/luasrc/view/adblock/logread.htm b/applications/luci-app-adblock/luasrc/view/adblock/logread.htm deleted file mode 100644 index 48e367ec2..000000000 --- a/applications/luci-app-adblock/luasrc/view/adblock/logread.htm +++ /dev/null @@ -1,36 +0,0 @@ -<%# -Copyright 2017-2018 Dirk Brenken (dev@brenken.org) -This is free software, licensed under the Apache License, Version 2.0 --%> - -<%+header%> -<%+adblock/adblock_css%> - -<script type="text/javascript"> -//<![CDATA[ - function log_update() - { - XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "logread")%>', null, - function(x) - { - if (!x) - { - return; - } - var view = document.getElementById("view_id"); - view.value = x.responseText; - view.scrollTop = view.scrollHeight; - }); - } - window.onload = log_update(); -//]]> -</script> - -<div class="cbi-map"> - <div class="cbi-section"> - <div class="cbi-section-descr"><%:The syslog output, pre-filtered for adblock related messages only.%></div> - <textarea id="view_id" readonly="readonly" wrap="off" value=""></textarea> - </div> -</div> - -<%+footer%> diff --git a/applications/luci-app-adblock/luasrc/view/adblock/query.htm b/applications/luci-app-adblock/luasrc/view/adblock/query.htm deleted file mode 100644 index fb659958d..000000000 --- a/applications/luci-app-adblock/luasrc/view/adblock/query.htm +++ /dev/null @@ -1,64 +0,0 @@ -<%# -Copyright 2017-2018 Dirk Brenken (dev@brenken.org) -This is free software, licensed under the Apache License, Version 2.0 --%> - -<%+header%> - -<script type="text/javascript"> -//<![CDATA[ - var stxhr = new XHR(); - - function update_status(data) - { - var domain = data.value || data.placeholder; - var input = document.getElementById('query_input'); - var output = document.getElementById('query_output'); - - if (input && output) - { - output.innerHTML = - '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> ' + - '<%:Waiting for command to complete...%>' - ; - input.parentNode.style.display = 'block'; - input.style.display = 'inline'; - stxhr.post('<%=luci.dispatcher.build_url('admin/services/adblock/advanced/result/')%>' + domain, { token: '<%=token%>' }, - function(x) - { - if (x.responseText) - { - input.style.display = 'none'; - output.innerHTML = String.format('<pre>%h</pre>', x.responseText); - } - else - { - input.style.display = 'none'; - output.innerHTML = '<span class="error"><%:Blocklist not found!%></span>'; - } - } - ); - } - } -//]]> -</script> - -<form method="post" action="<%=REQUEST_URI%>" onsubmit="update_status(this.input); return false;"> - <div class="cbi-map"> - <div class="cbi-section"> - <div class="cbi-section-descr"><%:This form allows you to query active block lists for certain domains, e.g. for whitelisting.%></div> - <div style="width:33%; float:left;"> - <input type="text" placeholder="google.com" name="input" /> - <input type="button" value="<%:Query%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.input)" /> - </div> - <br style="clear:both" /> - <br /> - </div> - </div> - <div class="cbi-section" style="display:none"> - <h3 id="query_input"><%:Collecting data...%></h3> - <span id="query_output"></span> - </div> -</form> - -<%+footer%> diff --git a/applications/luci-app-adblock/luasrc/view/adblock/report.htm b/applications/luci-app-adblock/luasrc/view/adblock/report.htm deleted file mode 100644 index 814cc2fb2..000000000 --- a/applications/luci-app-adblock/luasrc/view/adblock/report.htm +++ /dev/null @@ -1,310 +0,0 @@ -<%# -Copyright 2017-2019 Dirk Brenken (dev@brenken.org) -This is free software, licensed under the Apache License, Version 2.0 --%> - -<%+header%> -<%+adblock/adblock_css%> - -<script type="text/javascript"> -//<![CDATA[ - function report_json(json) - { - document.getElementById("value_1").innerHTML = json.data.start_date + ", " + json.data.start_time || "-"; - document.getElementById("value_2").innerHTML = json.data.end_date + ", " + json.data.end_time || "-"; - document.getElementById("value_3").innerHTML = json.data.total || "-"; - document.getElementById("value_4").innerHTML = json.data.blocked + " (" + json.data.percent + ")" || "-"; - - var a_cnt; - var b_cnt; - var c_cnt; - var a_val; - var b_val; - var c_val; - var s = '<div class="tr table-titles">'; - s += '<div class="th left"><%:Count%></div>'; - s += '<div class="th left"><%:Name / IP-Address%></div>'; - s += '<div class="th left"><%:Count%></div>'; - s += '<div class="th left"><%:Domain%></div>'; - s += '<div class="th left"><%:Count%></div>'; - s += '<div class="th left"><%:Blocked Domain%></div></div>'; - - for(var i=0;i<10;i++) - { - if (i < json.top_clients.length) - { - a_cnt = json.top_clients[i].count; - a_val = json.top_clients[i].address; - } - else - { - a_cnt = "-"; - a_val = ""; - } - - if (i < json.top_domains.length) - { - b_cnt = json.top_domains[i].count; - b_val = json.top_domains[i].address; - } - else - { - b_cnt = "-"; - b_val = ""; - } - - if (i < json.top_blocked.length) - { - c_cnt = json.top_blocked[i].count; - c_val = json.top_blocked[i].address; - } - else - { - c_cnt = "-"; - c_val = ""; - } - - s += '<div class="tr left">'; - s += '<div class="td left" data-title="<%:Count%>">' + a_cnt + '</div>'; - s += '<div class="td left" data-title="<%:Name / IP-Address%>">' + a_val + '</div>'; - s += '<div class="td left" data-title="<%:Count%>">' + b_cnt + '</div>'; - s += '<div class="td left" data-title="<%:Domain%>">' + b_val + '</div>'; - s += '<div class="td left" data-title="<%:Count%>">' + c_cnt + '</div>'; - s += '<div class="td left" data-title="<%:Blocked Domain%>">' + c_val + '</div></div>'; - } - document.getElementById("value_5").innerHTML = s; - } - - function report_text(text) - { - var s = '<div class="tr table-titles">'; - s += '<div class="th left"><%:Date%></div>'; - s += '<div class="th left"><%:Time%></div>'; - s += '<div class="th left"><%:Client%></div>'; - s += '<div class="th left"><%:Domain%></div>'; - s += '<div class="th left"><%:Answer%></div>'; - s += '<div class="th left"><%:Action%></div></div>'; - var btn1; - var record; - var title_arr = ["<%:Date%>", "<%:Time%>", "<%:Client%>", "<%:Domain%>", "<%:Answer%>", "<%:Action%>"]; - var array = text.split("\n"); - for (var i=0;i<array.length;i++) - { - record = array[i].split("\t"); - if (record[0] && record[0] != "undefined") - { - s += '<div class="tr left">'; - for (var j=0;j<5;j++) - { - s += '<div class="td left" data-title="' + title_arr[j] + '">' + record[j] + '</div>'; - if (record[4] === "NX") - { - btn1 = '<div class="td left" data-title="' + title_arr[5] + '"><input type="button" class="cbi-button cbi-button-edit" name="add_whitelist,' + record[3] + '" value="<%:Whitelist%>" onclick="btn_action(this)" /></div>'; - } - else if (record[4] === "OK") - { - btn1 = '<div class="td left" data-title="' + title_arr[5] + '"><input type="button" class="cbi-button cbi-button-remove" name="add_blacklist,' + record[3] + '" value="<%:Blacklist%>" onclick="btn_action(this)" /></div>'; - } - else - { - btn1 = '-' - } - } - s += btn1 + '</div>' - } - } - document.getElementById("value_6").innerHTML = s; - } - - function btn_action(value) - { - var action = value.name.split(","); - - if (action[0] === "do_report") - { - var btn1 = document.getElementById("btn1"); - var btn1_running = document.getElementById("btn1_running"); - - btn1.disabled = true; - running(btn1_running, 1); - - document.getElementById("filter_search").value = ''; - document.getElementById("filter_count").selectedIndex = 1; - - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action[0], null, - function(x) - { - if (!x) - { - return; - } - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_json")%>', null, - function(x, json_info) - { - if (!x || !json_info || !json_info.data) - { - running(btn1_running, 0); - btn1.disabled = false; - return; - } - report_json(json_info); - }); - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_text")%>', null, - function(x) - { - if (!x || !x.responseText) - { - return; - } - report_text(x.responseText); - running(btn1_running, 0); - btn1.disabled = false; - }); - }); - } - else if (action[0] === "do_filter") - { - var btn2 = document.getElementById("btn2"); - var btn2_running = document.getElementById("btn2_running"); - var search = document.getElementById("filter_search").value.replace(/[^\x00-\x7F]|[\s!@#$%^&*()+=\[\]{};'"\\|,<>\/?]/g,'') || "\"+\""; - var count = document.getElementById("filter_count").value; - - btn2.disabled = true; - running(btn2_running, 1); - if (search != "\"+\"") - { - document.getElementById("filter_search").value = search; - } - - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action[0] + "/" + "-" + "/" + search + "/" + count + "/" + "true" + "/" + "false", null, - function(x) - { - if (!x) - { - return; - } - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_text")%>', null, - function(x) - { - if (!x || !x.responseText) - { - return; - } - report_text(x.responseText); - running(btn2_running, 0); - btn2.disabled = false; - }); - }); - } - else if (action[0] === "add_blacklist" || action[0] === "add_whitelist") - { - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action[0] + "/" + action[1], null, - function(x) - { - if (!x) - { - return; - } - btn3 = document.getElementsByName(value.name); - for (var i=0; i<btn3.length; i++) - { - btn3[i].disabled = true; - } - }); - } - } - - function running(element, state) - { - if (state === 1) - { - var running_html = '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" width="16" height="16" style="vertical-align:middle" />'; - element.innerHTML = running_html; - } - else - { - element.innerHTML = ''; - } - } - - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_json")%>', null, - function(x, json_info) - { - if (!x || !json_info || !json_info.data) - { - running(btn1_running, 0); - btn1.disabled = false; - return; - } - report_json(json_info); - }); - - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "report_text")%>', null, - function(x) - { - if (!x || !x.responseText) - { - return; - } - report_text(x.responseText); - }); -//]]> -</script> - -<div class="cbi-section"> - <div class="cbi-value" id="status_1"> - <label class="cbi-value-title" for="status_1"><%:Start Date%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_1">-</span> - </div> - </div> - <div class="cbi-value" id="status_2"> - <label class="cbi-value-title" for="status_2"><%:End Date%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_2">-</span> - </div> - </div> - <div class="cbi-value" id="status_3"> - <label class="cbi-value-title" for="status_3"><%:Total DNS Queries%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_3">-</span> - </div> - </div> - <div class="cbi-value" id="status_4"> - <label class="cbi-value-title" for="status_4"><%:Blocked DNS Queries%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_4">-</span> - </div> - </div> - <br /> - <div id="button"> - <input type="button" class="cbi-button cbi-button-action important" id="btn1" name="do_report" value="<%:Refresh Report%>" onclick="btn_action(this)" /> - <span id="btn1_running" class="btn1_running"></span> - </div> -</div> -<br /> -<div class="cbi-section"> - <h3><%:Top 10 Reporting%></h3> - <div class="table" id="value_5"></div> -</div> -<hr /> -<div class="cbi-section"> - <div class="cbi-section-descr"><%:Filter the DNS Query result set for a particular domain, client or time frame.%></div> - <div style="float:left;"> - <input type="text" placeholder="<%:Domain/Client/Date/Time%>" id="filter_search" name="filter_search" /> - <select name="filter_count" id="filter_count"> - <option value="25">25</option> - <option value="50" selected="selected">50</option> - <option value="100">100</option> - <option value="250">250</option> - <option value="500">500</option> - </select> - <input type="button" class="cbi-button cbi-button-action" id="btn2" name="do_filter" value="<%:Filter%>" onclick="btn_action(this)" /> - <span id="btn2_running" class="btn2_running"></span> - </div> - <br /> - <br /> - <h3><%:Latest DNS Queries%></h3> - <div class="table" id="value_6"></div> -</div> -<%+footer%> diff --git a/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm b/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm deleted file mode 100644 index 2cec57334..000000000 --- a/applications/luci-app-adblock/luasrc/view/adblock/runtime.htm +++ /dev/null @@ -1,213 +0,0 @@ -<%# -Copyright 2017-2019 Dirk Brenken (dev@brenken.org) -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"); - var btn1_running = document.getElementById("btn1_running"); - var btn2 = document.getElementById("btn2"); - var btn2_running = document.getElementById("btn2_running"); - var input = json.data.adblock_status || "-"; - - document.getElementById("value_1").innerHTML = input; - if (input === "enabled") - { - btn1.value = "<%:Suspend%>"; - btn1.name = "do_suspend"; - btn2.value = "<%:Refresh%>"; - btn2.name = "do_refresh"; - btn1.disabled = false; - running(btn1_running, 0); - btn2.disabled = false; - running(btn2_running, 0); - } - else if (input === "paused") - { - btn1.value = "<%:Resume%>"; - btn1.name = "do_resume"; - btn2.value = "<%:Refresh%>"; - btn2.name = "do_refresh"; - btn1.disabled = false; - running(btn1_running, 0); - btn2.disabled = false; - running(btn2_running, 0); - } - else - { - btn1.value = "<%:Suspend%>"; - btn1.name = "do_suspend"; - btn2.value = "<%:Refresh%>"; - btn2.name = "do_refresh"; - btn1.disabled = true; - btn2.disabled = true; - } - - document.getElementById("value_2").innerHTML = json.data.adblock_version || "-"; - document.getElementById("value_3").innerHTML = json.data.fetch_utility || "-"; - 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 = format(json.data.overall_domains) || "-"; - document.getElementById("value_8").innerHTML = json.data.last_rundate || "-"; - } - - function btn_action(action) - { - var btn1 = document.getElementById("btn1"); - var btn1_running = document.getElementById("btn1_running"); - var btn2 = document.getElementById("btn2"); - var btn2_running = document.getElementById("btn2_running"); - - btn1.disabled = true; - btn2.disabled = true; - - if (action.name === "do_refresh") - { - running(btn2_running, 1); - } - else - { - running(btn1_running, 1); - } - - new XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock")%>/action/' + action.name, null, - function(x) - { - if (!x) - { - return; - } - }); - } - - function running(element, state) - { - if (state === 1) - { - var running_html = '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" width="16" height="16" style="vertical-align:middle" />'; - element.innerHTML = running_html; - } - else - { - element.innerHTML = ''; - } - } - - function reset_view() - { - document.getElementById("btn1").value = "<%:Suspend%>"; - document.getElementById("btn1").name = "do_suspend"; - document.getElementById("btn2").value = "<%:Refresh%>"; - document.getElementById("btn2").name = "do_refresh"; - document.getElementById("btn1").disabled = true; - document.getElementById("btn2").disabled = true; - document.getElementById("value_1").innerHTML = "-"; - document.getElementById("value_2").innerHTML = "-"; - document.getElementById("value_3").innerHTML = "-"; - document.getElementById("value_4").innerHTML = "-"; - document.getElementById("value_5").innerHTML = "-"; - document.getElementById("value_6").innerHTML = "-"; - document.getElementById("value_7").innerHTML = "-"; - document.getElementById("value_8").innerHTML = "-"; - } - - XHR.get('<%=luci.dispatcher.build_url("admin", "services", "adblock", "status_update")%>', null, - function(x, json_info) - { - if (!x || !json_info || !json_info.data) - { - reset_view(); - return; - } - status_update(json_info); - }); - - XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "adblock", "status_update")%>', null, - function(x, json_info) - { - if (!x || !json_info || !json_info.data) - { - reset_view(); - return; - } - status_update(json_info); - }); -//]]> -</script> - -<h3><%:Runtime Information%></h3> -<div class="cbi-value" id="status_1"> - <label class="cbi-value-title" for="status_1"><%:Adblock Status%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_1">-</span> - </div> -</div> -<div class="cbi-value" id="status_2"> - <label class="cbi-value-title" for="status_2"><%:Adblock Version%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_2">-</span> - </div> -</div> -<div class="cbi-value" id="status_3"> - <label class="cbi-value-title" for="status_3"><%:Download Utility (SSL Library)%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_3">-</span> - </div> -</div> -<div class="cbi-value" id="status_4"> - <label class="cbi-value-title" for="status_4"><%:DNS Backend, DNS Directory%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_4">-</span> - </div> -</div> -<div class="cbi-value" id="status_5"> - <label class="cbi-value-title" for="status_5"><%:DNS Variant, DNS File Reset%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_5">-</span> - </div> -</div> -<div class="cbi-value" id="status_6"> - <label class="cbi-value-title" for="status_6"><%:Backup Directory%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_6">-</span> - </div> -</div> -<div class="cbi-value" id="status_7"> - <label class="cbi-value-title" for="status_7"><%:Overall Domains%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_7">-</span> - </div> -</div> -<div class="cbi-value" id="status_8"> - <label class="cbi-value-title" for="status_8"><%:Last Run%></label> - <div class="cbi-value-field"> - <span class="runtime" id="value_8">-</span> - </div> -</div> -<hr /> -<div class="cbi-value" id="button_1"> - <label class="cbi-value-title" for="button_1"><%:Suspend / Resume Adblock%></label> - <div class="cbi-value-field"> - <input class="cbi-button cbi-button-reset" id="btn1" type="button" value="" onclick="btn_action(this)" /> - <span id="btn1_running" class="btn_running"></span> - </div> -</div> -<p /> -<div class="cbi-value" id="button_2"> - <label class="cbi-value-title" for="button_2"><%:Refresh Blocklist Sources%></label> - <div class="cbi-value-field"> - <input class="cbi-button cbi-button-apply" id="btn2" type="button" value="" onclick="btn_action(this)" /> - <span id="btn2_running" class="btn_running"></span> - </div> -</div> |