This commit is contained in:
2026-09-13 06:12:37 +02:00
parent 33c6d0e76d
commit 466d3c4f28
20 changed files with 2156 additions and 134 deletions
+13 -1
View File
@@ -645,7 +645,19 @@ export default (router, tpl) => {
const modeMatch = req.url.pathname.match(/^\/mode\/(\d)/);
const mode = modeMatch ? +modeMatch[1] : 0;
if (isAnonSession(req.session)) {
const isGuest = !req.session || !req.session.user;
if (isGuest) {
if (mode !== 0) {
if (req.headers['x-requested-with'] === 'XMLHttpRequest') {
return res.reply({
code: 403,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ success: false, msg: 'Only SFW mode is allowed for guests' })
});
}
return res.redirect('/');
}
} else if (isAnonSession(req.session)) {
if (!canAnonDo('filter') || !canAnonMode(mode)) {
if (req.headers['x-requested-with'] === 'XMLHttpRequest') {
return res.reply({