This commit is contained in:
x 2025-03-19 20:19:53 +01:00
parent 69ca852379
commit 9da30ac7d2
3 changed files with 12 additions and 11 deletions

View File

@ -221,14 +221,14 @@ export default new class {
return next();
};
// async loggedin(req, res, next) {
// if(!req.session) {
// return res.reply({
// code: 401,
// body: "401 - Unauthorized"
// });
// }
// return next();
// };
async loggedin(req, res, next) {
if(!req.session) {
return res.reply({
code: 401,
body: "401 - Unauthorized"
});
}
return next();
};
};

View File

@ -3,7 +3,7 @@ import lib from "../lib.mjs";
import f0cklib from "../routeinc/f0cklib.mjs";
export default (router, tpl) => {
router.get(/^\/random$/, lib.loggedin, async (req, res) => {
router.get(/^\/random$/, async (req, res) => {
let referer = req.headers.referer ?? '';
let opts = {};

View File

@ -1,9 +1,10 @@
import db from "../../inc/sql.mjs";
import cfg from "../../inc/config.mjs";
import lib from "../../inc/lib.mjs";
import f0cklib from "../routeinc/f0cklib.mjs";
export default (router, tpl) => {
router.get(/^\/tags$/, async (req, res) => {
router.get(/^\/tags$/,lib.loggedin, async (req, res) => {
const phrase = cfg.websrv.phrases[~~(Math.random() * cfg.websrv.phrases.length)];