feat: Server-Konsolen-Mitschnitt (24h, wie docker logs) als Download im Logs-Bereich

This commit is contained in:
2026-07-18 17:04:13 +02:00
parent 6209c38a83
commit 8419a02e00
4 changed files with 91 additions and 0 deletions

View File

@@ -590,4 +590,14 @@ router.delete('/logs/:id', authenticate, requireAdmin, (req, res) => {
res.json({ ok: true });
});
// GET /console-log/download Live-Konsolen-Mitschnitt (letzte 24h) als
// Datei herunterladen (Admin)
router.get('/console-log/download', authenticate, requireAdmin, (req, res) => {
const { getLogFilePath } = require('../consoleLog');
const filePath = getLogFilePath();
if (!fs.existsSync(filePath)) return res.status(404).json({ error: 'Noch keine Logs vorhanden' });
const stamp = new Date().toISOString().replace(/[:T]/g, '-').slice(0, 19);
res.download(filePath, `dickendock-console-${stamp}.log`);
});
module.exports = router;