v0.5.10: /export — attachment default, ?view=1 inline, ?filename=custom

This commit is contained in:
2026-06-02 14:49:50 +03:00
parent 72e021acfe
commit 51a003e078
4 changed files with 26 additions and 8 deletions
+3 -1
View File
@@ -95,7 +95,9 @@ function createEntriesRouter({ q }) {
const cidrs = await q.getExportCIDRs(companyId);
const aggregated = aggregateCIDRs(cidrs);
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
res.setHeader('Content-Disposition', 'inline; filename="whitelist.txt"');
const fname = req.query.filename || 'white-list.txt';
const disp = req.query.view === '1' ? 'inline' : 'attachment';
res.setHeader('Content-Disposition', `${disp}; filename="${fname}"`);
res.send(aggregated.join('\n') + (aggregated.length ? '\n' : ''));
} catch (e) {
res.status(500).json({ error: e.message });