diff --git a/luci-app-cjdns/Makefile b/luci-app-cjdns/Makefile index 793b4ec..9c92151 100644 --- a/luci-app-cjdns/Makefile +++ b/luci-app-cjdns/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2014,2015 Hyperboria.net +# Copyright (C) 2014,2018 Hyperboria.net # # You may redistribute this program and/or modify it under the terms of # the GNU General Public License as published by the Free Software Foundation, @@ -18,7 +18,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-cjdns PKG_VERSION:=1.3 -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_LICENSE:=GPL-3.0 @@ -29,7 +29,7 @@ define Package/luci-app-cjdns CATEGORY:=LuCI SUBMENU:=3. Applications TITLE:=Encrypted near-zero-conf mesh routing protocol - URL:=https://github.com/hyperboria/cjdns + URL:=https://github.com/cjdelisle/cjdns MAINTAINER:=Lars Gierth DEPENDS:=+cjdns +luci-base endef diff --git a/luci-app-cjdns/luasrc/controller/cjdns.lua b/luci-app-cjdns/luasrc/controller/cjdns.lua index 63644cb..362d84a 100644 --- a/luci-app-cjdns/luasrc/controller/cjdns.lua +++ b/luci-app-cjdns/luasrc/controller/cjdns.lua @@ -51,15 +51,16 @@ function act_peers() end for i,peer in pairs(response.peers) do - peer.ipv6 = publictoip6(peer.publicKey) - if peer.user == nil then - peer.user = '' - uci.cursor():foreach("cjdns", "udp_peer", function(udp_peer) - if peer.publicKey == udp_peer.public_key then - peer.user = udp_peer.user - end - end) - end + local peertable = peerstats_join(peer.addr) + peer.ipv6 = peertable['ipv6'] + peer.version = peertable['version'] + peer.label = peertable['label'] + peer.pubkey = peertable['pubkey'] + uci.cursor():foreach("cjdns", "udp_peer", function(udp_peer) + if peer.pubkey == udp_peer.public_key then + peer.user = udp_peer.user + end + end) peers[#peers + 1] = peer end @@ -97,9 +98,13 @@ function act_ping() luci.http.write_json(response) end -function publictoip6(publicKey) - local process = io.popen("/usr/bin/publictoip6 " .. publicKey, "r") - local ipv6 = process:read() - process:close() - return ipv6 -end +function peerstats_join(addrLine) + local pubkey = addrLine:sub(addrLine:len() - 53) + local process = io.popen("/usr/bin/publictoip6 " .. pubkey, "r") + local ipv6 = process:read() + local label = 'label' + process:close() + local version = addrLine:match("^(v%w+)%.") or 'v0' + local label = addrLine:sub(version:len() + 2, version:len() + 20) + return { pubkey=pubkey, ipv6=ipv6, label=label, version=version } +end \ No newline at end of file diff --git a/luci-app-cjdns/luasrc/view/cjdns/status.htm b/luci-app-cjdns/luasrc/view/cjdns/status.htm index 9d43e85..3da5d7c 100644 --- a/luci-app-cjdns/luasrc/view/cjdns/status.htm +++ b/luci-app-cjdns/luasrc/view/cjdns/status.htm @@ -1,116 +1,67 @@ - - -
- Active cjdns peers - - - - - - - - - - - - -
User/NameIPv6StatusVersionRx / TxLatency
Querying Admin API
-
+
+
+ <%:Active cjdns peers%> + + + + + + + + + +
AddressIPv6VersionStatusRx / TxUser/Name
+
+
\ No newline at end of file