diff --git a/Dockerfile b/Dockerfile
index f809079..9e5f3cb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,2 +1,3 @@
FROM php:8.3-apache
RUN docker-php-ext-install pdo pdo_mysql
+COPY ./web /var/www/html/
diff --git a/web/admin.html b/web/admin.html
index d26494a..e8263de 100644
--- a/web/admin.html
+++ b/web/admin.html
@@ -90,7 +90,7 @@
@@ -245,7 +245,21 @@
async function loadAdmin() {
try {
- const data = await fetch('/api/admin.php').then(r => r.json());
+ const r = await fetch('/api/admin.php', { redirect: 'manual' });
+ if (r.type === 'opaqueredirect') { window.location.reload(); return; }
+ if (!r.ok) { window.location.replace('index.html'); return; }
+ const data = await r.json();
+
+ if (!data.is_admin) {
+ window.location.replace('index.html');
+ return;
+ }
+
+ document.querySelectorAll('.admin-nav-link').forEach(el => el.classList.remove('d-none'));
+ const name = data.name || data.username;
+ if (name) {
+ document.querySelectorAll('.nav-username').forEach(el => { el.textContent = name; });
+ }
document.getElementById('sandboxToggle').checked = data.sandbox_mode;
document.getElementById('sandboxBanner').style.display = data.sandbox_mode ? '' : 'none';
@@ -359,6 +373,7 @@
// ─── Init ────────────────────────────────────────────────────────────────────
loadAdmin();
+ document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') loadAdmin(); });