From d27f110498212fd94bc6ccef36f3e2767996070e Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 31 Jan 2025 20:00:33 +0000 Subject: [PATCH] http rtt in serverinfo panel --- copyparty/web/browser.html | 2 -- copyparty/web/browser.js | 13 +++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/copyparty/web/browser.html b/copyparty/web/browser.html index 1fc2982f..a642e9a9 100644 --- a/copyparty/web/browser.html +++ b/copyparty/web/browser.html @@ -124,9 +124,7 @@ - {%- if srv_info %}
{{ srv_info }}
- {%- endif %}
diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 613a1c60..5834b390 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -2220,6 +2220,7 @@ var ACtx = !IPHONE && (window.AudioContext || window.webkitAudioContext), hash0 = location.hash, sloc0 = '' + location, noih = /[?&]v\b/.exec(sloc0), + rtt = null, ldks = [], dks = {}, dk, mp; @@ -7698,6 +7699,8 @@ var treectl = (function () { if (!xhrchk(this, L.fl_xe1, L.fl_xe2)) return; + rtt = Date.now() - this.ts; + r.nextdir = null; var cdir = get_evpath(), lfiles = ebi('files'), @@ -7741,10 +7744,12 @@ var treectl = (function () { dk = res.dk; srvinf = res.srvinf; - try { - ebi('srv_info').innerHTML = ebi('srv_info2').innerHTML = '' + res.srvinf + ''; - } - catch (ex) { } + if (rtt !== null) + srvinf += (srvinf ? ' // rtt: ' : 'rtt: ') + rtt; + + var o = ebi('srv_info2'); + if (o) + o.innerHTML = ebi('srv_info').innerHTML = '' + srvinf + ''; if (this.hpush && !showfile.active()) hist_push(this.top + (dk ? '?k=' + dk : ''));