add option to have public nsfw/nsfl
This commit is contained in:
@@ -126,6 +126,7 @@
|
|||||||
"open_registration_require_mail_andor_token": false,
|
"open_registration_require_mail_andor_token": false,
|
||||||
"private_society": false,
|
"private_society": false,
|
||||||
"private_society_gate": "cloudflare",
|
"private_society_gate": "cloudflare",
|
||||||
|
"public_nsfw": false,
|
||||||
"paths": {
|
"paths": {
|
||||||
"images": "/b",
|
"images": "/b",
|
||||||
"thumbnails": "/t",
|
"thumbnails": "/t",
|
||||||
|
|||||||
@@ -663,9 +663,14 @@ process.on('uncaughtException', err => {
|
|||||||
const queryMode = req.url.qs?.mode !== undefined ? +req.url.qs.mode : undefined;
|
const queryMode = req.url.qs?.mode !== undefined ? +req.url.qs.mode : undefined;
|
||||||
req.mode = queryMode !== undefined ? queryMode : (req.session ? +(req.session.mode ?? 0) : +(req.cookies?.mode ?? 0));
|
req.mode = queryMode !== undefined ? queryMode : (req.session ? +(req.session.mode ?? 0) : +(req.cookies?.mode ?? 0));
|
||||||
|
|
||||||
// Guest protection: Strictly enforce SFW mode (0) for non-logged-in users
|
// public_nsfw: when true, the *default* for guests is mode 3 (all content).
|
||||||
|
// Only applies when the guest has no explicit mode preference (no ?mode= param, no cookie).
|
||||||
|
// If the guest has chosen a filter (e.g. SFW), that choice is always respected.
|
||||||
if (!req.session) {
|
if (!req.session) {
|
||||||
req.mode = 0;
|
const hasExplicitMode = queryMode !== undefined || req.cookies?.mode !== undefined;
|
||||||
|
if (!hasExplicitMode) {
|
||||||
|
req.mode = cfg.websrv.public_nsfw ? 3 : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private Society gate — require login for all content when enabled
|
// Private Society gate — require login for all content when enabled
|
||||||
|
|||||||
@@ -416,7 +416,8 @@
|
|||||||
dm_attachments: @if(dm_attachments) true @else false @endif,
|
dm_attachments: @if(dm_attachments) true @else false @endif,
|
||||||
dm_unencrypted: @if(dm_unencrypted) true @else false @endif,
|
dm_unencrypted: @if(dm_unencrypted) true @else false @endif,
|
||||||
allow_comment_deletion: @if(allow_comment_deletion) true @else false @endif,
|
allow_comment_deletion: @if(allow_comment_deletion) true @else false @endif,
|
||||||
enable_comment_polls: @if(enable_comment_polls) true @else false @endif
|
enable_comment_polls: @if(enable_comment_polls) true @else false @endif,
|
||||||
|
mode: {{ mode !== undefined ? mode : 0 }}
|
||||||
};
|
};
|
||||||
window.f0ckDebug = window.f0ckSession.development ? console.log.bind(console) : () => {};
|
window.f0ckDebug = window.f0ckSession.development ? console.log.bind(console) : () => {};
|
||||||
window.f0ckI18n = {
|
window.f0ckI18n = {
|
||||||
|
|||||||
Reference in New Issue
Block a user