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:
jjbruntonandClaude Opus 4.7 committed 2026-05-22 21:57:33 +01:00
1 parent 705d88dca1
commit 2bf8989ec7
4 files changed
+74 -2

No files matched your search

+13 -1
View File
@@ -46,7 +46,7 @@ export class WebServer {
private app: express.Application;
private server: Server | null = null;
private activity: ActivityLog;
private broadcaster = new LogBroadcaster();
private broadcaster: LogBroadcaster;
private botRunning = false;
private messagesThisHour = 0;
private runtimeConfig: RuntimeConfig;
@@ -62,7 +62,9 @@ export class WebServer {
private successfulMessagesRepo: SuccessfulMessagesRepository,
private activityLogRepo: ActivityLogRepository,
private logger: Logger,
broadcaster?: LogBroadcaster,
) {
this.broadcaster = broadcaster ?? new LogBroadcaster();
this.activity = new ActivityLog(activityLogRepo);
this.runtimeConfig = {
rateLimit: {
@@ -103,6 +105,16 @@ export class WebServer {
}
private setupRoutes(): void {
// index.html serves the entire inline JS — never cache it.
this.app.use((req, res, next) => {
if (req.path === '/' || req.path === '/index.html') {
const p = path.join(process.cwd(), 'public', 'index.html');
res.set('Cache-Control', 'no-cache, no-store, must-revalidate');
return res.sendFile(p);
}
next();
});
this.app.use('/media', express.static(path.join(process.cwd(), 'data', 'media')));
this.app.use(express.static(path.join(process.cwd(), 'public')));
this.app.use(express.json());