gdfgd
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user