feat: replace browser login with imported Reddit sessions

This commit is contained in:
jjbrunton committed 2026-08-08 16:48:59 +01:00
1 parent 2b0545afcf
commit c483c7b8be
76 files changed
+2048 -2828

No files matched your search

+1 -18
View File
@@ -1,29 +1,12 @@
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);
});
// Dumps the browser context's cookies (names + metadata only — values are
// hashed) so we can tell which session/OAuth cookies are set after the
// auto-login and which the chat surface might be missing.
// extension import and which the chat surface might be missing.
router.get('/debug/cookies', async (req, res) => {
const browser = ctx.services.browser;
if (!browser) {