feat(journal): preview last attachments and photos in report card
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ function fileCardHTML(f) {
|
|||||||
${thumb}
|
${thumb}
|
||||||
<div class="ph-body">
|
<div class="ph-body">
|
||||||
<span class="ph-badge">📎 Файл</span>
|
<span class="ph-badge">📎 Файл</span>
|
||||||
<div class="ph-title">${isImageFile(f.name) ? esc(f.name) : `<a href="${url}" download class="ph-link">${esc(f.name)}</a>`}</div>
|
<div class="ph-title"><a href="${isImageFile(f.name) ? `${url}?download=1` : url}" download class="ph-link">${esc(f.name)}</a></div>
|
||||||
${meta}
|
${meta}
|
||||||
${time}
|
${time}
|
||||||
${action}
|
${action}
|
||||||
|
|||||||
@@ -9267,6 +9267,12 @@ app.get('/api/files/:token', fileLimiter, async (req, res) => {
|
|||||||
if (!key) return res.status(404).json({ error: 'File missing' });
|
if (!key) return res.status(404).json({ error: 'File missing' });
|
||||||
if (isImageName(r.name)) {
|
if (isImageName(r.name)) {
|
||||||
if (req.query.thumb) return sendImageThumb(res, key);
|
if (req.query.thumb) return sendImageThumb(res, key);
|
||||||
|
if (req.query.download) {
|
||||||
|
if (!(await storage.streamTo(res, key, { download: true, name: r.name })) && !res.headersSent) {
|
||||||
|
return res.status(404).json({ error: 'File missing' });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
const ok = await storage.streamTo(res, key, { cacheControl: 'public, max-age=31536000, immutable' });
|
const ok = await storage.streamTo(res, key, { cacheControl: 'public, max-age=31536000, immutable' });
|
||||||
if (!ok && !res.headersSent) return res.status(404).json({ error: 'File missing' });
|
if (!ok && !res.headersSent) return res.status(404).json({ error: 'File missing' });
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user