2 Commits
Author SHA1 Message Date
MichelleandClaude Fable 5 6a312ba055 chore: update version to 2.5.0
Build & Push Docker Image / build (release) Successful in 3m56s
Build & Push Docker Image / build (push) Successful in 3m57s
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 09:47:30 +02:00
MichelleandClaude Fable 5 8c65e4acd2 refactor: replace exceljs with write-excel-file for analytics export
Build & Push Docker Image / build (push) Successful in 3m57s
exceljs (latest 4.4.0) ships years-old transitive dependencies that
npm flags as deprecated on every install (rimraf 2, glob 7, inflight,
fstream, lodash.isequal) and needed a uuid override for a security
advisory. It was only used for the single-sheet analytics XLSX export,
which write-excel-file covers with the same output (column widths,
bold/grey header, formula-injection escaping).

Removes the now-unneeded exceljs uuid override.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 09:40:53 +02:00
4 changed files with 41 additions and 818 deletions
+22 -792
View File
File diff suppressed because it is too large Load Diff
+2 -7
View File
@@ -1,7 +1,7 @@
{
"name": "redlight",
"private": true,
"version": "2.4.1",
"version": "2.5.0",
"license": "GPL-3.0-or-later",
"type": "module",
"scripts": {
@@ -19,7 +19,6 @@
"concurrently": "^9.0.0",
"cors": "^2.8.5",
"dotenv": "^17.3.1",
"exceljs": "^4.4.0",
"express": "^5.2.1",
"express-rate-limit": "^8.5.2",
"flatpickr": "^4.6.13",
@@ -38,6 +37,7 @@
"react-hot-toast": "^2.4.0",
"react-router-dom": "^7.15.1",
"uuid": "^14.0.0",
"write-excel-file": "^4.1.1",
"xml2js": "^0.6.0"
},
"devDependencies": {
@@ -49,11 +49,6 @@
"tailwindcss": "^4.3.0",
"vite": "^8.0.0"
},
"overrides": {
"exceljs": {
"uuid": "^11.1.1"
}
},
"allowScripts": {
"better-sqlite3@12.11.1": true
}
+16 -18
View File
@@ -1,6 +1,6 @@
import { Router, json } from 'express';
import crypto from 'crypto';
import ExcelJS from 'exceljs';
import writeXlsxFile from 'write-excel-file/node';
import PDFDocument from 'pdfkit';
import { getDb } from '../config/database.js';
import { authenticateToken } from '../middleware/auth.js';
@@ -246,26 +246,24 @@ router.get('/:id/export/:format', authenticateToken, async (req, res) => {
if (format === 'xlsx') {
// Prefix-escape strings that would otherwise be evaluated as formulas.
const sanitizeXlsx = (r) => {
const out = {};
for (const k of Object.keys(r)) {
const v = r[k];
out[k] = (typeof v === 'string' && /^[=+\-@\t\r]/.test(v)) ? "'" + v : v;
}
return out;
};
const workbook = new ExcelJS.Workbook();
const sheet = workbook.addWorksheet('Analytics');
sheet.columns = COLUMNS;
rows.forEach(r => sheet.addRow(sanitizeXlsx(r)));
// Style header row
sheet.getRow(1).font = { bold: true };
sheet.getRow(1).fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFE0E0E0' } };
const sanitizeXlsx = (v) =>
(typeof v === 'string' && /^[=+\-@\t\r]/.test(v)) ? "'" + v : v;
const headerRow = COLUMNS.map(c => ({
value: c.header,
fontWeight: 'bold',
backgroundColor: '#e0e0e0',
}));
const dataRows = rows.map(r => COLUMNS.map(c => ({ value: sanitizeXlsx(r[c.key]) })));
const buffer = await writeXlsxFile([headerRow, ...dataRows], {
columns: COLUMNS.map(c => ({ width: c.width })),
sheet: 'Analytics',
}).toBuffer();
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
res.setHeader('Content-Disposition', `attachment; filename="${safeName}.xlsx"`);
await workbook.xlsx.write(res);
return res.end();
return res.send(buffer);
}
if (format === 'pdf') {
+1 -1
View File
@@ -41,7 +41,7 @@ export function wellKnownHandler(req, res) {
federation_api: '/api/federation',
public_key: getPublicKey(),
software: 'Redlight',
version: '2.4.1',
version: '2.5.0',
});
}