+
๐พ OpenClaw Mission Control
-
+
Loading...
@@ -126,11 +126,11 @@ const authHdr=()=>({headers:{'Authorization':'Bearer '+TOKEN}});
function doLogin(){
const t=$('#tokenInput').value.trim();if(!t)return;
- fetch('/api/dashboard',{headers:{'Authorization':'Bearer '+t}}).then(r=>{
- if(r.status===401){$('#loginErr').style.display='block';return}
+ fetch('/api/dashboard',{headers:{'Authorization':'Bearer '+t}}).then(r=>r.json()).then(d=>{
+ if(!d.authed){$('#loginErr').style.display='block';return}
TOKEN=t;localStorage.setItem('oc-token',t);
- $('#loginMask').style.display='none';$('#mainWrap').style.display='';
- r.json().then(d=>{DATA=d;render();});connectWS();setInterval(load,60000);
+ $('#loginMask').style.display='none';$('#lockBtn').textContent='๐';
+ DATA=d;render();
});
}
@@ -314,6 +314,7 @@ function toggleTheme(){
localStorage.setItem('theme',light?'dark':'light');
}
(function(){const t=localStorage.getItem('theme');if(t==='light'){document.documentElement.setAttribute('data-theme','light');document.getElementById('themeBtn').textContent='โ๏ธ';}})();
-if(TOKEN){fetch('/api/dashboard',authHdr()).then(r=>{if(r.status===401){$('#loginMask').style.display='';return}$('#loginMask').style.display='none';$('#mainWrap').style.display='';r.json().then(d=>{DATA=d;render();});connectWS();setInterval(load,60000);}).catch(()=>{$('#loginMask').style.display='';});}
+if(TOKEN){$('#lockBtn').textContent='๐';}
+load();connectWS();setInterval(load,60000);