fix: filter out expired errors, show error type (in or out) in template

This commit is contained in:
Julian Lam
2026-04-15 10:14:15 -04:00
parent 23376ec5ee
commit e22d2e4169
2 changed files with 7 additions and 2 deletions

View File

@@ -90,6 +90,9 @@ federationController.errors = async function (req, res) {
let errors = await db.getSortedSetRevRangeByScoreWithScores('ap.errors', 0, -1, Date.now(), '-inf');
const errorObj = await db.getObjects(errors.map(({ value: id }) => `ap.errors:${id}`));
errors = errors.map(({ value: id, score: timestamp }, idx) => {
if (!errorObj[idx]) {
return null;
}
let { body, stack } = errorObj[idx];
let hostname = 'Invalid hostname';
const timestampISO = new Date(timestamp).toISOString();
@@ -101,7 +104,7 @@ federationController.errors = async function (req, res) {
}
return { id, body, stack, hostname, timestamp, timestampISO };
});
}).filter(Boolean);
res.render('admin/federation/errors', {
title: '[[admin/menu:federation/errors]]',

View File

@@ -11,7 +11,9 @@
{{{ each errors }}}
<details class="mb-3" data-index="{@index}">
<summary>
<span title="{./timestampISO}" class="timeago text-secondary text-sm"></span><br/ >
<span title="{./timestampISO}" class="timeago text-secondary text-sm"></span>
<span class="badge text-bg-primary">{{{ if (type == "in") }}}IN{{{ else }}}OUT{{{ end }}}</span>
<br/ >
<code>{./id}</code>
</summary>