getting things ready for release
This commit is contained in:
@@ -13,10 +13,10 @@
|
||||
"mod": "mod",
|
||||
"settings": "Einstellungen",
|
||||
"logout": "Abmelden",
|
||||
"notifications": "Benachrichtigungen",
|
||||
"notifications": "Nuttis",
|
||||
"mark_all_read": "Alle als gelesen markieren",
|
||||
"no_notifications": "Keine neuen Benachrichtigungen",
|
||||
"view_all_notifications": "Alle anzeigen",
|
||||
"no_notifications": "Keine neuen Nuttis",
|
||||
"view_all_notifications": "Alle Nuttis anzeigen",
|
||||
"notif_tab_user": "Benutzer",
|
||||
"notif_tab_system": "System",
|
||||
"manage_subscriptions": "Abonnements verwalten",
|
||||
@@ -127,6 +127,8 @@
|
||||
"show_motd": "Nachricht des Tages (MOTD) anzeigen",
|
||||
"modern_layout": "Modernes Layout",
|
||||
"modern_layout_hint": "3-Spalten-Layout",
|
||||
"alternative_infobox": "Alternativer Autor-Infoblock",
|
||||
"alternative_infobox_hint": "Zeigt einen erweiterten Autor-Block mit Avatar und Bio auf Beitragsseiten",
|
||||
"disable_autoplay": "Automatische Wiedergabe deaktivieren",
|
||||
"disable_autoplay_hint": "Verhindert die automatische Wiedergabe von Videos und Audio",
|
||||
"disable_swiping": "Wischen deaktivieren",
|
||||
@@ -267,7 +269,7 @@
|
||||
},
|
||||
"comments": {
|
||||
"write_comment": "Kommentar schreiben...",
|
||||
"post": "Senden",
|
||||
"post": "Abschnalzen",
|
||||
"cancel": "Abbrechen"
|
||||
},
|
||||
"upload_btn": {
|
||||
@@ -416,7 +418,7 @@
|
||||
"loading": "Gespräche werden geladen…",
|
||||
"decrypting": "Nachrichten werden entschlüsselt…",
|
||||
"input_placeholder": "Nachricht schreiben…",
|
||||
"send": "Senden"
|
||||
"send": "Abschnalzen"
|
||||
},
|
||||
"profile": {
|
||||
"message_btn": "Nachricht",
|
||||
|
||||
@@ -127,6 +127,8 @@
|
||||
"show_motd": "Show Message of the Day (MOTD)",
|
||||
"modern_layout": "Modern layout",
|
||||
"modern_layout_hint": "3 Column Layout",
|
||||
"alternative_infobox": "Alternative Author Infobox",
|
||||
"alternative_infobox_hint": "Show a rich author card with avatar and bio on item pages",
|
||||
"disable_autoplay": "Disable Autoplay",
|
||||
"disable_autoplay_hint": "Prevent videos and audio from playing automatically",
|
||||
"disable_swiping": "Disable Swiping",
|
||||
|
||||
@@ -127,6 +127,8 @@
|
||||
"show_motd": "Toon Bericht van de Dag (MOTD)",
|
||||
"modern_layout": "Moderne layout",
|
||||
"modern_layout_hint": "Indeling met 3 kolommen",
|
||||
"alternative_infobox": "Alternatief auteur-informatievak",
|
||||
"alternative_infobox_hint": "Toont een uitgebreide auteurkaart met avatar en bio op itempagina's",
|
||||
"disable_autoplay": "Automatisch afspelen uitschakelen",
|
||||
"disable_autoplay_hint": "Voorkomen dat video's en audio automatisch worden afgespeeld",
|
||||
"disable_swiping": "Swipen uitschakelen",
|
||||
|
||||
@@ -127,6 +127,8 @@
|
||||
"show_motd": "Nachricht des Tages (NdT) anzeigen",
|
||||
"modern_layout": "Modernes Layout",
|
||||
"modern_layout_hint": "3-Spalten-Layout",
|
||||
"alternative_infobox": "Alternativer Autor-Infoblock",
|
||||
"alternative_infobox_hint": "Zeigt einen erweiterten Autor-Block mit Avatar und Bio auf Beitragsseiten",
|
||||
"disable_autoplay": "Automatische Wiedergabe deaktivieren",
|
||||
"disable_autoplay_hint": "Vermeiden Sie das automatische Abspielen von Videos und Tondateien",
|
||||
"disable_swiping": "Wischen deaktivieren",
|
||||
|
||||
@@ -593,6 +593,23 @@ export default router => {
|
||||
}
|
||||
});
|
||||
|
||||
// Update alternative infobox preference (per-user toggle for the rich author block)
|
||||
group.put(/\/alternative_infobox/, lib.loggedin, async (req, res) => {
|
||||
const use_alternative_infobox = req.post.use_alternative_infobox === true || req.post.use_alternative_infobox === 'true';
|
||||
try {
|
||||
await db`
|
||||
update user_options
|
||||
set use_alternative_infobox = ${use_alternative_infobox}
|
||||
where user_id = ${+req.session.id}
|
||||
`;
|
||||
if (req.session) req.session.use_alternative_infobox = use_alternative_infobox;
|
||||
return res.json({ success: true, use_alternative_infobox }, 200);
|
||||
} catch (e) {
|
||||
console.error('Update alternative_infobox error:', e);
|
||||
return res.json({ success: false, msg: 'Error updating preference' }, 500);
|
||||
}
|
||||
});
|
||||
|
||||
// Update per-user language preference
|
||||
group.put(/\/language/, lib.loggedin, async (req, res) => {
|
||||
if (cfg.websrv.allow_language_change === false) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import fs from "fs/promises";
|
||||
export default (router, tpl) => {
|
||||
// Main Halls Overview
|
||||
router.get(/^\/halls$/, async (req, res) => {
|
||||
if (cfg.websrv.halls_enabled === false) return res.reply({ code: 404, body: tpl.render('error', { message: 'Not found', tmp: null }, req) });
|
||||
const mode = req.mode ?? 0;
|
||||
const excludedTags = req.session ? (req.session.excluded_tags || []) : [];
|
||||
|
||||
|
||||
@@ -202,6 +202,11 @@ export default (router, tpl) => {
|
||||
const tRouteStart = Date.now();
|
||||
const mode = req.params.itemid ? 'item' : 'index';
|
||||
|
||||
// Feature flag guards for disabled features
|
||||
if (cfg.websrv.halls_enabled === false && req.params.hall) {
|
||||
return res.reply({ code: 404, body: tpl.render('error', { message: 'Not found', tmp: null }, req) });
|
||||
}
|
||||
|
||||
// Auto-persist strict mode from URL to session if it's there
|
||||
if (req.session && (req.query?.strict !== undefined || req.url.qs?.strict !== undefined)) {
|
||||
req.session.strict_mode = (req.query?.strict === '1' || req.url.qs?.strict === '1');
|
||||
@@ -341,6 +346,8 @@ export default (router, tpl) => {
|
||||
data.current_hall_slug = (data.tmp && data.tmp.hall && typeof data.tmp.hall === 'object') ? data.tmp.hall.slug : (data.tmp && data.tmp.hall ? data.tmp.hall : '');
|
||||
data.current_user_hall_slug = (data.tmp && data.tmp.userHall && typeof data.tmp.userHall === 'object') ? data.tmp.userHall.slug : (data.tmp && data.tmp.userHall ? data.tmp.userHall : '');
|
||||
data.current_user_hall_owner = (data.tmp && data.tmp.userHallOwner) ? data.tmp.userHallOwner : '';
|
||||
// Per-user alternative infobox preference overrides the site-wide config default
|
||||
if (session) data.user_alternative_infobox = !!session.use_alternative_infobox;
|
||||
}
|
||||
|
||||
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
||||
|
||||
@@ -5,6 +5,7 @@ import lib from "../lib.mjs";
|
||||
export default (router, tpl) => {
|
||||
// Serve the scroller page
|
||||
router.get(/^\/abyss\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.abyss_enabled === false) return res.reply({ code: 404, body: tpl.render('error', { message: 'Not found', tmp: null }, req) });
|
||||
if (cfg.websrv.private_society && !req.session) {
|
||||
return res.reply({ code: 502, body: '<html><body>502 Bad Gateway</body></html>' });
|
||||
}
|
||||
@@ -26,6 +27,7 @@ export default (router, tpl) => {
|
||||
// Lightweight meta refresh — returns live counts + tags for a batch of item IDs
|
||||
// GET /api/v2/scroller/meta?ids=1,2,3
|
||||
router.get(/^\/api\/v2\/scroller\/meta\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.abyss_enabled === false) return res.reply({ code: 404, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ success: false }) });
|
||||
if (cfg.websrv.private_society && !req.session) {
|
||||
return res.reply({ code: 502, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({}) });
|
||||
}
|
||||
@@ -66,6 +68,7 @@ export default (router, tpl) => {
|
||||
|
||||
// Tag autocomplete endpoint
|
||||
router.get(/^\/api\/v2\/scroller\/tags\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.abyss_enabled === false) return res.reply({ code: 404, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify([]) });
|
||||
if (cfg.websrv.private_society && !req.session) {
|
||||
return res.reply({ code: 502, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify([]) });
|
||||
}
|
||||
@@ -97,6 +100,11 @@ export default (router, tpl) => {
|
||||
|
||||
// JSON API: returns a batch of items for the scroller
|
||||
router.get(/^\/api\/v2\/scroller\/feed\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.abyss_enabled === false) return res.reply({
|
||||
code: 404,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ success: false, items: [] })
|
||||
});
|
||||
if (cfg.websrv.private_society && !req.session) {
|
||||
return res.reply({
|
||||
code: 502,
|
||||
|
||||
@@ -43,6 +43,7 @@ export default (router, tpl) => {
|
||||
|
||||
// List halls for a user
|
||||
router.get(/^\/user\/(?<owner>[^/]+)\/halls\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.userhalls_enabled === false) return res.reply({ code: 404, body: tpl.render('error', { message: 'Not found', tmp: null }, req) });
|
||||
const ownerName = decodeURIComponent(req.params.owner);
|
||||
const mode = req.mode ?? 0;
|
||||
const excludedTags = req.session ? (req.session.excluded_tags || []) : [];
|
||||
@@ -79,6 +80,7 @@ export default (router, tpl) => {
|
||||
|
||||
// Item grid for a user hall
|
||||
router.get(/^\/user\/(?<owner>[^/]+)\/hall\/(?<slug>[^/]+)(?:\/p\/(?<page>\d+))?\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.userhalls_enabled === false) return res.reply({ code: 404, body: tpl.render('error', { message: 'Not found', tmp: null }, req) });
|
||||
const ownerName = decodeURIComponent(req.params.owner);
|
||||
const slug = decodeURIComponent(req.params.slug);
|
||||
|
||||
@@ -124,6 +126,7 @@ export default (router, tpl) => {
|
||||
|
||||
// Single item within a user hall
|
||||
router.get(/^\/user\/(?<owner>[^/]+)\/hall\/(?<slug>[^/]+)\/(?<itemid>\d+)\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.userhalls_enabled === false) return res.reply({ code: 404, body: tpl.render('error', { message: 'Not found', tmp: null }, req) });
|
||||
const ownerName = decodeURIComponent(req.params.owner);
|
||||
const slug = decodeURIComponent(req.params.slug);
|
||||
|
||||
@@ -249,6 +252,7 @@ export default (router, tpl) => {
|
||||
|
||||
// ── API: list own halls (for modal) ────────────────────────────────────────
|
||||
router.get(/^\/api\/v2\/me\/halls\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.userhalls_enabled === false) return res.writeHead(404, { 'Content-Type': 'application/json' }).end(JSON.stringify({ success: false }));
|
||||
if (!requireLogin(req, res)) return;
|
||||
try {
|
||||
const halls = await f0cklib.getUserHalls(req.session.id, 3, [], req.session.id);
|
||||
@@ -261,6 +265,7 @@ export default (router, tpl) => {
|
||||
|
||||
// ── API: create hall ────────────────────────────────────────────────────────
|
||||
router.post(/^\/api\/v2\/me\/halls\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.userhalls_enabled === false) return res.writeHead(404, { 'Content-Type': 'application/json' }).end(JSON.stringify({ success: false }));
|
||||
if (!requireLogin(req, res)) return;
|
||||
const name = (req.post.name || '').trim();
|
||||
const slug = slugify(req.post.slug || name);
|
||||
@@ -279,6 +284,7 @@ export default (router, tpl) => {
|
||||
|
||||
// ── API: update hall ────────────────────────────────────────────────────────
|
||||
router.patch(/^\/api\/v2\/me\/halls\/(?<slug>[^/]+)\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.userhalls_enabled === false) return res.writeHead(404, { 'Content-Type': 'application/json' }).end(JSON.stringify({ success: false }));
|
||||
if (!requireLogin(req, res)) return;
|
||||
const slug = decodeURIComponent(req.params.slug);
|
||||
const { name, slug: newSlugRaw, description, is_private } = req.post;
|
||||
@@ -297,6 +303,7 @@ export default (router, tpl) => {
|
||||
|
||||
// ── API: delete hall ────────────────────────────────────────────────────────
|
||||
router.delete(/^\/api\/v2\/me\/halls\/(?<slug>[^/]+)\/?$/, async (req, res) => {
|
||||
if (cfg.websrv.userhalls_enabled === false) return res.writeHead(404, { 'Content-Type': 'application/json' }).end(JSON.stringify({ success: false }));
|
||||
if (!requireLogin(req, res)) return;
|
||||
const slug = decodeURIComponent(req.params.slug);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user