Init public repo
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
function add_user(ip, mac)
|
||||
{
|
||||
const tabel = document.querySelector("#user-list");
|
||||
|
||||
const tr = document.createElement('tr');
|
||||
|
||||
const rdIP = document.createElement('td');
|
||||
rdIP.textContent = ip;
|
||||
|
||||
const rdMAC = document.createElement('td');
|
||||
rdMAC.textContent = mac;
|
||||
|
||||
tr.appendChild(rdIP);
|
||||
tr.appendChild(rdMAC);
|
||||
|
||||
tabel.appendChild(tr);
|
||||
}
|
||||
|
||||
async function update_user_list()
|
||||
{
|
||||
const res = await fetch("http://192.168.4.1/user_list", {
|
||||
method: "GET"
|
||||
});
|
||||
|
||||
if (res.ok)
|
||||
{
|
||||
const body = await res.json();
|
||||
|
||||
const tabel = document.querySelector("#user-list");
|
||||
tabel.textContent = '';
|
||||
|
||||
for (let i = 0; i < body.user_ip.length; i++) {
|
||||
add_user(body.user_ip[i], body.user_mac[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update_user_list();
|
||||
setInterval(update_user_list, 10000);
|
||||
Reference in New Issue
Block a user