feat: implement database migrations for word filter, DM attachments, message editing, and user invite tracking, plus add API documentation and dev scripts.

This commit is contained in:
2026-05-26 14:02:28 +02:00
parent cb3bd4358c
commit 3f92e62820
4 changed files with 18 additions and 2 deletions

View File

@@ -102,8 +102,14 @@ export default new class {
// Build suffix with query params // Build suffix with query params
let suffix = env.strict ? '?strict=1' : ''; let suffix = env.strict ? '?strict=1' : '';
// mainDisplay: decoded for human-readable display (e.g. div.location)
// main: keeps percent-encoding for use in href attributes
let mainDisplay = tmp;
try { mainDisplay = decodeURIComponent(tmp); } catch (_) {}
return { return {
main: tmp, main: tmp,
mainDisplay,
path: env.path ? env.path : '', path: env.path ? env.path : '',
suffix: suffix suffix: suffix
}; };

View File

@@ -306,6 +306,7 @@ export default {
// Override link for title searches — pagination must use the /tag/title:... prefix // Override link for title searches — pagination must use the /tag/title:... prefix
if (isTitleSearch && titleQuery) { if (isTitleSearch && titleQuery) {
link.main = `/tag/title:${encodeURIComponent(titleQuery)}/`; link.main = `/tag/title:${encodeURIComponent(titleQuery)}/`;
link.mainDisplay = `/tag/title:${titleQuery}/`;
link.path = 'p/'; link.path = 'p/';
link.suffix = ''; link.suffix = '';
} }
@@ -314,6 +315,7 @@ export default {
if (userHallObj && userHallOwner) { if (userHallObj && userHallOwner) {
const ownerName = userHallObj.owner_name || userHallOwner; const ownerName = userHallObj.owner_name || userHallOwner;
link.main = `/user/${encodeURIComponent(ownerName)}/hall/${encodeURIComponent(userHallObj.slug)}/`; link.main = `/user/${encodeURIComponent(ownerName)}/hall/${encodeURIComponent(userHallObj.slug)}/`;
link.mainDisplay = `/user/${ownerName}/hall/${userHallObj.slug}/`;
link.path = 'p/'; link.path = 'p/';
link.suffix = ''; link.suffix = '';
} }
@@ -590,10 +592,18 @@ export default {
? await db`select uh.name, uh.slug from user_halls uh join user_halls_assign uha on uha.hall_id = uh.id where uha.item_id = ${itemid} and uh.user_id = ${user_id}` ? await db`select uh.name, uh.slug from user_halls uh join user_halls_assign uha on uha.hall_id = uh.id where uha.item_id = ${itemid} and uh.user_id = ${user_id}`
: []; : [];
const link = lib.genLink({ user, tag, hall: (hall && typeof hall === 'object') ? hall.slug : hall, mime, type: fav ? 'favs' : 'uploads', path: '', strict: false }); const link = lib.genLink({ user, tag, hall: (hall && typeof hall === 'object') ? hall.slug : hall, mime, type: fav ? 'favs' : 'uploads', path: '', strict: false });
// Override link for title searches — pagination must use the /tag/title:... prefix
if (isTitleSearch && titleQuery) {
link.main = `/tag/title:${encodeURIComponent(titleQuery)}/`;
link.mainDisplay = `/tag/title:${titleQuery}/`;
link.path = '';
link.suffix = '';
}
// Override link for user hall context // Override link for user hall context
if (userHallObj && userHallOwner) { if (userHallObj && userHallOwner) {
const ownerName = userHallObj.owner_name || userHallOwner; const ownerName = userHallObj.owner_name || userHallOwner;
link.main = `/user/${encodeURIComponent(ownerName)}/hall/${encodeURIComponent(userHallObj.slug)}/`; link.main = `/user/${encodeURIComponent(ownerName)}/hall/${encodeURIComponent(userHallObj.slug)}/`;
link.mainDisplay = `/user/${ownerName}/hall/${userHallObj.slug}/`;
link.path = ''; link.path = '';
link.suffix = ''; link.suffix = '';
} }

View File

@@ -6,7 +6,7 @@
<div class="item-main-content"> <div class="item-main-content">
<div class="_204863"> <div class="_204863">
<div class="location">{{ link.main }}{{ item.id }}{{ link.suffix }}</div> <div class="location">{{ link.mainDisplay || link.main }}{{ item.id }}{{ link.suffix }}</div>
<div class="gapLeft"></div> <div class="gapLeft"></div>
</div> </div>
@if(enable_item_title) @if(enable_item_title)

View File

@@ -57,7 +57,7 @@
<div class="item-main-content"> <div class="item-main-content">
<div class="_204863"> <div class="_204863">
<div class="location">{{ link.main }}{{ item.id }}{{ link.suffix }}</div> <div class="location">{{ link.mainDisplay || link.main }}{{ item.id }}{{ link.suffix }}</div>
<div class="gapLeft"></div> <div class="gapLeft"></div>
</div> </div>
@if(enable_item_title) @if(enable_item_title)