From a36723a3253d70153e5ccde4e2284c82728330ae Mon Sep 17 00:00:00 2001 From: Jamie Brunton Date: Sat, 8 Aug 2026 16:55:04 +0100 Subject: [PATCH] chore: remove retired native login paths --- DOKPLOY_DEPLOY.md | 63 +- .../src/features/settings/settings-page.tsx | 4 +- src/browser/message-page.ts | 560 ------------------ src/native-login-gate.ts | 102 ---- src/services/native-login-handoff.ts | 28 - tests/native-login-gate.test.ts | 36 -- 6 files changed, 18 insertions(+), 775 deletions(-) delete mode 100644 src/browser/message-page.ts delete mode 100644 src/native-login-gate.ts delete mode 100644 src/services/native-login-handoff.ts delete mode 100644 tests/native-login-gate.test.ts diff --git a/DOKPLOY_DEPLOY.md b/DOKPLOY_DEPLOY.md index ab4a1cd..98cc45f 100644 --- a/DOKPLOY_DEPLOY.md +++ b/DOKPLOY_DEPLOY.md @@ -1,57 +1,26 @@ -# Deploying RedditBot to Dokploy +# Dokploy deployment -This guide explains how to deploy the RedditBot to Dokploy without needing to manually transfer your local browser session. +RedditBot now uses extension dumps as its only account-authentication path. The container does not expose VNC, start Google Chrome, submit Reddit credentials, or sniff Matrix tokens. -## Automated Login Feature +## Environment -The bot has been updated to support automated login using environment variables. This means when you deploy to a fresh server (like Dokploy), the bot will detect it's not logged in and automatically authenticate using the credentials you provide. +Configure only the application secrets required by the Compose file: -## Deployment Steps +- `OPENROUTER_API_KEY` +- `WEB_DASHBOARD_TOKEN` -1. **Create a New Application in Dokploy**: - * Select "Docker Compose" as the deployment method (recommended) or "Dockerfile". +Do not configure Reddit usernames, passwords, display servers, CDP endpoints, or remote-browser ports. -2. **Environment Variables**: - * Go to the "Environment" tab of your application. - * Add the following variables: - * `OPENROUTER_API_KEY`: Your OpenRouter API key. - * `REDDIT_USERNAME`: Your Reddit username. - * `REDDIT_PASSWORD`: Your Reddit password. - * `BROWSER_HEADLESS`: `false` (required for interactive noVNC login). - * `VNC_PASSWORD`: A strong password for the interactive VNC session. - * `NOVNC_PUBLIC_URL`: `http://:16080`. +## Account activation -3. **Volumes (Persistence)**: - * The `docker-compose.yml` is already configured to mount a `./data` volume. - * Dokploy usually handles volumes automatically for Docker Compose projects, or you may need to define a persistent volume path if you want data to survive container recreations (which you do, to avoid logging in every time). - * Make sure the `/app/data` directory is persisted. +1. Deploy the service and open the dashboard. +2. Install the extension from `extensions/reddit-session-exporter` in your local Chrome profile. +3. Sign in to Reddit locally, open Reddit Chat, and wait for the extension badge to show `OK`. +4. Export `redditbot-session.json` and upload it under **Settings > Access**. +5. Delete the local JSON file after the dashboard verifies it. -4. **Deploy**: - * Push your code to your Git repository connected to Dokploy. - * Click "Deploy". +The dump contains both Reddit cookies and a Matrix bearer token. Until both identities verify, the bot, response checks, chat, media sync, and dashboard start control remain paused. If either credential expires, import a new dump. -## noVNC networking +## Persistence -The Compose configuration publishes noVNC directly on host port `16080`. -Do not route it through a Dokploy/Traefik domain: the upstream proxy strips -the WebSocket Upgrade request that noVNC requires, producing `rfb.js:688` with -WebSocket code `1011` and “Failed to connect to downstream server”. - -Set `NOVNC_PUBLIC_URL` to `http://:16080`, then open that URL in -a separate tab from the dashboard. If the dashboard itself is HTTPS, browsers -will not embed this HTTP endpoint in its iframe; the separate-tab link is the -intended route. Restrict inbound TCP `16080` at the Dokploy host firewall to -your own IP or VPN subnet. - -## How it works - -1. On the first run, the bot will see the `data/browser-session` folder is empty/invalid. -2. It will read `REDDIT_USERNAME` and `REDDIT_PASSWORD`. -3. It will launch a headless browser, navigate to Reddit, and log in. -4. The session cookies and storage will be saved to `data/browser-session`. -5. On subsequent restarts, it will use the saved session (as long as the `/app/data` volume is persisted). - -## Troubleshooting - -* **Login Failed**: Check the application logs. If Reddit presents a captcha or 2FA, the automated login will fail. You may need to temporarily run locally to solve the captcha, then copy the session (though this feature avoids that for standard accounts). -* **Verification**: The logs will show "Credentials found in config/env. Attempting automated login..." followed by "Login successful!". +The `reddit_bot_data` volume retains the database, the imported Playwright cookie profile, and the verified Matrix credential across deployments. Back up this volume as sensitive account data. diff --git a/apps/dashboard/src/features/settings/settings-page.tsx b/apps/dashboard/src/features/settings/settings-page.tsx index cc211b5..369d4fc 100644 --- a/apps/dashboard/src/features/settings/settings-page.tsx +++ b/apps/dashboard/src/features/settings/settings-page.tsx @@ -13,7 +13,7 @@ const sections: ReadonlyArray<{ id: SettingsSection; label: string; description: { id: 'monitoring', label: 'Monitoring', description: 'Post discovery and recency' }, { id: 'rate-limits', label: 'Rate limits', description: 'Sending pace and safeguards' }, { id: 'behaviour', label: 'Behaviour', description: 'Dry run and subreddits' }, - { id: 'access', label: 'Access', description: 'Reddit browser session' }, + { id: 'access', label: 'Access', description: 'Extension session dump' }, ]; function errorMessage(error: Error | null): string { @@ -26,7 +26,7 @@ export function SettingsPage({ section, onSectionChange }: SettingsPageProps) { return (
-
Platform configuration

Settings

Manage supported runtime behaviour and Reddit browser access.

+
Platform configuration

Settings

Manage supported runtime behaviour and Reddit account access.