diff --git a/app/main.py b/app/main.py
index 177b0e1..80e8963 100644
--- a/app/main.py
+++ b/app/main.py
@@ -2,6 +2,7 @@ import asyncio
from contextlib import asynccontextmanager
from fastapi import FastAPI
+from fastapi.responses import FileResponse
from fastapi.staticfiles import StaticFiles
import app.bets.confirmation # noqa: F401 (registers the "bet" confirmation handler)
@@ -64,4 +65,9 @@ async def health() -> dict[str, str]:
return {"status": "ok"}
+@app.get("/admin", include_in_schema=False)
+async def admin_panel() -> FileResponse:
+ return FileResponse("app/static/admin.html")
+
+
app.mount("/", StaticFiles(directory="app/static", html=True), name="static")
diff --git a/app/static/admin.html b/app/static/admin.html
new file mode 100644
index 0000000..305df2c
--- /dev/null
+++ b/app/static/admin.html
@@ -0,0 +1,93 @@
+
+
+
+
+PLM Lottery - Admin
+
+
+
+
+PLM Lottery - Pannello Admin
+
+
+
+Log
+
+
+
+
+
+
diff --git a/app/static/index.html b/app/static/index.html
index 25796f5..5e04ca1 100644
--- a/app/static/index.html
+++ b/app/static/index.html
@@ -63,29 +63,6 @@
Preleva
-
-
Log
@@ -166,45 +143,6 @@ async function withdraw() {
}
if (token) showDashboard();
-
-async function callAdmin(method, path, body) {
- const adminToken = document.getElementById('admin-token').value;
- const headers = { 'Content-Type': 'application/json', 'X-Admin-Token': adminToken };
- const res = await fetch(path, { method, headers, body: body ? JSON.stringify(body) : undefined });
- const data = await res.json().catch(() => ({}));
- log({ request: method + ' ' + path, status: res.status, response: data });
- if (!res.ok) throw new Error(data.detail || res.statusText);
- return data;
-}
-
-function adminStatus(msg, ok) {
- const el = document.getElementById('admin-status');
- el.textContent = msg;
- el.style.color = ok ? '#2a7a2a' : '#a02020';
-}
-
-async function adminLoad() {
- try {
- const data = await callAdmin('GET', '/admin/config');
- document.getElementById('admin-fee-address').value = data.fee_address;
- document.getElementById('admin-bet-amount').value = data.bet_amount_sats;
- document.getElementById('admin-form').classList.remove('hidden');
- adminStatus('Configurazione caricata.', true);
- } catch (e) {
- adminStatus('Errore: token admin non valido o server non raggiungibile.', false);
- }
-}
-
-async function adminSave() {
- const feeAddress = document.getElementById('admin-fee-address').value;
- const betAmount = parseInt(document.getElementById('admin-bet-amount').value, 10);
- try {
- await callAdmin('PUT', '/admin/config', { fee_address: feeAddress, bet_amount_sats: betAmount });
- adminStatus('Salvato.', true);
- } catch (e) {
- adminStatus('Errore nel salvataggio: ' + e.message, false);
- }
-}