luci-proto-wireguard: fix loading peer descriptions

Explicitly load `network` uci in wireguard rpcd backend as `ctx.foreach()`
does not implicitly load it.

Also remove leftover test setup information from the status page source.

Fixes: #6095
Fixes: 008fa18878 ("luci-proto-wireguard: rewrite rpcd handler in ucode")
Fixes: 6e6fce3eb4 ("luci-proto-wireguard: merge status page functionality")
Ref: https://github.com/jow-/ucode/pull/126
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-11-23 13:15:07 +01:00
parent 8012ad2ad5
commit 22c51acf81
2 changed files with 2 additions and 37 deletions

View File

@ -30,43 +30,6 @@ function timestampToStr(timestamp) {
return (new Date(timestamp * 1000)).toUTCString() + ' (' + ago + ')';
}
/*
{
"jow": {
"public_key": "o4iLoC1pl8+vEUshV7eUyKrryo7cr0WJkjS/Dlixxy8=",
"name": "jow",
"fwmark": "off",
"listen_port": "51821",
"peers": [
{
"endpoint": "45.13.105.118:51821",
"public_key": "672KLy/R4miKXdvw2unuf9jQzVEmNnqen5kF+zVjMX0=",
"name": "m300",
"latest_handshake": "1668680574",
"persistent_keepalive": "off",
"allowed_ips": [
"192.168.220.10/32"
],
"transfer_tx": "308",
"transfer_rx": "220"
},
{
"endpoint": "171.22.3.161:51821",
"public_key": "yblNj1s41F8m1MdXhxD2U+Aew6ZR6Miy8OcNK/fkAks=",
"name": "ac2",
"latest_handshake": "0",
"persistent_keepalive": "off",
"allowed_ips": [
"192.168.220.11/32"
],
"transfer_tx": "2960",
"transfer_rx": "0"
}
]
}
}
*/
function handleInterfaceDetails(iface) {
ui.showModal(_('Instance Details'), [
ui.itemlist(E([]), [

View File

@ -52,6 +52,8 @@ const methods = {
const wg_dump = popen("wg show all dump 2>/dev/null");
if (wg_dump) {
uci.load("network");
for (let line = wg_dump.read('line'); length(line); line = wg_dump.read('line')) {
const record = split(rtrim(line, '\n'), '\t');