💾 Archived View for iich.space › src › app › admin › bans.ts captured on 2022-03-01 at 16:02:53.
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
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;