fix attachment button and logic
This commit is contained in:
@@ -1186,7 +1186,7 @@ if (window.__dmLoaded) {
|
|||||||
actions.prepend(spoilerBtn);
|
actions.prepend(spoilerBtn);
|
||||||
|
|
||||||
// ── Attachment button ─────────────────────────────────────────────────
|
// ── Attachment button ─────────────────────────────────────────────────
|
||||||
if (window.f0ckSession?.dm_attachments !== false) {
|
if (window.f0ckSession?.dm_attachments === true) {
|
||||||
const attachInput = document.createElement('input');
|
const attachInput = document.createElement('input');
|
||||||
attachInput.type = 'file';
|
attachInput.type = 'file';
|
||||||
attachInput.id = 'dm-attach-input';
|
attachInput.id = 'dm-attach-input';
|
||||||
|
|||||||
@@ -194,8 +194,6 @@ export async function handleDmAttachmentUpload(req, res, recipientId) {
|
|||||||
// ─── Download handler ─────────────────────────────────────────────────────────
|
// ─── Download handler ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export async function handleDmAttachmentDownload(req, res, attachmentId) {
|
export async function handleDmAttachmentDownload(req, res, attachmentId) {
|
||||||
if (!getDmAttachments()) return sendJson(res, { success: false, msg: 'Not found' }, 404);
|
|
||||||
|
|
||||||
const session = await resolveSession(req);
|
const session = await resolveSession(req);
|
||||||
if (!session) return sendJson(res, { success: false, msg: 'Unauthorized' }, 401);
|
if (!session) return sendJson(res, { success: false, msg: 'Unauthorized' }, 401);
|
||||||
|
|
||||||
@@ -236,8 +234,6 @@ export async function handleDmAttachmentDownload(req, res, attachmentId) {
|
|||||||
// ─── Delete handler ───────────────────────────────────────────────────────────
|
// ─── Delete handler ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
export async function handleDmAttachmentDelete(req, res, attachmentId) {
|
export async function handleDmAttachmentDelete(req, res, attachmentId) {
|
||||||
if (!getDmAttachments()) return sendJson(res, { success: false, msg: 'Not found' }, 404);
|
|
||||||
|
|
||||||
const session = await resolveSession(req);
|
const session = await resolveSession(req);
|
||||||
if (!session) return sendJson(res, { success: false, msg: 'Unauthorized' }, 401);
|
if (!session) return sendJson(res, { success: false, msg: 'Unauthorized' }, 401);
|
||||||
if (!validateCsrf(req, session)) return sendJson(res, { success: false, msg: 'CSRF mismatch' }, 403);
|
if (!validateCsrf(req, session)) return sendJson(res, { success: false, msg: 'CSRF mismatch' }, 403);
|
||||||
|
|||||||
Reference in New Issue
Block a user