feat: implement user authentication and login modal, refactor backend

This commit is contained in:
Omar Sánchez Pizarro
2026-01-20 00:39:28 +01:00
parent 9a61f16959
commit e99424c9ba
29 changed files with 3061 additions and 855 deletions

View File

@@ -0,0 +1,22 @@
import express from 'express';
import { basicAuthMiddleware } from '../middlewares/auth.js';
import { getLogPath, readLogs } from '../utils/fileUtils.js';
const router = express.Router();
// Obtener logs (últimas líneas o nuevas líneas desde un número de línea)
router.get('/', basicAuthMiddleware, (req, res) => {
try {
const logPath = getLogPath();
const sinceLine = parseInt(req.query.since) || 0;
const limit = parseInt(req.query.limit) || 500;
const result = readLogs(logPath, { sinceLine, limit });
res.json(result);
} catch (error) {
res.status(500).json({ error: error.message });
}
});
export default router;