]> git.cworth.org Git - lmno-server/blobdiff - lmno.js
/admin: Switch to rendering via a template
[lmno-server] / lmno.js
diff --git a/lmno.js b/lmno.js
index 74687361a59fe485a9c42e44c470aea7510fb190..86306516878b1f68fd6d980ad9ea4e912692d053 100644 (file)
--- a/lmno.js
+++ b/lmno.js
@@ -213,17 +213,16 @@ app.post('/login', async (request, response) => {
 
 /* An admin page (only available to admin users, of course) */
 app.get('/admin/', auth_admin, (request, response) => {
-  let active = 0;
-  let idle = 0;
+  let active = [];
+  let idle = [];
 
   for (let id in lmno.ids) {
     if (lmno.ids[id].game.clients.length)
-      active++;
-   else
-      idle++;
+      active.push(lmno.ids[id]);
+    else
+      idle.push(lmno.ids[id]);
   }
-  response.send(`<html><body>Active games: ${active}.<br>
-Idle games: ${idle}</body></html>`);
+  response.render('admin.html', { test: "foobar", games: { active: active, idle: idle}});
 });