possible fix for boot crash and image expansion
This commit is contained in:
@@ -815,6 +815,7 @@ if (window.__dmLoaded) {
|
|||||||
// [attachment:ID:FILENAME_B64:MIME:SIZE]
|
// [attachment:ID:FILENAME_B64:MIME:SIZE]
|
||||||
// where FILENAME_B64 is btoa(filename) to avoid colon conflicts.
|
// where FILENAME_B64 is btoa(filename) to avoid colon conflicts.
|
||||||
|
|
||||||
|
|
||||||
const DM_ATT_MAX_BYTES = 50 * 1024 * 1024; // 50 MB
|
const DM_ATT_MAX_BYTES = 50 * 1024 * 1024; // 50 MB
|
||||||
|
|
||||||
async function encryptAttachment(sharedKey, fileBuffer) {
|
async function encryptAttachment(sharedKey, fileBuffer) {
|
||||||
@@ -955,7 +956,6 @@ if (window.__dmLoaded) {
|
|||||||
el.src = url;
|
el.src = url;
|
||||||
el.className = 'dm-attachment-preview__img';
|
el.className = 'dm-attachment-preview__img';
|
||||||
el.alt = att.filename;
|
el.alt = att.filename;
|
||||||
el.addEventListener('click', () => window.open(url, '_blank'));
|
|
||||||
} else if (isVideo) {
|
} else if (isVideo) {
|
||||||
el = document.createElement('video');
|
el = document.createElement('video');
|
||||||
el.src = url;
|
el.src = url;
|
||||||
@@ -1060,7 +1060,6 @@ if (window.__dmLoaded) {
|
|||||||
el.className = 'dm-attachment-preview__img';
|
el.className = 'dm-attachment-preview__img';
|
||||||
el.alt = att.filename;
|
el.alt = att.filename;
|
||||||
// Click image to open full-size in new tab
|
// 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 = document.createElement('video');
|
||||||
el.src = url;
|
el.src = url;
|
||||||
|
|||||||
@@ -347,14 +347,15 @@ process.on('uncaughtException', err => {
|
|||||||
|
|
||||||
// Ensure storage directories exist
|
// Ensure storage directories exist
|
||||||
const initDirs = [
|
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.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')
|
path.join(cfg.paths.deleted, 'b'), path.join(cfg.paths.deleted, 't'), path.join(cfg.paths.deleted, 'ca')
|
||||||
];
|
];
|
||||||
for (const dir of initDirs) {
|
for (const dir of initDirs) {
|
||||||
if (!fs.existsSync(dir)) {
|
try {
|
||||||
console.log(`[BOOT] Creating directory: ${dir}`);
|
|
||||||
fs.mkdirSync(dir, { recursive: true });
|
fs.mkdirSync(dir, { recursive: true });
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code !== 'EEXIST') console.warn(`[BOOT] Could not create directory ${dir}: ${e.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user