add interface speed for networking (windows for now) #7354

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458
2025-10-27 16:05:35 +00:00
parent a051cb5548
commit b50d07c183
5 changed files with 4379 additions and 4250 deletions

View File

@@ -2919,6 +2919,14 @@
return format("{0}g left", Math.round(bytes / 1024 / 1024 / 1024));
}
function getNetworkSpeed(bitsPerSecond) {
if (bitsPerSecond <= 0) return "0 bps";
if (bitsPerSecond < 1000) return format("{0} bps", bitsPerSecond);
if (bitsPerSecond < 1000000) return format("{0} Kbps", Math.round(bitsPerSecond / 1000));
if (bitsPerSecond < 1000000000) return format("{0} Mbps", Math.round(bitsPerSecond / 1000000));
return format("{0} Gbps", (bitsPerSecond / 1000000000).toFixed(1));
}
function p5getQuotabar(f) {
while (f.t > 1 && f.t != 4) { f = f.parent; }
if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return '';
@@ -6436,6 +6444,9 @@
x += addDetailItem("MAC Layer", format("MAC: {0}", EscapeHtml(m[0].mac)));
}
}
if (typeof m[0].speed == 'number' && (m[0].speed != 9223372036854775807 && m[0].speed > 0)) {
x += addDetailItem("Interface Speed", format("{0}", getNetworkSpeed(m[0].speed)));
}
for (var j = 0; j < m.length; j++) {
var iplayer = m[j], items = [];
if (iplayer.address) { items.push(format("IP: {0}", EscapeHtml(iplayer.address))); }

View File

@@ -12324,6 +12324,9 @@
x += addDetailItem("MAC Layer", format("MAC: {0}", EscapeHtml(m[0].mac)));
}
}
if (typeof m[0].speed == 'number' && (m[0].speed != 9223372036854775807 && m[0].speed > 0)) {
x += addDetailItem("Interface Speed", format("{0}", getNetworkSpeed(m[0].speed)));
}
for (var j = 0; j < m.length; j++) {
var iplayer = m[j], items = [];
if (iplayer.address) { items.push(format("IP: {0}", EscapeHtml(iplayer.address))); }
@@ -15022,6 +15025,14 @@
return format("{0} Gb", round(bytes / 1024 / 1024 / 1024, 1));
}
function getNetworkSpeed(bitsPerSecond) {
if (bitsPerSecond <= 0) return "0 bps";
if (bitsPerSecond < 1000) return format("{0} bps", bitsPerSecond);
if (bitsPerSecond < 1000000) return format("{0} Kbps", Math.round(bitsPerSecond / 1000));
if (bitsPerSecond < 1000000000) return format("{0} Mbps", Math.round(bitsPerSecond / 1000000));
return format("{0} Gbps", (bitsPerSecond / 1000000000).toFixed(1));
}
function p5getQuotabar(f) {
while (f.t > 1 && f.t != 4) { f = f.parent; }
if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return '';

View File

@@ -13339,6 +13339,9 @@
x += addDetailItem("MAC Layer", format("MAC: {0}", EscapeHtml(m[0].mac)));
}
}
if (typeof m[0].speed == 'number' && (m[0].speed != 9223372036854775807 && m[0].speed > 0)) {
x += addDetailItem("Interface Speed", format("{0}", getNetworkSpeed(m[0].speed)));
}
for (var j = 0; j < m.length; j++) {
var iplayer = m[j], items = [];
if (iplayer.address) { items.push(format("IP: {0}", EscapeHtml(iplayer.address))); }
@@ -16328,6 +16331,14 @@
return format("{0} Gb", round(bytes / 1024 / 1024 / 1024, 1));
}
function getNetworkSpeed(bitsPerSecond) {
if (bitsPerSecond <= 0) return "0 bps";
if (bitsPerSecond < 1000) return format("{0} bps", bitsPerSecond);
if (bitsPerSecond < 1000000) return format("{0} Kbps", Math.round(bitsPerSecond / 1000));
if (bitsPerSecond < 1000000000) return format("{0} Mbps", Math.round(bitsPerSecond / 1000000));
return format("{0} Gbps", (bitsPerSecond / 1000000000).toFixed(1));
}
function p5getQuotabar(f) {
while (f.t > 1 && f.t != 4) { f = f.parent; }
if ((f.t != 1 && f.t != 4) || (f.maxbytes == null)) return '';