fix: #10993, apply autoLocale middleware to guests only

isekai-main
Barış Soner Uşaklı 2 years ago
parent 9227b82e2c
commit 6f673f806f

@ -86,15 +86,16 @@ module.exports = function (middleware) {
}
return next();
}
if (parseInt(req.uid, 10) > 0 || !meta.config.autoDetectLang) {
return next();
}
const langs = await listCodes();
const lang = req.acceptsLanguages(langs);
if (!lang) {
return next();
if (meta.config.autoDetectLang && req.uid === 0) {
const langs = await listCodes();
const lang = req.acceptsLanguages(langs);
if (!lang) {
return next();
}
req.query.lang = lang;
}
req.query.lang = lang;
next();
});

Loading…
Cancel
Save