diff options
7 files changed, 329 insertions, 288 deletions
diff --git a/applications/luci-app-snmpd/luasrc/model/cbi/snmpd.lua b/applications/luci-app-snmpd/luasrc/model/cbi/snmpd.lua index b3c0f2660b..cc6951e171 100644 --- a/applications/luci-app-snmpd/luasrc/model/cbi/snmpd.lua +++ b/applications/luci-app-snmpd/luasrc/model/cbi/snmpd.lua @@ -26,11 +26,12 @@ s.anonymous = true p = s:option(Value, "agentaddress", "The address the agent should listen on", [[Eg: UDP:161, or UDP:10.5.4.3:161 to only listen on a given interface]]) -s = m:section(TypedSection, "agentx", "AgentX settings") +s = m:section(TypedSection, "agentx", "AgentX settings", "Delete this section to disable agentx") s.anonymous = true p = s:option(Value, "agentxsocket", "The address the agent should allow agentX connections to", [[This is only necessary if you have subagents using the agentX socket protocol. - Note that agentX requires TCP transport]]) + Eg: /var/run/agentx.sock]]) +s.addremove=true s = m:section(TypedSection, "com2sec", "com2sec security") p = s:option(Value, "secname", "secname") diff --git a/applications/luci-app-travelmate/luasrc/controller/travelmate.lua b/applications/luci-app-travelmate/luasrc/controller/travelmate.lua index 775831d9d0..0c5890810e 100644 --- a/applications/luci-app-travelmate/luasrc/controller/travelmate.lua +++ b/applications/luci-app-travelmate/luasrc/controller/travelmate.lua @@ -27,7 +27,6 @@ function index() entry({"admin", "services", "travelmate", "logread"}, call("logread"), nil).leaf = true entry({"admin", "services", "travelmate", "status"}, call("status_update"), nil).leaf = true entry({"admin", "services", "travelmate", "action"}, call("trm_action"), nil).leaf = true - entry({"admin", "services", "travelmate", "apqr"}, template("travelmate/ap_qr")).leaf = true entry({"admin", "services", "travelmate", "wifiscan"}, template("travelmate/wifi_scan")).leaf = true entry({"admin", "services", "travelmate", "wifiadd"}, form("travelmate/wifi_add", {hideresetbtn=true, hidesavebtn=true})).leaf = true entry({"admin", "services", "travelmate", "wifiedit"}, form("travelmate/wifi_edit", {hideresetbtn=true, hidesavebtn=true})).leaf = true diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua index a1a7ed72c3..9ba4cf3bf2 100644 --- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/overview_tab.lua @@ -56,7 +56,7 @@ end s = m:section(NamedSection, "global", "travelmate") -o1 = s:option(Flag, "trm_enabled", translate("Enable travelmate")) +o1 = s:option(Flag, "trm_enabled", translate("Enable Travelmate")) o1.default = o1.disabled o1.rmempty = false @@ -78,18 +78,6 @@ end o3.default = trmiface o3.rmempty = false -if fs.access("/usr/bin/qrencode") then - btn = s:option(Button, "btn", translate("View AP QR-Codes"), - translate("Connect your Android or iOS devices to your router's WiFi using the shown QR code.")) - btn.inputtitle = translate("QR-Codes") - btn.inputstyle = "apply" - btn.disabled = false - - function btn.write() - luci.http.redirect(luci.dispatcher.build_url("admin", "services", "travelmate", "apqr")) - end -end - -- Runtime information ds = s:option(DummyValue, "_dummy") @@ -97,16 +85,15 @@ ds.template = "travelmate/runtime" -- Extra options -e = m:section(NamedSection, "global", "travelmate", translate("Extra options"), +e = m:section(NamedSection, "global", "travelmate", translate("Extra Options"), translate("Options for further tweaking in case the defaults are not suitable for you.")) -e1 = e:option(Flag, "trm_debug", translate("Enable verbose debug logging")) +e1 = e:option(Flag, "trm_debug", translate("Enable Verbose Debug Logging")) e1.default = e1.disabled e1.rmempty = false -e2 = e:option(Value, "trm_radio", translate("Radio selection"), - translate("Restrict travelmate to a dedicated radio, e.g. 'radio0'.")) -e2.datatype = "and(uciname,rangelength(6,6))" +e2 = e:option(Value, "trm_radio", translate("Radio Selection / Order"), + translate("Restrict travelmate to a single radio (e.g. 'radio1') or change the overall scanning order (e.g. 'radio1 radio2 radio0').")) e2.rmempty = true e3 = e:option(Value, "trm_triggerdelay", translate("Trigger Delay"), diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm deleted file mode 100644 index 3f01a81e35..0000000000 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/ap_qr.htm +++ /dev/null @@ -1,66 +0,0 @@ -<%# -Copyright 2018 Dirk Brenken (dev@brenken.org) -This is free software, licensed under the Apache License, Version 2.0 --%> - -<%+header%> - -<div class="cbi-map"> - <div class="cbi-map-descr"> - <%=translate("Here you'll find the QR codes from all of your configured Access Points. It allows you to connect your Android or iOS devices to your router's WiFi using the QR code shown below.")%> - </div> - <%- local uci = require("luci.model.uci").cursor() - - uci:foreach("wireless", "wifi-iface", function(s) - local device = s.device or "" - local mode = s.mode or "" - local ssid = s.ssid or "" - local enc = s.encryption or "" - local key = s.key or "" - local hidden = s.hidden or "false" - local disabled = s.disabled or "" - local wep_slots = {s.key1 or "", s.key2 or "", s.key3 or "", s.key4 or ""} - - if device and mode == "ap" and disabled ~= "1" then - if string.match(enc, '^psk') then - enc = "WPA" - elseif string.match(enc, '^wep') then - enc = "WEP" - if tonumber(key) then - key = wep_slots[tonumber(key)] - end - elseif enc == "none" then - enc = "nopass" - key = "nokey" - else - enc = "" - end - - if hidden == "1" then - hidden = "true" - end - - if ssid and enc and key then - local e_ssid = string.gsub(ssid,"[\"\\';:, ]",[[\\\%1]]) - local e_key = string.gsub(key,"[\"\\';:, ]",[[\\\%1]]) - local qrcode = "" - - qrcode = luci.sys.exec("/usr/bin/qrencode --inline --8bit --type=SVG --output=- 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'") - -%> - <div class="cbi-section"> - <h3>AP on <%=device%> with SSID "<%=ssid%>"</h3> - <h3><%=qrcode%></h3> - </div> - <%- - end - end - end) - -%> -</div> -<div class="cbi-page-actions right"> - <form class="inline" action="<%=luci.dispatcher.build_url('admin/services/travelmate/tab_from_cbi')%>" method="post"> - <input class="cbi-button cbi-button-reset" type="submit" value="<%:Back to overview%>" /> - </form> -</div> - -<%+footer%> diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm index 272612600c..1a53b577d1 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/runtime.htm @@ -75,6 +75,15 @@ This is free software, licensed under the Apache License, Version 2.0 } } + function toggle_qrcode() { + var view = document.getElementById("qrcode"); + if (view.style.display === "none") { + view.style.display = "block"; + } else { + view.style.display = "none"; + } + } + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "travelmate", "status")%>', null, function(x, json_info) { @@ -142,3 +151,74 @@ This is free software, licensed under the Apache License, Version 2.0 <span id="btn1_running" style="display:inline-block; width:16px; height:16px; margin:0 5px"></span> </div> </div> +<div class="cbi-value" id="button_2"> + <label class="cbi-value-title" for="button_2"><%:View AP QR-Codes%></label> + <div class="cbi-value-field"> + <input class="cbi-button cbi-button-apply" type="button" value="<%:Show/Hide QR-Codes%>" onclick="toggle_qrcode()" /> + </div> +</div> +<div class="cbi-value" style="margin-bottom: 0px"> + <span class="cbi-value" style="display: none" id="qrcode"> +<%- + local fs = require("nixio.fs") + local uci = require("luci.model.uci").cursor() + local qrcode + + uci:foreach("wireless", "wifi-iface", function(s) + local device = s.device or "" + local mode = s.mode or "" + local ssid = s.ssid or "" + local enc = s.encryption or "" + local key = s.key or "" + local hidden = s.hidden or "false" + local disabled = s.disabled or "" + local wep_slots = {s.key1 or "", s.key2 or "", s.key3 or "", s.key4 or ""} + + if device and mode == "ap" and disabled ~= "1" then + if string.match(enc, '^psk') then + enc = "WPA" + elseif string.match(enc, '^wep') then + enc = "WEP" + if tonumber(key) then + key = wep_slots[tonumber(key)] + end + elseif enc == "none" then + enc = "nopass" + key = "nokey" + else + enc = "" + end + + if hidden == "1" then + hidden = "true" + end + + if ssid and enc and key then + local e_ssid = string.gsub(ssid,"[\"\\';:, ]",[[\\\%1]]) + local e_key = string.gsub(key,"[\"\\';:, ]",[[\\\%1]]) + + if fs.access("/usr/bin/qrencode") then + qrcode = luci.sys.exec("/usr/bin/qrencode --inline --8bit --type=SVG --output=- 'WIFI:S:\"'" .. e_ssid .. "'\";T:'" .. enc .. "';P:\"'" .. e_key .. "'\";H:'" .. hidden .. "';'") +-%> + <div class="cbi-value" style="border-bottom: 0px; margin-bottom: 0px; padding: 0.25em 0.6em; text-align: left"> + <%=qrcode%> + </div> + <div class="cbi-value" style="border-bottom: 0px; margin-bottom: 0px; padding: 0.25em 0.6em; text-align: left"> + <em><%:AP on %><%=device%><%: with SSID %>"<%=ssid%>"</em> + <hr /> + </div> +<%- + end + end + end + end) + if not qrcode then +-%> + <div class="cbi-value" style="border-bottom: 0px; margin-bottom: 0px; padding: 0.25em 0.6em; text-align: left"> + <em><%:For QR-Code support please install package 'qrencode'!%></em> + </div> +<%- + end +-%> + </span> +</div> diff --git a/applications/luci-app-wireguard/luasrc/controller/wireguard.lua b/applications/luci-app-wireguard/luasrc/controller/wireguard.lua index 68a82fe5cc..5a91960974 100644 --- a/applications/luci-app-wireguard/luasrc/controller/wireguard.lua +++ b/applications/luci-app-wireguard/luasrc/controller/wireguard.lua @@ -4,5 +4,5 @@ module("luci.controller.wireguard", package.seeall) function index() - entry({"admin", "status", "wireguard"}, template("wireguard"), _("WireGuard Status"), 92) + entry({"admin", "status", "wireguard"}, template("wireguard"), _("WireGuard Status"), 92) end diff --git a/applications/luci-app-wireguard/luasrc/view/wireguard.htm b/applications/luci-app-wireguard/luasrc/view/wireguard.htm index c25ef85caa..444533275e 100644 --- a/applications/luci-app-wireguard/luasrc/view/wireguard.htm +++ b/applications/luci-app-wireguard/luasrc/view/wireguard.htm @@ -1,224 +1,264 @@ <%# - Copyright 2016-2017 Dan Luedtke <mail@danrl.com> - Licensed to the public under the Apache License 2.0. + Copyright 2016-2017 Dan Luedtke <mail@danrl.com> + Licensed to the public under the Apache License 2.0. -%> <% - local data = { } - local last_device = "" + local uci = uci.cursor() + local data = { } + local last_device = "" + local enc = { } - local wg_dump = io.popen("wg show all dump") - if wg_dump then - local line - for line in wg_dump:lines() do - local line = string.split(line, "\t") - if not (last_device == line[1]) then - last_device = line[1] - data[line[1]] = { - name = line[1], - public_key = line[3], - listen_port = line[4], - fwmark = line[5], - peers = { } - } - else - local peer = { - public_key = line[2], - endpoint = line[4], - allowed_ips = { }, - latest_handshake = line[6], - transfer_rx = line[7], - transfer_tx = line[8], - persistent_keepalive = line[9] - } - if not (line[4] == '(none)') then - for ipkey, ipvalue in pairs(string.split(line[5], ",")) do - if #ipvalue > 0 then - table.insert(peer['allowed_ips'], ipvalue) - end - end - end - table.insert(data[line[1]].peers, peer) - end - end - end + local wg_dump = io.popen("wg show all dump") + if wg_dump then + local line + for line in wg_dump:lines() do + local line = string.split(line, "\t") + if not (last_device == line[1]) then + last_device = line[1] + data[line[1]] = { + name = line[1], + public_key = line[3], + listen_port = line[4], + fwmark = line[5], + peers = { } + } + local s = uci:get_list("network", line[1], "addresses") + local address = "" + local key, value + for key, value in pairs(s) do + if address ~= "" then + address = address.. ", " ..value + else + address = value + end + end + enc[line[1]] = "[Interface]\nPrivateKey = " ..line[2].. "\nAddress = " ..address + else + local peer = { + public_key = line[2], + endpoint = line[4], + allowed_ips = { }, + latest_handshake = line[6], + transfer_rx = line[7], + transfer_tx = line[8], + persistent_keepalive = line[9] + } + if not (line[4] == '(none)') then + local ipkey, ipvalue + for ipkey, ipvalue in pairs(string.split(line[5], ",")) do + if #ipvalue > 0 then + table.insert(peer['allowed_ips'], ipvalue) + end + end + end + table.insert(data[line[1]].peers, peer) + enc[line[1]] = enc[line[1]].. "\n\n[Peer]\nEndpoint = " ..line[4].. "\nPublicKey = " ..line[2].. "\nAllowedIPs = " ..line[5] + end + end + end - if luci.http.formvalue("status") == "1" then - luci.http.prepare_content("application/json") - luci.http.write_json(data) - return - end + if luci.http.formvalue("status") == "1" then + luci.http.prepare_content("application/json") + luci.http.write_json(data) + return + end -%> <%+header%> <script type="text/javascript">//<![CDATA[ - function bytes_to_str(bytes) { - bytes = parseFloat(bytes); - if (bytes < 1) { return "0 B"; } - var sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB']; - var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); - return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; - }; + function bytes_to_str(bytes) { + bytes = parseFloat(bytes); + if (bytes < 1) { return "0 B"; } + var sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB']; + var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); + return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]; + }; - function timestamp_to_str(timestamp) { - if (timestamp < 1) { - return '<%:Never%>'; - } - var now = new Date(); - var seconds = (now.getTime() / 1000) - timestamp; - var ago = ""; - if (seconds < 60) { - ago = parseInt(seconds) + '<%:s ago%>'; - } else if (seconds < 3600) { - ago = parseInt(seconds / 60) + '<%:m ago%>'; - } else if (seconds < 86401) { - ago = parseInt(seconds / 3600) + '<%:h ago%>'; - } else { - ago = '<%:over a day ago%>'; - } - var t = new Date(timestamp * 1000); - return t.toUTCString() + ' (' + ago + ')'; - } + function timestamp_to_str(timestamp) { + if (timestamp < 1) { + return '<%:Never%>'; + } + var now = new Date(); + var seconds = (now.getTime() / 1000) - timestamp; + var ago = ""; + if (seconds < 60) { + ago = parseInt(seconds) + '<%:s ago%>'; + } else if (seconds < 3600) { + ago = parseInt(seconds / 60) + '<%:m ago%>'; + } else if (seconds < 86401) { + ago = parseInt(seconds / 3600) + '<%:h ago%>'; + } else { + ago = '<%:over a day ago%>'; + } + var t = new Date(timestamp * 1000); + return t.toUTCString() + ' (' + ago + ')'; + } - XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 }, - function(x, data) { - for (var key in data) { - if (!data.hasOwnProperty(key)) { continue; } - var ifname = key; - var iface = data[key]; - var s = ""; - if (iface.public_key == '(none)') { - s += '<em><%:Interface does not have a public key!%></em>'; - } else { - s += String.format( - '<strong><%:Public Key%>: </strong>%s', - iface.public_key - ); - } - if (iface.listen_port > 0) { - s += String.format( - '<br /><strong><%:Listen Port%>: </strong>%s', - iface.listen_port - ); - } - if (iface.fwmark != 'off') { - s += String.format( - '<br /><strong><%:Firewall Mark%>: </strong>%s', - iface.fwmark - ); - } - document.getElementById(ifname + "_info").innerHTML = s; - for (var i = 0, ilen = iface.peers.length; i < ilen; i++) { - var peer = iface.peers[i]; - var s = String.format( - '<strong><%:Public Key%>: </strong>%s', - peer.public_key - ); - if (peer.endpoint != '(none)') { - s += String.format( - '<br /><strong><%:Endpoint%>: </strong>%s', - peer.endpoint - ); - } - if (peer.allowed_ips.length > 0) { - s += '<br /><strong><%:Allowed IPs%>:</strong>'; - for (var k = 0, klen = peer.allowed_ips.length; k < klen; k++) { - s += '<br /> • ' + peer.allowed_ips[k]; - } - } - if (peer.persistent_keepalive != 'off') { - s += String.format( - '<br /><strong><%:Persistent Keepalive%>: </strong>%ss', - peer.persistent_keepalive - ); - } - var icon = '<img src="<%=resource%>/icons/tunnel_disabled.png" />'; - var now = new Date(); - if (((now.getTime() / 1000) - peer.latest_handshake) < 140) { - icon = '<img src="<%=resource%>/icons/tunnel.png" />'; - } - s += String.format( - '<br /><strong><%:Latest Handshake%>: </strong>%s', - timestamp_to_str(peer.latest_handshake) - ); - s += String.format( - '<br /><strong><%:Data Received%>: </strong>%s' + - '<br /><strong><%:Data Transmitted%>: </strong>%s', - bytes_to_str(peer.transfer_rx), - bytes_to_str(peer.transfer_tx) - ); - document.getElementById(ifname + "_" + peer.public_key + "_icon").innerHTML = icon; - document.getElementById(ifname + "_" + peer.public_key + "_info").innerHTML = s; - } - } - }); + function toggle_qrcode(iface) { + var view = document.getElementById(iface.name); + if (view.style.display === "none") { + view.style.display = "block"; + } else { + view.style.display = "none"; + } + } + + XHR.poll(5, '<%=REQUEST_URI%>', { status: 1 }, + function(x, data) { + for (var key in data) { + if (!data.hasOwnProperty(key)) { continue; } + var ifname = key; + var iface = data[key]; + var s = ""; + if (iface.public_key == '(none)') { + s += '<em><%:Interface does not have a public key!%></em>'; + } else { + s += String.format( + '<strong><%:Public Key%>: </strong>%s', + iface.public_key + ); + } + if (iface.listen_port > 0) { + s += String.format( + '<br /><strong><%:Listen Port%>: </strong>%s', + iface.listen_port + ); + } + if (iface.fwmark != 'off') { + s += String.format( + '<br /><strong><%:Firewall Mark%>: </strong>%s', + iface.fwmark + ); + } + document.getElementById(ifname + "_info").innerHTML = s; + for (var i = 0, ilen = iface.peers.length; i < ilen; i++) { + var peer = iface.peers[i]; + var s = String.format( + '<strong><%:Public Key%>: </strong>%s', + peer.public_key + ); + if (peer.endpoint != '(none)') { + s += String.format( + '<br /><strong><%:Endpoint%>: </strong>%s', + peer.endpoint + ); + } + if (peer.allowed_ips.length > 0) { + s += '<br /><strong><%:Allowed IPs%>:</strong>'; + for (var k = 0, klen = peer.allowed_ips.length; k < klen; k++) { + s += '<br />  • ' + peer.allowed_ips[k]; + } + } + if (peer.persistent_keepalive != 'off') { + s += String.format( + '<br /><strong><%:Persistent Keepalive%>: </strong>%ss', + peer.persistent_keepalive + ); + } + var icon = '<img src="<%=resource%>/icons/tunnel_disabled.png" />'; + var now = new Date(); + if (((now.getTime() / 1000) - peer.latest_handshake) < 140) { + icon = '<img src="<%=resource%>/icons/tunnel.png" />'; + } + s += String.format( + '<br /><strong><%:Latest Handshake%>: </strong>%s', + timestamp_to_str(peer.latest_handshake) + ); + s += String.format( + '<br /><strong><%:Data Received%>: </strong>%s' + + '<br /><strong><%:Data Transmitted%>: </strong>%s', + bytes_to_str(peer.transfer_rx), + bytes_to_str(peer.transfer_tx), + ); + document.getElementById(ifname + "_" + peer.public_key + "_icon").innerHTML = icon; + document.getElementById(ifname + "_" + peer.public_key + "_info").innerHTML = s; + } + } + }); //]]></script> <h2>WireGuard Status</h2> -<fieldset class="cbi-section"> +<div class="cbi-section"> <%- +local ikey, iface for ikey, iface in pairs(data) do - -%> - <legend><%:Interface%> <%=ikey%></legend> - <div class="table" width="100%" cellspacing="10"> - <div class="tr"> - <div class="td" width="33%" style="vertical-align:top"><%:Configuration%></div> - <div class="td"> - <div class="table"> - <div class="tr"> - <div class="td" id="<%=ikey%>_icon" style="width:16px; text-align:center; padding:3px"> - - </div> - <div class="td" id="<%=ikey%>_info" style="vertical-align:middle; padding: 3px"> - <em><%:Collecting data...%></em> - </div> - </div></div> - </div> - </div> - <%- - local cur = uci.cursor() - for pkey, peer in pairs(iface.peers) do - local desc, tmp_desc, pub_key = "", "", "" - cur:foreach("network", "wireguard_" .. ikey, function(s) - local tmp_desc, pub_key = "", "" - for key, value in pairs(s) do - if key == "description" then - tmp_desc = value - end - if value == peer.public_key then - pub_key = value - end - if pub_key == peer.public_key and tmp_desc ~= "" then - desc = ': ' .. tmp_desc - end - end - end) - -%> - <div class="tr"> - <div class="td" width="33%" style="vertical-align:top"><%:Peer%><%=desc%></div> - <div class="td"> - <div class="table"> - <div class="tr"> - <div class="td" id="<%=ikey%>_<%=peer.public_key%>_icon" style="width:16px; text-align:center; padding:3px"> - <img src="<%=resource%>/icons/tunnel_disabled.png" /><br /> - <small>?</small> - </div> - <div class="td" id="<%=ikey%>_<%=peer.public_key%>_info" style="vertical-align:middle; padding: 3px"> - <em><%:Collecting data...%></em> - </div> - </div></div> - </div> - </div> - <%- - end - -%> - </div> - <%- +-%> + <h3><%:Interface%> <%=ikey%></h3> + <div class="cbi-value" id="button" style="padding: 5px"> + <input class="cbi-button cbi-button-apply" type="button" name="qrcode_<%=ikey%>" value="<%:Show/Hide QR-Code%>" onclick="toggle_qrcode(this)" /> + </div> +<%- + local qrcode + if fs.access("/usr/bin/qrencode") then + if enc[ikey]:sub(26,31) ~= "(none)" then + qrcode = luci.sys.exec("/usr/bin/qrencode --inline --8bit --type=SVG --output=- '" ..enc[ikey].. "'") + end + else + qrcode = "<em>For QR-Code support please install package 'qrencode'!</em>" + end +-%> + <div class="cbi-value-title"> + <span class="cbi-value" style="display: none" id="qrcode_<%=ikey%>"><%=qrcode%></span> + </div> + <div class="cbi-section-node"> + <div class="table cbi-section-table"> + <div class="tr cbi-section-table-row" style="text-align: left;"> + <div class="td" style="text-align: left; vertical-align:top"><%:Configuration%></div> + <div class="td" style="flex: 0 1 90%; text-align: left;"> + <div class="table cbi-section-table" style="border: 0px;"> + <div class="tr cbi-section-table-row" style="text-align: left; border: 0px;"> + <div class="td" id="<%=ikey%>_icon" style="width: 22px; text-align: left; border-top: 0px; padding: 3px;"> </div> + <div class="td" id="<%=ikey%>_info" style="flex: 0 1 90%; text-align: left; vertical-align:middle; padding: 3px; border-top: 0px;"><em><%:Collecting data...%></em></div> + </div> + </div> + </div> + </div> + <%- + local cur = uci.cursor() + local pkey, peer + for pkey, peer in pairs(iface.peers) do + local desc + cur:foreach("network", "wireguard_" .. ikey, function(s) + local key, value, tmp_desc, pub_key + for key, value in pairs(s) do + if key == "description" then + tmp_desc = value + end + if value == peer.public_key then + pub_key = value + end + if pub_key and tmp_desc then + desc = ': ' ..tmp_desc + end + end + end) + -%> + <div class="tr cbi-section-table-row" style="text-align: left;"> + <div class="td" style="text-align: left; vertical-align:top"><%:Peer%><%=desc%></div> + <div class="td" style="flex: 0 1 90%; text-align: left;"> + <div class="table cbi-section-table" style="border: 0px"> + <div class="tr cbi-section-table-row" style="border: 0px;"> + <div class="td" id="<%=ikey%>_<%=peer.public_key%>_icon" style="width:16px; text-align: left; padding: 3px;border-top: 0px;"> + <img src="<%=resource%>/icons/tunnel_disabled.png" /> + <small>?</small> + </div> + <div class="td" id="<%=ikey%>_<%=peer.public_key%>_info" style="flex: 0 1 90%; text-align: left; vertical-align:middle; padding: 3px;border-top: 0px;"><em><%:Collecting data...%></em></div> + </div> + </div> + </div> + </div> + <%- + end + -%> + </div> + </div> + <%- end -%> -</fieldset> +</div> <%+footer%> |