diff --git a/cjdns/Makefile b/cjdns/Makefile index cd5ca90..6ff61bb 100644 --- a/cjdns/Makefile +++ b/cjdns/Makefile @@ -18,11 +18,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cjdns PKG_VERSION:=20.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://github.com/cjdelisle/cjdns.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=77259a49e5bc7ca7bc6dca5bd423e02be563bdc5 +PKG_SOURCE_VERSION:=a88859364aa2e38acd96a34f4ec9085b59fd6f1e PKG_LICENSE:=GPL-3.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) diff --git a/luci-app-cjdns/luasrc/controller/cjdns.lua b/luci-app-cjdns/luasrc/controller/cjdns.lua index 63644cb..72c9d86 100644 --- a/luci-app-cjdns/luasrc/controller/cjdns.lua +++ b/luci-app-cjdns/luasrc/controller/cjdns.lua @@ -51,7 +51,9 @@ function act_peers() end for i,peer in pairs(response.peers) do - peer.ipv6 = publictoip6(peer.publicKey) + peer.ipv6 = publictoip6(peer.addr) + peer.version = pstatver(peer.addr) + peer.label = pstatlabel(peer.addr) if peer.user == nil then peer.user = '' uci.cursor():foreach("cjdns", "udp_peer", function(udp_peer) @@ -97,9 +99,23 @@ function act_ping() luci.http.write_json(response) end -function publictoip6(publicKey) - local process = io.popen("/usr/bin/publictoip6 " .. publicKey, "r") +function publictoip6(addrLine) + local t = string.sub(addrLine, string.len(addrLine) - 53) + local process = io.popen("/usr/bin/publictoip6 " .. t, "r") local ipv6 = process:read() process:close() return ipv6 end + +function pstatver(addrLine) + for str in string.gmatch(addrLine, "([^"..".".."]+)") do + if str then return str else return '-' end + end +end + +function pstatlabel(addrLine) + local t={}; local i=0; for str in string.gmatch(addrLine, "([^"..".".."]+)") do + if i >= 1 and i <= 4 then t[#t+1] = str end i = i + 1 + end + return table.concat(t, ".") +end diff --git a/luci-app-cjdns/luasrc/view/cjdns/status.htm b/luci-app-cjdns/luasrc/view/cjdns/status.htm index 9d43e85..5851138 100644 --- a/luci-app-cjdns/luasrc/view/cjdns/status.htm +++ b/luci-app-cjdns/luasrc/view/cjdns/status.htm @@ -36,12 +36,13 @@ var status = interface + ', ' + peer.state.toLowerCase(); - if (peer.version === 0) { + if ((typeof peer.version === 'undefined') || (peer.version == false)) { var version = '-'; } else { - var version = 'v' + peer.version; + var version = peer.version; } + var link = peer.lladdr; var rxtx = lbbytes(peer.bytesIn) + ' / ' + lbbytes(peer.bytesOut); var row = table.insertRow(-1); @@ -50,13 +51,14 @@ row.insertCell(-1).textContent = peer.ipv6; row.insertCell(-1).textContent = status; row.insertCell(-1).textContent = version; + row.insertCell(-1).textContent = link; row.insertCell(-1).textContent = rxtx; var latencyCell = row.insertCell(-1); latencyCell.textContent = 'waiting'; var pingURI = '<%=luci.dispatcher.build_url("admin", "services", "cjdns", "ping")%>'; var timeout = 2000; - XHR.get(pingURI, { label: peer.switchLabel, timeout: timeout }, function(x, pong) { + XHR.get(pingURI, { label: peer.label, timeout: timeout }, function(x, pong) { var pongrsp = ((pong.err == "ai:recv > timeout") || (pong == "undefined") || (pong.ms >= timeout)) ? '> ' + timeout + ' ms' : pong.ms + ' ms'; @@ -106,6 +108,7 @@ function lbbytes (bytes){ IPv6 Status Version + Address Rx / Tx Latency