From 4f009539b0ed2926883a731bf1122731ec076b65 Mon Sep 17 00:00:00 2001 From: Brunoz78 Date: Sun, 4 Oct 2026 18:33:23 +0200 Subject: [PATCH] web: name the browser tab after the switch hostname With several switches open, every tab was called "Switch". The dashboard tab now shows the hostname, and the login page shows the hostname seen at the last login on that address (kept in localStorage, which is per switch), or the address itself before the first login. Co-Authored-By: Claude Opus 5.5 --- html/app.js | 6 +++++- html/login.html | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/html/app.js b/html/app.js index 1d29bf08..c638f31b 100644 --- a/html/app.js +++ b/html/app.js @@ -1044,7 +1044,11 @@ function renderInfo(){ if(v==null||v==="")return; tb.appendChild(h("tr",null,[h("td",{class:"mut",text:t(r[0])}),h("td",{class:"mono",text:String(v)})])); }); - if(S.info.hostname)$("brandname").textContent=$("brandname").title=S.info.hostname; + if(S.info.hostname){ + $("brandname").textContent=$("brandname").title=document.title=S.info.hostname; + // Remembered per switch (each has its own origin) for the login page tab + try{localStorage.setItem("rtl_host",S.info.hostname);}catch(e){} + } if(S.info.sw_ver)$("fver").textContent="RTLPlayground "+S.info.sw_ver; } function pollInfo(){ diff --git a/html/login.html b/html/login.html index 9490f77a..042a5c45 100644 --- a/html/login.html +++ b/html/login.html @@ -92,8 +92,12 @@ button:hover{filter:brightness(1.1)} try{l=localStorage.getItem("rtl_lang");}catch(e){} if(!L[l])l=(navigator.language||"en").slice(0,2); var s=L[l]||L.en; - document.title=s[0]; - document.getElementById("hn").textContent=s[0]; + // Name the tab after the switch: the hostname seen at the last login here, + // otherwise the address, so several open switches can be told apart + var host=null; + try{host=localStorage.getItem("rtl_host");}catch(e){} + document.title=(host||location.hostname)+" – "+s[0]; + document.getElementById("hn").textContent=host||s[0]; document.getElementById("sub").textContent=s[1]; document.getElementById("lp").textContent=s[2]; document.getElementById("lb").textContent=s[3];