Dashboard admin : split stats/disk + preload disk au warmup + wc -l (1.85s -> 40ms)

This commit is contained in:
unfr
2026-04-24 08:48:29 +02:00
parent bd8e4e5228
commit 54b6cc453e
4 changed files with 100 additions and 72 deletions

View File

@@ -8,7 +8,7 @@ import { readdir, readFile, stat } from 'node:fs/promises';
import { join } from 'node:path';
import { ADMIN_PASSWORD_HASH, ROOT, TITLE } from '../config.js';
import { verifyPassword } from '../lib/password.js';
import { getMetricsForUI, getStats } from '../lib/stats.js';
import { getDiskUsage, getMetricsForUI, getStats } from '../lib/stats.js';
const HIDDEN = new Set([
'node_modules',
@@ -133,6 +133,11 @@ export default async function adminRoutes(fastify) {
return getStats();
});
fastify.get('/admin/api/disk', async (req, reply) => {
if (!requireAuth(req, reply)) return;
return getDiskUsage();
});
fastify.get('/admin/api/metrics', async (req, reply) => {
if (!requireAuth(req, reply)) return;
return getMetricsForUI();