/** * admin.js: ChessTB Admin Dashboard * * Client-side logic for templates/admin.html, which renders one of two * states depending on authentication: * - Login form: wires the token input + login button to POST /admin/login, * then reloads the page on success (the new session cookie makes the * next GET /admin render the dashboard instead). * - Dashboard: polls the cache-stats endpoint, renders the two cache * cards and the thread-pool card, and wires the refresh/clear/logout * buttons. * Kept as an external file - with clicks bound via addEventListener rather * than inline onclick="" - because the app's Content-Security-Policy * (`script-src 'self'`, set by app.py's after_request hook) blocks both * inline