Commit 3b51a58e authored by Vitaly Lipatov's avatar Vitaly Lipatov

web-api: show SLOW status when speed test detects slow gateway

Mark gateway as SLOW (instead of OK) in accessibility section when file download speed is less than 10% of the fastest gateway. Also show speed in the gateway status line. Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 9467481c
......@@ -1122,6 +1122,10 @@ function renderCheck(data) {
// Gateways (IPv4 + IPv6)
const thr = data.throttle || {};
const spd = data.speed || {};
// Find max speed for SLOW detection
let maxSpd = 0;
for (const v of Object.values(spd)) { if (v.speed > maxSpd) maxSpd = v.speed; }
const gsec = mkDiv('check-section');
gsec.appendChild(mkDiv('check-section-title', '\\u0414\\u043e\\u0441\\u0442\\u0443\\u043f\\u043d\\u043e\\u0441\\u0442\\u044c \\u0447\\u0435\\u0440\\u0435\\u0437 \\u0448\\u043b\\u044e\\u0437\\u044b'));
const gwrap = document.createElement('div');
......@@ -1132,10 +1136,12 @@ function renderCheck(data) {
let st4 = info.status;
const gwThr = thr[name];
if (gwThr && gwThr.throttled && st4 === 'OK') st4 = 'SLOW';
const gwSpd = spd[name];
if (gwSpd && !gwSpd.error && maxSpd > 0 && gwSpd.speed < maxSpd / 10 && st4 === 'OK') st4 = 'SLOW';
const cls4 = st4 === 'OK' ? 'ok' : st4 === 'SLOW' ? 'slow' : st4 === 'BLOCK' ? 'block' : st4 === 'PROXY?' ? 'proxy' : 'other';
const el4 = document.createElement('span');
el4.className = 'check-gw ' + cls4;
el4.textContent = name + ': ' + st4;
el4.textContent = name + ': ' + st4 + (gwSpd && !gwSpd.error ? ' (' + gwSpd.speed_str + ')' : '');
if (gwThr && gwThr.throttled) el4.title = gwThr.asset + ': ' + gwThr.size + ' \\u0431\\u0430\\u0439\\u0442 \\u0437\\u0430 ' + gwThr.time + '\\u0441';
gwrap.appendChild(el4);
if (info.status_v6 && info.status_v6 !== 'PROXY?' && info.status_v6 !== 'NOIP') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment