From 0fe2e72f7817751aa4f73da31efdc70a799f799a Mon Sep 17 00:00:00 2001 From: rwalli Date: Sat, 25 Aug 2018 19:04:36 +0200 Subject: [PATCH] luci-app-wireguard: add descriptions Add description fields to luci-app-wireguard similar to those in luci-proto-wireguard. Ref: https://github.com/openwrt/luci/commit/140f41b4 Suggested-by: "rwalli" [squash commits, reword commit message, remove semicolons, remove trailing white space] Signed-off-by: Jo-Philipp Wich --- .../luasrc/view/wireguard.htm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/applications/luci-app-wireguard/luasrc/view/wireguard.htm b/applications/luci-app-wireguard/luasrc/view/wireguard.htm index cd08e9ed5..c25ef85ca 100644 --- a/applications/luci-app-wireguard/luasrc/view/wireguard.htm +++ b/applications/luci-app-wireguard/luasrc/view/wireguard.htm @@ -179,10 +179,26 @@ for ikey, iface in pairs(data) do <%- + 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) -%>
-
<%:Peer%>
+
<%:Peer%><%=desc%>
-- 2.25.1