This commit is contained in:
2026-08-09 02:54:26 +02:00
parent 9ae1d55521
commit b9c7e24757
7 changed files with 18 additions and 6 deletions

View File

@@ -129,6 +129,7 @@
"user_alternative_infobox": false, "user_alternative_infobox": false,
"user_banner_enabled": true, "user_banner_enabled": true,
"user_alternative_steuerung": false, "user_alternative_steuerung": false,
"expose_repost_links_to_guests": false,
"enable_swf": false, "enable_swf": false,
"swf_thumb": "/s/img/swf.png", "swf_thumb": "/s/img/swf.png",
"enable_archive": true, "enable_archive": true,

View File

@@ -7,7 +7,11 @@ import queue from "../queue.mjs";
import fs from "fs"; import fs from "fs";
import url from "url"; import url from "url";
const getGlobalfilter = () => cfg.nsfp?.length ? cfg.nsfp.map(n => `tag_id = ${n}`).join(" or ") : null; const getGlobalfilter = () => {
if (!cfg.nsfp?.length) return null;
const filteredTags = cfg.websrv.public_nsfw ? cfg.nsfp.filter(id => id !== 2) : cfg.nsfp;
return filteredTags.length ? filteredTags.map(n => `tag_id = ${n}`).join(" or ") : null;
};
// All MIME types that map to the 'swf' extension in config (e.g. application/x-shockwave-flash, application/vnd.adobe.flash.movie) // All MIME types that map to the 'swf' extension in config (e.g. application/x-shockwave-flash, application/vnd.adobe.flash.movie)
const flashMimes = Object.entries(cfg.mimes || {}).filter(([, ext]) => ext === 'swf').map(([mime]) => mime); const flashMimes = Object.entries(cfg.mimes || {}).filter(([, ext]) => ext === 'swf').map(([mime]) => mime);

View File

@@ -13,7 +13,11 @@ import { purgeExpiredUploads } from '../../lib_delete.mjs';
import { calculateExpiresAt } from './upload.mjs'; import { calculateExpiresAt } from './upload.mjs';
const allowedMimes = ["audio", "image", "video", "%"]; const allowedMimes = ["audio", "image", "video", "%"];
const getGlobalfilter = () => cfg.nsfp?.length ? cfg.nsfp.map(n => `tag_id = ${n}`).join(' or ') : null; const getGlobalfilter = () => {
if (!cfg.nsfp?.length) return null;
const filteredTags = cfg.websrv.public_nsfw ? cfg.nsfp.filter(id => id !== 2) : cfg.nsfp;
return filteredTags.length ? filteredTags.map(n => `tag_id = ${n}`).join(' or ') : null;
};
const metaCache = new Map(); const metaCache = new Map();
const MAX_META_CACHE = 2000; const MAX_META_CACHE = 2000;

View File

@@ -156,7 +156,8 @@ export default (router, tpl) => {
} }
const globalfilter = cfg.nsfp.map(n => `tag_id = ${n}`).join(' or '); const globalfilterTags = cfg.websrv.public_nsfw ? (cfg.nsfp || []).filter(id => id !== 2) : (cfg.nsfp || []);
const globalfilter = globalfilterTags.length ? globalfilterTags.map(n => `tag_id = ${n}`).join(' or ') : null;
const excludedTags = req.session ? (req.session.excluded_tags || []) : []; const excludedTags = req.session ? (req.session.excluded_tags || []) : [];
/* <mode-override> */ /* <mode-override> */
// prioritize query mode (from AJAX) over session default // prioritize query mode (from AJAX) over session default
@@ -1001,7 +1002,8 @@ export default (router, tpl) => {
// Build mode SQL — replace items.id alias with i.id used in the activity query // Build mode SQL — replace items.id alias with i.id used in the activity query
const modequery = (multiRatingSQL ?? lib.getMode(mode)).replace(/items\.id/g, 'i.id'); const modequery = (multiRatingSQL ?? lib.getMode(mode)).replace(/items\.id/g, 'i.id');
const globalfilter = cfg.nsfp.map(n => `tag_id = ${n}`).join(' or '); const globalfilterTags = cfg.websrv.public_nsfw ? (cfg.nsfp || []).filter(id => id !== 2) : (cfg.nsfp || []);
const globalfilter = globalfilterTags.length ? globalfilterTags.map(n => `tag_id = ${n}`).join(' or ') : null;
const excludedTags = req.session ? (req.session.excluded_tags || []) : []; const excludedTags = req.session ? (req.session.excluded_tags || []) : [];
const comments = await db` const comments = await db`

View File

@@ -1428,6 +1428,7 @@ process.on('uncaughtException', err => {
scroller_mime_cats: Array.isArray(cfg.allowedMimes) ? cfg.allowedMimes.filter(c => ['video','image','audio'].includes(c)) : ['video','image','audio'], scroller_mime_cats: Array.isArray(cfg.allowedMimes) ? cfg.allowedMimes.filter(c => ['video','image','audio'].includes(c)) : ['video','image','audio'],
themes_json: JSON.stringify(cfg.websrv.themes || []), themes_json: JSON.stringify(cfg.websrv.themes || []),
enable_profile_description: !!cfg.websrv.enable_profile_description, enable_profile_description: !!cfg.websrv.enable_profile_description,
expose_repost_links_to_guests: !!(cfg.websrv.expose_repost_links_to_guests || cfg.websrv.expose_repost_links),
get private_messages() { return getPrivateMessages(); }, get private_messages() { return getPrivateMessages(); },
get dm_attachments() { return getDmAttachments(); }, get dm_attachments() { return getDmAttachments(); },
get dm_unencrypted() { return getDmUnencrypted(); }, get dm_unencrypted() { return getDmUnencrypted(); },

View File

@@ -329,7 +329,7 @@
<td><pre class="info-hash-codeblock"><code style="word-break: break-all;">{{ item.checksum.split('_bypass_')[0] }}</code></pre></td> <td><pre class="info-hash-codeblock"><code style="word-break: break-all;">{{ item.checksum.split('_bypass_')[0] }}</code></pre></td>
</tr> </tr>
@endif @endif
@if(item.is_repost || (item.reposts && item.reposts.length > 0)) @if((session || expose_repost_links_to_guests) && (item.is_repost || (item.reposts && item.reposts.length > 0)))
<tr class="info-repost-row"> <tr class="info-repost-row">
<th>Repost</th> <th>Repost</th>
<td> <td>

View File

@@ -274,7 +274,7 @@
<td><pre class="info-hash-codeblock"><code style="word-break: break-all;">{{ item.checksum.split('_bypass_')[0] }}</code></pre></td> <td><pre class="info-hash-codeblock"><code style="word-break: break-all;">{{ item.checksum.split('_bypass_')[0] }}</code></pre></td>
</tr> </tr>
@endif @endif
@if(item.is_repost || (item.reposts && item.reposts.length > 0)) @if((session || expose_repost_links_to_guests) && (item.is_repost || (item.reposts && item.reposts.length > 0)))
<tr class="info-repost-row"> <tr class="info-repost-row">
<th>Repost</th> <th>Repost</th>
<td> <td>