feat: store encountered instances by last seen date

This commit is contained in:
Julian Lam
2024-06-17 15:08:22 -04:00
parent 4b8a9e58ae
commit d0a1ebcff7

View File

@@ -68,6 +68,10 @@ middleware.validate = async function (req, res, next) {
req.body.actor = actor;
}
// Domain check
const { hostname } = new URL(actor);
await db.sortedSetAdd('instances:lastSeen', Date.now(), hostname);
// Origin checking
if (typeof object !== 'string' && object.hasOwnProperty('id')) {
const actorHostnames = Array.isArray(actor) ? actor.map(a => new URL(a).hostname) : [new URL(actor).hostname];