summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-banip/luasrc/view
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2021-02-04 16:05:54 +0100
committerDirk Brenken <dev@brenken.org>2021-02-04 16:05:54 +0100
commitf89450fd3e5f336397401db2f369ee9bbd587daa (patch)
tree59514678e3c59d3bc6ec18241e7b48a5f9b91622 /applications/luci-app-banip/luasrc/view
parent6ae138c2fe3dc13005b3ccdb9e19037f7350aab6 (diff)
luci-app-banip: sync with banIP 0.7.0
* sync with current banIP release * move app to client side JS * tested with all standard themes Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-banip/luasrc/view')
-rw-r--r--applications/luci-app-banip/luasrc/view/banip/banip_css.htm95
-rw-r--r--applications/luci-app-banip/luasrc/view/banip/ipsetview.htm67
-rw-r--r--applications/luci-app-banip/luasrc/view/banip/logview.htm36
-rw-r--r--applications/luci-app-banip/luasrc/view/banip/ripeview.htm107
-rw-r--r--applications/luci-app-banip/luasrc/view/banip/runtime.htm164
-rw-r--r--applications/luci-app-banip/luasrc/view/banip/sourcelist.htm47
6 files changed, 0 insertions, 516 deletions
diff --git a/applications/luci-app-banip/luasrc/view/banip/banip_css.htm b/applications/luci-app-banip/luasrc/view/banip/banip_css.htm
deleted file mode 100644
index 2fd4109e90..0000000000
--- a/applications/luci-app-banip/luasrc/view/banip/banip_css.htm
+++ /dev/null
@@ -1,95 +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;
- }
-
- .ripe_desc
- {
- font-style: italic;
- display: inline-block;
- width: 100%;
- height: 20px;
- margin: 2px 2px;
- }
-
- .button_running
- {
- display: inline-block;
- width: 16px;
- height: 16px;
- margin: 0 5px;
- }
-</style>
diff --git a/applications/luci-app-banip/luasrc/view/banip/ipsetview.htm b/applications/luci-app-banip/luasrc/view/banip/ipsetview.htm
deleted file mode 100644
index 22c1312a8f..0000000000
--- a/applications/luci-app-banip/luasrc/view/banip/ipsetview.htm
+++ /dev/null
@@ -1,67 +0,0 @@
-<%#
-Copyright 2018 Dirk Brenken (dev@brenken.org)
-This is free software, licensed under the Apache License, Version 2.0
--%>
-
-<%-
- local util = require("luci.util")
- local ipsets = util.split(util.trim(util.exec("ipset -n -L 2>/dev/null | sort")), "\n", nil, true) or {}
--%>
-
-<%+header%>
-<%+banip/banip_css%>
-
-<script type="text/javascript">
-//<![CDATA[
- function ipset_view()
- {
- var div_ipsets = document.getElementById("div_ipsets");
- var ipset = div_ipsets.querySelector("#s_ipsets").value;
- var filter = document.getElementById("checkbox_filter").checked;
- var view = document.getElementById("view_id");
-
- if (!ipset)
- {
- return;
- }
- view.value = "<%:Loading ...%>";
-
- new XHR().get('<%=luci.dispatcher.build_url("admin", "services", "banip")%>/ipsetview/' + ipset + "/" + filter, null,
- function(x)
- {
- if (!x)
- {
- view.value = "<%:No response!%>";
- return;
- }
- view.value = x.responseText;
- });
- }
-//]]>
-</script>
-
-<div class="cbi-map">
- <div class="cbi-section">
- <div class="cbi-section-descr"><%:Check the current available IPSets.%></div>
- <div class="cbi-section-node">
- <div class="table cbi-section-table">
- <div class="tr cbi-section-table-row">
- <div class="td left">
- <input class="cbi-input-checkbox" data-update="click change" type="checkbox" id="checkbox_filter" name="checkbox_filter" value="1" checked="checked" />
- <label for="checkbox_filter"><%_Show only set member with packet counter &gt; 0%></label>
- </div>
- </div>
- <div class="tr cbi-section-table-row" id="div_ipsets">
- <div class="td left">
- <select id="s_ipsets" class="cbi-input-select cbi-button" style="width:15em">
- <%- for _, z in ipairs(ipsets) do -%><option value="<%=z%>"><%=z%></option><%- end -%>
- </select>
- <input type="button" id="bt_load" value="<%:Load%>" onclick="ipset_view()" class="cbi-button cbi-button-add" />
- </div>
- </div>
- </div>
- </div>
- <textarea id="view_id" readonly="readonly" wrap="off" value=""></textarea>
- </div>
-</div>
-<%+footer%>
diff --git a/applications/luci-app-banip/luasrc/view/banip/logview.htm b/applications/luci-app-banip/luasrc/view/banip/logview.htm
deleted file mode 100644
index 86f1ea64fa..0000000000
--- a/applications/luci-app-banip/luasrc/view/banip/logview.htm
+++ /dev/null
@@ -1,36 +0,0 @@
-<%#
-Copyright 2018 Dirk Brenken (dev@brenken.org)
-This is free software, licensed under the Apache License, Version 2.0
--%>
-
-<%+header%>
-<%+banip/banip_css%>
-
-<script type="text/javascript">
-//<![CDATA[
- function log_update()
- {
- XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "banip", "logview")%>', 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 banIP related messages only.%></div>
- <textarea id="view_id" readonly="readonly" wrap="off" value=""></textarea>
- </div>
-</div>
-
-<%+footer%>
diff --git a/applications/luci-app-banip/luasrc/view/banip/ripeview.htm b/applications/luci-app-banip/luasrc/view/banip/ripeview.htm
deleted file mode 100644
index 5d26ce95f1..0000000000
--- a/applications/luci-app-banip/luasrc/view/banip/ripeview.htm
+++ /dev/null
@@ -1,107 +0,0 @@
-<%#
-Copyright 2018 Dirk Brenken (dev@brenken.org)
-This is free software, licensed under the Apache License, Version 2.0
--%>
-
-<%+header%>
-<%+banip/banip_css%>
-
-<script type="text/javascript">
-//<![CDATA[
- function ripe_desc()
- {
- var div_ripe = document.getElementById("div_ripe");
- var query = div_ripe.querySelector("#s_ripe").value;
- var output = document.getElementById("ripe_desc");
-
- switch (query) {
- case "geoloc":
- output.innerHTML = "<%:This data call returns geolocation information for the given IP space, or for announced IP prefixes in the case of ASNs.%>";
- break;
- case "as-overview":
- output.innerHTML = "<%:This data call shows general informations about an ASN like its announcement status and the name of its holder according to the WHOIS service.%>";
- break;
- case "announced-prefixes":
- output.innerHTML = "<%:This data call returns all announced prefixes for a given ASN.%>";
- break;
- case "network-info":
- output.innerHTML = "<%:This data call returns the containing prefix and announcing ASN of a given IP address.%>";
- break;
- case "country-resource-list":
- output.innerHTML = "<%:This data call lists the Internet resources associated with a country, including ASNs, IPv4 ranges and IPv4/6 CIDR prefixes.%>";
- break;
- case "whois":
- output.innerHTML = "<%:This data call returns whois information from the relevant Regional Internet Registry and Routing Registry.%>";
- break;
- case "dns-chain":
- output.innerHTML = "<%:This data call returns the recursive chain of DNS forward (A/AAAA/CNAME) and reverse (PTR) records starting form either a hostname or an IP address.%>";
- break;
- case "iana-registry-info":
- output.innerHTML = "<%:This data call gives access to various data sources maintained by IANA.%>";
- break;
- default:
- output.innerHTML = "";
- }
- }
-
- function ripe_view()
- {
- var div_ripe = document.getElementById("div_ripe");
- var query = div_ripe.querySelector("#s_ripe").value;
- var input = document.getElementById("ripe_input");
- var view = document.getElementById("view_id");
-
- if (!input.value)
- {
- return;
- }
- view.value = "<%:Loading ...%>";
-
- new XHR().get('<%=luci.dispatcher.build_url("admin", "services", "banip")%>/ripeview/' + query + "/" + input.value, null,
- function(x)
- {
- if (!x)
- {
- view.value = "<%:No response!%>";
- return;
- }
- view.value = x.responseText;
- });
- }
- window.onload = ripe_desc;
-//]]>
-</script>
-
-<div class="cbi-map">
- <div class="cbi-section">
- <div class="cbi-section-descr"><%_The RIPEstat Data API is the public data interface provided by RIPE NCC, for details look <a href="https://stat.ripe.net/docs/data_api" target="_blank" rel="noopener noreferrer">here</a>.%></div>
- <div class="cbi-section-node">
- <div class="table cbi-section-table">
- <div class="tr cbi-section-table-row">
- <div class="td left">
- <input class="cbi-input-text" style="width:20em" type="text" id="ripe_input" placeholder="<%:Enter IP/CIDR/ASN/ISO%>" value="" />
- </div>
- </div>
- <div class="tr cbi-section-table-row" id="div_ripe">
- <div class="td left">
- <select id="s_ripe" class="cbi-input-select cbi-button" style="width:15em" onchange="ripe_desc()">
- <option value="geoloc" selected="selected"><%:Geo Location%></option>
- <option value="as-overview"><%:ASN Overview%></option>
- <option value="announced-prefixes"><%:ASN Prefixes%></option>
- <option value="network-info"><%:IP/ASN Mapping%></option>
- <option value="country-resource-list"><%:Country Resources%></option>
- <option value="whois"><%:Whois Information%></option>
- <option value="dns-chain"><%:DNS Chain%></option>
- <option value="iana-registry-info"><%:IANA Information%></option>
- </select>
- <input type="button" id="bt_load" value="<%:Load%>" onclick="ripe_view()" class="cbi-button cbi-button-add" /><br /><br />
- <span class="ripe_desc" id="ripe_desc"></span>
- </div>
- </div>
- </div>
- </div>
- <textarea id="view_id" readonly="readonly" wrap="off" value=""></textarea>
- </div>
-</div>
-
-<%+footer%> \ No newline at end of file
diff --git a/applications/luci-app-banip/luasrc/view/banip/runtime.htm b/applications/luci-app-banip/luasrc/view/banip/runtime.htm
deleted file mode 100644
index f96b23dc80..0000000000
--- a/applications/luci-app-banip/luasrc/view/banip/runtime.htm
+++ /dev/null
@@ -1,164 +0,0 @@
-<%#
-Copyright 2018-2019 Dirk Brenken (dev@brenken.org)
-This is free software, licensed under the Apache License, Version 2.0
--%>
-
-<%+banip/banip_css%>
-<script type="text/javascript">
-//<![CDATA[
- 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 view = document.getElementById("value_1");
- var input = json.data.status;
-
- btn1.value = "<%:Refresh%>";
- btn1.name = "do_refresh";
-
- btn2.value = "<%:Reload%>";
- btn2.name = "do_reload";
- view.innerHTML = input || "-";
- if (input != "running")
- {
- btn1.disabled = false;
- running(btn1_running, 0);
- btn2.disabled = false;
- running(btn2_running, 0);
- }
- view = document.getElementById("value_2");
- input = json.data.version;
- view.innerHTML = input || "-";
- view = document.getElementById("value_3");
- input = json.data.util_info;
- view.innerHTML = input || "-";
- view = document.getElementById("value_4");
- input = json.data.ipset_info;
- view.innerHTML = input || "-";
- view = document.getElementById("value_5");
- input = json.data.backup_dir;
- view.innerHTML = input || "-";
- view = document.getElementById("value_6");
- input = json.data.last_run;
- view.innerHTML = input || "-";
- }
-
-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");
-
- if (action.name === "do_refresh")
- {
- btn1.disabled = true;
- btn2.disabled = true;
- running(btn1_running, 1);
- }
- else if (action.name === "do_reload")
- {
- btn1.disabled = true;
- btn2.disabled = true;
- running(btn2_running, 1);
- }
- new XHR.get('<%=luci.dispatcher.build_url("admin", "services", "banip")%>/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 = '';
- }
- }
-
- XHR.get('<%=luci.dispatcher.build_url("admin", "services", "banip", "status")%>', null,
- function(x, json_info)
- {
- if (!x || !json_info)
- {
- return;
- }
- status_update(json_info)
- });
-
- XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "services", "banip", "status")%>', null,
- function(x, json_info)
- {
- if (!x || !json_info)
- {
- 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"><%:banIP 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"><%:banIP 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, RT Monitor%></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"><%:IPSet Information%></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"><%:Backup Directory%></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"><%:Last Run%></label>
- <div class="cbi-value-field">
- <span class="runtime" id="value_6">-</span>
- </div>
-</div>
-<hr />
-<div class="cbi-value" id="button_1">
- <label class="cbi-value-title" for="button_1"><%:Refresh IPSets%></label>
- <div class="cbi-value-field">
- <input class="cbi-button cbi-button-apply" id="btn1" type="button" name="do_refresh" value="<%:Refresh%>" onclick="btn_action(this)" />
- <span id="btn1_running" class="btn_running"></span>
- </div>
-</div>
-<div class="cbi-value" id="button_2">
- <label class="cbi-value-title" for="button_2"><%:Reload IPSet Sources%></label>
- <div class="cbi-value-field">
- <input class="cbi-button cbi-button-reset" id="btn2" type="button" name="do_reload" value="<%:Reload%>" onclick="btn_action(this)" />
- <span id="btn2_running" class="btn_running"></span>
- </div>
-</div>
-
diff --git a/applications/luci-app-banip/luasrc/view/banip/sourcelist.htm b/applications/luci-app-banip/luasrc/view/banip/sourcelist.htm
deleted file mode 100644
index 12240e5ae4..0000000000
--- a/applications/luci-app-banip/luasrc/view/banip/sourcelist.htm
+++ /dev/null
@@ -1,47 +0,0 @@
-<%#
-Copyright 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"
--%>
-
-<%+banip/banip_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("ban_src_cat") then
- -%>
- <div class="td cbi-value-field">&#160;</div>
- <%- end -%>
- </div>
- <%- end -%>
- </div>
- </div>
-</div>