Add basic interface information on Settings->System page

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-07-14 17:33:23 +02:00
parent 9d8a3dfc31
commit b732092348
2 changed files with 31 additions and 0 deletions

View File

@@ -362,4 +362,23 @@ $(function () {
}, },
}, },
}); });
$.ajax({
url: "/api/network/gateway",
})
.done(function (data) {
const gateway = data.gateway;
// Get first object in gateway that has family == "inet"
const inet = gateway.find(obj => obj.family === "inet");
// Get first object in gateway that has family == "inet6"
const inet6 = gateway.find(obj => obj.family === "inet6");
$("#sysinfo-gw-v4-addr").text(inet ? inet.local.join('\n') : "N/A");
$("#sysinfo-gw-v4-iface").text(inet ? inet.interface : "N/A");
$("#sysinfo-gw-v6-addr").text(inet6 ? inet6.local.join('\n') : "N/A");
$("#sysinfo-gw-v6-iface").text(inet6 ? inet6.interface : "N/A");
})
.fail(function (data) {
apiFailure(data);
});
}); });

View File

@@ -54,6 +54,18 @@ mg.include('scripts/pi-hole/lua/settings_header.lp','r')
</tr> </tr>
</tbody> </tbody>
</table> </table>
<table class="table table-striped table-bordered nowrap">
<tbody>
<tr>
<th scope="row">IPv4 address:</th>
<td><code id="sysinfo-gw-v4-addr">?</code>&nbsp;@&nbsp;<code id="sysinfo-gw-v4-iface">?</code></td>
</tr>
<tr>
<th scope="row">IPv6 address:</th>
<td><code id="sysinfo-gw-v6-addr">?</code>&nbsp;@&nbsp;<code id="sysinfo-gw-v6-iface">?</code></td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>