Pipe winston logs to dashboard + add Matrix sniff debug route
The dashboard's /api/logs buffer only ever saw lines explicitly pushed via broadcaster.push, so winston output (including the Matrix token-extractor's timeout diagnostics) was invisible from the deployed container. Attach a winston transport that forwards every entry into the LogBroadcaster before the rest of bootstrap runs, so the matrix sniff's `finalUrl=... hosts=[...]` line shows up in /api/logs. Also serve data/matrix-debug.png (the screenshot the extractor drops on timeout) at /api/debug/matrix-debug.png so we can see what chat.reddit.com looked like in the headed browser without shell access to the Dokploy host. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
705d88dca1
commit
2bf8989ec7
4 files changed
+74
-2
No files matched your search
@@ -1,9 +1,26 @@
|
||||
import { Router } from 'express';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import type { WebContext } from '../context.js';
|
||||
|
||||
export function createDebugRouter(ctx: WebContext): Router {
|
||||
const router = Router();
|
||||
|
||||
// Serves the screenshot dropped by the matrix token-extractor when the
|
||||
// sniff times out (data/matrix-debug.png). Lets us see what chat.reddit.com
|
||||
// looked like in the headed browser without needing host shell access.
|
||||
router.get('/debug/matrix-debug.png', (_req, res) => {
|
||||
const p = path.resolve(process.cwd(), 'data/matrix-debug.png');
|
||||
if (!fs.existsSync(p)) {
|
||||
res.status(404).json({ error: 'No matrix-debug.png yet — sniff has not failed since last clean start.' });
|
||||
return;
|
||||
}
|
||||
const stat = fs.statSync(p);
|
||||
res.set('Cache-Control', 'no-cache, no-store, must-revalidate');
|
||||
res.set('X-Captured-At', stat.mtime.toISOString());
|
||||
res.sendFile(p);
|
||||
});
|
||||
|
||||
router.post('/debug/inspect-dom', async (req, res) => {
|
||||
if (!ctx.services.chat) {
|
||||
res.status(500).json({ error: 'Chat service not initialized' });
|
||||
|
||||
Reference in new issue
Block a user