Sign in
-Use your existing OSCAR screen name and password.
+Sign in with your OSCAR screen name. Server defaults to Claytonia; change host/ports to connect elsewhere.
diff --git a/HANDOFF.md b/HANDOFF.md index 906641f..b2da00d 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -2,9 +2,9 @@ ## Status -**Phase:** M1/M2 in progress - TOC transport added for IM/chat/invites; Web API kept for buddy/presence where available. TOC auth fixed (roast prefix bug); remote `steve:please` signs on to TOC successfully. Group chat/invite flow should now be testable on web UI. +**Phase:** M1/M2 in progress - TOC transport added for IM/chat/invites; Web API kept for buddy/presence where available. Public-hardening pass applied (SQLite sessions, corrupt DB recovery, SSE per-IP limit, input validation, session cleanup). -**Date:** 2026-12-02 (updated) +**Date:** 2026-12-03 (updated) ## What was done @@ -49,6 +49,8 @@ Against local open-oscar-server 0.25.0 with `DISABLE_AUTH=true`, TOC listener 98 - **TOC 980 root cause (fixed 2026-12-02):** `src/toc.js` `roastPassword` incorrectly prepended `00 02` before XORing. open-oscar-server `wire.RoastTOCPassword` XORs the full payload with `Tic/Toc` and does not strip a prefix, so the extra bytes corrupted the cleartext and caused 980 on real-auth servers. Fixed by removing the prefix. Verified: local auth-enabled oscar-server and remote `oscar.claytonia.net:9898` both sign on with `steve/please` (`SIGN_ON:TOC2.0`). - **UI overhaul (initial, 2026-12-02):** dark theme, sidebar sections as cards, conversations moved to tabs above chat window, message style toggle (Bubbles/Classic AIM-IRC) persisted in localStorage. Local static assets only, no build step. +- **Recent UI/fix pass (2026-12-03):** CSP `upgrade-insecure-requests` disabled for HTTP deployments; TOC status label shows Connected/Disconnected; TOC-sent IMs broadcast into SSE buffer for replay on refresh; frontend `addMessage()` dedupes by msgId/recent same-sender text to prevent duplicate display; message input is textarea with Enter-to-send/Shift+Enter newline; buddy list shows per-person outlined rows with green/red/yellow status dots and handles `presence` updates. +- **Login hardening/UX (2026-12-03):** login page includes a simple server-side math bot check (`GET /api/auth/challenge`, validated on login) and configurable server host + Web API/TOC ports (defaults prefilled from env, Claytonia-friendly). Backend auth supports per-login Web API base/TOC host+port. - **Web API chat unavailable on 0.25.0:** do not rely on `/chat/*` Web API endpoints on this server. TOC is the working transport for chat/invites. - **TOC is HTTP-mixed on 9898:** normal HTTP clients get 404; TOC clients must send `FLAPON\r\n\r\n` first. Any proxy in front of 9898 must pass raw TCP. - **No reliable all-users list:** Management API not exposed; `memberDir/search` returned empty. UI has direct "Start IM by screen name" flow. @@ -96,11 +98,11 @@ Against local open-oscar-server 0.25.0 with `DISABLE_AUTH=true`, TOC listener 98 ## Needs to be done next -1. **Complete public-hardening pass** and verify login/IM/chat/SSE still work. +1. **Deploy publicly behind HTTPS nginx:** `LISTEN_HOST=127.0.0.1`, `TRUST_PROXY=1`, `COOKIE_SECURE=true`, strong `SESSION_SECRET`, `.env` chmod `0600`, non-root systemd service, firewall block app port, nginx SSE buffering off for `/api/events`. 2. **UI polish follow-up:** tab close buttons, unread indicators, chat room membership/leave/invite-send UI, better mobile layout. 3. **Harden TOC client:** handle reconnect/backoff, keepalive timeout, parse CONFIG2 buddy list properly, handle TOC1/TOC2 variants, handle chat errors/room not found. 4. **Chat UX:** show chat room membership, leave button, invite-send UI, better system messages, error states. -5. **M5:** systemd service, env file permissions, nginx/certbot review. +5. **Security follow-up:** configurable login host/ports enable arbitrary server targets; consider SSRF/egress restrictions or allowlist if exposed publicly. ## Files of interest diff --git a/README.md b/README.md index 9180238..75d8953 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,10 @@ A small browser chat client for [Open OSCAR Server](https://github.com/mk6i/open ## Features - Sign in with an existing OSCAR screen name/password +- Simple math bot check on login +- Configurable server host/Web API port/TOC port on login (defaults prefilled) - 1:1 instant messages -- Buddy list/presence (when provided by server/Web API) +- Buddy list with online/away/offline status dots (presence updates when provided) - Add buddy - Group chat join/send/leave via TOC - Chat invites (Join/Ignore) via TOC diff --git a/public/app.js b/public/app.js index dd78365..d9ae4d0 100644 --- a/public/app.js +++ b/public/app.js @@ -275,16 +275,38 @@ stream.on('*', (event) => { // --- UI wiring --- +async function loadChallenge() { + try { + const c = await api.challenge(); + document.getElementById('captchaQuestion').textContent = `${c.a} + ${c.b} =`; + document.getElementById('captchaAnswer').value = ''; + const d = c.defaults || {}; + const host = document.getElementById('serverHost'); + const wp = document.getElementById('webapiPort'); + const tp = document.getElementById('tocPort'); + if (host && !host.value) host.value = d.host || 'oscar.claytonia.net'; + if (wp && !wp.value) wp.value = String(d.webapiPort || 8081); + if (tp && !tp.value) tp.value = String(d.tocPort || 9898); + } catch (err) { + console.warn('[challenge] load failed', err); + } +} + document.getElementById('loginForm').addEventListener('submit', async (e) => { e.preventDefault(); ui.setLoginError(''); const screenName = document.getElementById('screenName').value.trim(); const password = document.getElementById('password').value; + const host = document.getElementById('serverHost').value.trim(); + const webapiPort = Number(document.getElementById('webapiPort').value); + const tocPort = Number(document.getElementById('tocPort').value); + const captchaAnswer = Number(document.getElementById('captchaAnswer').value); try { - await api.login(screenName, password); + await api.login({ screenName, password, host, webapiPort, tocPort, captchaAnswer }); await afterLogin(screenName); } catch (err) { ui.setLoginError(err.message); + loadChallenge().catch(() => {}); } }); @@ -295,6 +317,7 @@ document.getElementById('logoutBtn').addEventListener('click', async () => { state.active = null; state.conversations = {}; ui.showLogin(); + loadChallenge().catch(() => {}); }); const styleToggleBtn = document.getElementById('styleToggleBtn'); @@ -434,6 +457,7 @@ async function boot() { // fall through to login } ui.showLogin(); + loadChallenge().catch(() => {}); } boot(); diff --git a/public/index.html b/public/index.html index 9bb7e6e..f26f28d 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@
Use your existing OSCAR screen name and password.
+Sign in with your OSCAR screen name. Server defaults to Claytonia; change host/ports to connect elsewhere.