feat: Server-Konsolen-Mitschnitt (24h, wie docker logs) als Download im Logs-Bereich
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user