wa-dev-tools/routes/status.js
treamz b7e9eb03ab Status page: clean neutral design, uptime only
- Removed technical details (memory, PID, disk, ffmpeg checks)
- Services: API, Database, Image Processing, Video Processing, Auth
- Clean layout like status.claude.com
- Same header as auth pages (unified nav)
- English labels (Operational/Degraded/Outage)
2026-03-22 00:43:06 +03:00

52 lines
1.3 KiB
JavaScript

'use strict';
const express = require('express');
const path = require('path');
const { pool } = require('../lib/db');
const router = express.Router();
const SERVER_START = Date.now();
// Serve page
router.get('/', (req, res) => {
res.sendFile(path.resolve(__dirname, '../public/status.html'));
});
// Status API — neutral, uptime-focused (like status.claude.com)
router.get('/api', async (req, res) => {
const services = [];
// API
services.push({ name: 'API', status: 'operational' });
// Database
try {
await pool.execute('SELECT 1');
services.push({ name: 'Database', status: 'operational' });
} catch {
services.push({ name: 'Database', status: 'outage' });
}
// Image Processing
services.push({ name: 'Image Processing', status: 'operational' });
// Video Processing
services.push({ name: 'Video Processing', status: 'operational' });
// Authentication
services.push({ name: 'Authentication', status: 'operational' });
const overall = services.some(s => s.status === 'outage') ? 'outage'
: services.some(s => s.status === 'degraded') ? 'degraded'
: 'operational';
res.json({
overall,
uptime: Math.floor((Date.now() - SERVER_START) / 1000),
services,
timestamp: new Date().toISOString(),
});
});
module.exports = router;