diff --git a/public/s/js/messages.js b/public/s/js/messages.js index c992c9c..95e417b 100644 --- a/public/s/js/messages.js +++ b/public/s/js/messages.js @@ -815,6 +815,7 @@ if (window.__dmLoaded) { // [attachment:ID:FILENAME_B64:MIME:SIZE] // where FILENAME_B64 is btoa(filename) to avoid colon conflicts. + const DM_ATT_MAX_BYTES = 50 * 1024 * 1024; // 50 MB async function encryptAttachment(sharedKey, fileBuffer) { @@ -955,7 +956,6 @@ if (window.__dmLoaded) { el.src = url; el.className = 'dm-attachment-preview__img'; el.alt = att.filename; - el.addEventListener('click', () => window.open(url, '_blank')); } else if (isVideo) { el = document.createElement('video'); el.src = url; @@ -1060,8 +1060,7 @@ if (window.__dmLoaded) { el.className = 'dm-attachment-preview__img'; el.alt = att.filename; // Click image to open full-size in new tab - el.addEventListener('click', () => window.open(url, '_blank')); - } else if (isVideo) { + } else if (isVideo) { el = document.createElement('video'); el.src = url; el.controls = true; diff --git a/src/index.mjs b/src/index.mjs index d837b83..bc6a5a6 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -347,14 +347,15 @@ process.on('uncaughtException', err => { // Ensure storage directories exist const initDirs = [ - cfg.paths.a, cfg.paths.b, cfg.paths.c, cfg.paths.t, cfg.paths.ca, cfg.paths.e, cfg.paths.emojis, cfg.paths.memes, cfg.paths.tmp, cfg.paths.logs, + cfg.paths.a, cfg.paths.b, cfg.paths.c, cfg.paths.t, cfg.paths.ca, cfg.paths.emojis, cfg.paths.memes, cfg.paths.tmp, cfg.paths.logs, path.join(cfg.paths.pending, 'b'), path.join(cfg.paths.pending, 't'), path.join(cfg.paths.pending, 'ca'), path.join(cfg.paths.deleted, 'b'), path.join(cfg.paths.deleted, 't'), path.join(cfg.paths.deleted, 'ca') ]; for (const dir of initDirs) { - if (!fs.existsSync(dir)) { - console.log(`[BOOT] Creating directory: ${dir}`); + try { fs.mkdirSync(dir, { recursive: true }); + } catch (e) { + if (e.code !== 'EEXIST') console.warn(`[BOOT] Could not create directory ${dir}: ${e.message}`); } }