async function login() { const user = document.getElementById('user').value; const pass = document.getElementById('pass').value; const res = await fetch('/api/auth', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ user, pass }) }); const data = await res.json(); if (res.ok) { // CRITICAL: This tells app.html who you are localStorage.setItem('logged_user', user); window.location.href = '/app.html'; } else { // DEBUG OUTPUT document.getElementById('msg').innerText = `DEBUG: ${data.error} | Expected: ${data.expected?.substring(0,8)}...`; } }