</div>
</div>
</div>
+ <div class="row">
+ <div id="stats" class="col text-right" hx-get="/server-stats" hx-trigger="load delay:1s, every 60s">
+ </div>
+ </div>
<footer>
A project by <a href="https://xangelo.ca">xangelo</a>
</footer>
return;
});
+server.get<void, string>('/server-stats', async req => {
+ const date = new Date();
+ return `
+ <div class="text-right">
+ <span class="success-text">${(await server.ws.allSockets()).size} Online</span><br>
+ <span>
+ Server Time: ${date.getHours()}:${date.getMinutes()}
+ </span>
+ </div>`;
+});
+
server.ws.on('connection', async socket => {
const auth = server.authFromUrl(socket.request.headers['referer']);
const acct = await accountRepo.validate(auth.authInfo.accountId, auth.authInfo.token);