From 313cbeddc4755d627b35a845476e23d67ae5b86a Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Mon, 18 May 2026 16:49:31 +0200 Subject: [PATCH] fix attachment button and logic --- public/s/js/messages.js | 2 +- src/dm_attachment_handler.mjs | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/public/s/js/messages.js b/public/s/js/messages.js index 95e417b..08a32f5 100644 --- a/public/s/js/messages.js +++ b/public/s/js/messages.js @@ -1186,7 +1186,7 @@ if (window.__dmLoaded) { actions.prepend(spoilerBtn); // ── Attachment button ───────────────────────────────────────────────── - if (window.f0ckSession?.dm_attachments !== false) { + if (window.f0ckSession?.dm_attachments === true) { const attachInput = document.createElement('input'); attachInput.type = 'file'; attachInput.id = 'dm-attach-input'; diff --git a/src/dm_attachment_handler.mjs b/src/dm_attachment_handler.mjs index 8f09172..80e37dd 100644 --- a/src/dm_attachment_handler.mjs +++ b/src/dm_attachment_handler.mjs @@ -194,8 +194,6 @@ export async function handleDmAttachmentUpload(req, res, recipientId) { // ─── Download handler ───────────────────────────────────────────────────────── export async function handleDmAttachmentDownload(req, res, attachmentId) { - if (!getDmAttachments()) return sendJson(res, { success: false, msg: 'Not found' }, 404); - const session = await resolveSession(req); if (!session) return sendJson(res, { success: false, msg: 'Unauthorized' }, 401); @@ -236,8 +234,6 @@ export async function handleDmAttachmentDownload(req, res, attachmentId) { // ─── Delete handler ─────────────────────────────────────────────────────────── export async function handleDmAttachmentDelete(req, res, attachmentId) { - if (!getDmAttachments()) return sendJson(res, { success: false, msg: 'Not found' }, 404); - const session = await resolveSession(req); if (!session) return sendJson(res, { success: false, msg: 'Unauthorized' }, 401); if (!validateCsrf(req, session)) return sendJson(res, { success: false, msg: 'CSRF mismatch' }, 403);