💾 Archived View for iich.space › src › app › admin › bans.ts captured on 2021-12-03 at 14:04:38.
-=-=-=-=-=-=-
import { Handler, Router } from '@/mission-control'; import { getBans, removeBan } from '~/db/admin/queries'; import withQuery from '~/middleware/withQuery'; import AdminBansPage from '~/views/admin/AdminBansPage'; const router = new Router<Handler>(); router.use('/', (req, res, { tb }) => { const bans = getBans(); res.send(tb.include(AdminBansPage, { bans })); res.end(); }); router.use('/:origin', withQuery('confirm'), (req, res, { params }) => { if (req.query! === 'confirm') { const origin = decodeURIComponent(params.origin!); removeBan(origin); } res.redirect(`/admin/bans`); }); export default router;