fix: use shared auth-guard.js on upload.html

This commit is contained in:
Zac Gaetano 2026-05-18 13:26:19 -04:00
parent a40232e2b5
commit d8766f18cc

View file

@ -480,24 +480,6 @@
return (bytes/1024/1024/1024).toFixed(2) + ' GB';
}
</script>
<script>
(async () => {
try {
const r = await fetch('/api/v1/auth/me', { credentials: 'include' });
if (r.ok) {
const u = await r.json();
const name = u.display_name || u.username || 'User';
document.getElementById('userName').textContent = name;
document.getElementById('userAvatar').textContent = name[0].toUpperCase();
const roleEl = document.getElementById('userRole');
if (roleEl) roleEl.textContent = u.role || '';
}
} catch (_) {}
document.getElementById('logoutBtn').onclick = async () => {
try { await fetch('/api/v1/auth/logout', { method: 'POST', credentials: 'include' }); } catch (_) {}
location.href = 'login.html';
};
})();
</script>
<script src="js/auth-guard.js"></script>
</body>
</html>