From 367ca308d66bf2ae22d6f395639dafb09530f42a Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Mon, 7 Nov 2022 21:14:30 -0600 Subject: [PATCH] add guppe server status to web views and explain active groups --- index.js | 13 +++++++++++- web/src/App.vue | 46 +++++++++++++++++++++++++++++++++++++++++- web/src/views/Home.vue | 1 + 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e396fda..5eb404a 100644 --- a/index.js +++ b/index.js @@ -49,7 +49,8 @@ const apex = ActivitypubExpress({ actorParam: 'actor', objectParam: 'id', itemsPerPage: 100, - offlineMode: true, // delivery done in workers only + // delivery done in workers only in production + offlineMode: process.env.NODE_ENV === 'production', routes }) @@ -174,6 +175,16 @@ app.get('/groups', (req, res, next) => { return res.status(500).send() }) }) +app.get('/stats', async (req, res, next) => { + try { + const queueSize = await apex.store.db.collection('deliveryQueue') + .countDocuments({ attempt: 0 }) + const uptime = process.uptime() + res.json({ queueSize, uptime }) + } catch (err) { + next(err) + } +}) app.use(function (err, req, res, next) { console.error(err.message, req.body, err.stack) diff --git a/web/src/App.vue b/web/src/App.vue index cf5f527..9b643c1 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -1,8 +1,12 @@ + + diff --git a/web/src/views/Home.vue b/web/src/views/Home.vue index 557505c..016468b 100644 --- a/web/src/views/Home.vue +++ b/web/src/views/Home.vue @@ -22,6 +22,7 @@
  • Visit a @{{ domain }} group profile to see the group history
  • Active Groups

    +

    Top 50 groups with the most recent posts