+ if (!await doesUnblockAccountExist(serverActor.Account.id, targetAccount.id, res)) return
+
+ return next()
+ }
+]
+
+const blockServerValidator = [
+ body('host').custom(isHostValid).withMessage('Should have a valid host'),
+
+ async (req: express.Request, res: express.Response, next: express.NextFunction) => {
+ logger.debug('Checking serverGetValidator parameters', { parameters: req.body })
+
+ if (areValidationErrors(req, res)) return
+
+ const host: string = req.body.host
+
+ if (host === WEBSERVER.HOST) {
+ return res.status(409)
+ .send({ error: 'You cannot block your own server.' })
+ .end()
+ }
+
+ const server = await ServerModel.loadByHost(host)
+ if (!server) {
+ return res.status(404)
+ .send({ error: 'Server host not found.' })
+ .end()
+ }
+
+ res.locals.server = server