Files
m8chat-app2/help4bis-claude-notes/current-state.md

3.8 KiB

M8Chat App2 — Current State (2026-04-10)

Custom Flutter Matrix chat client (v1.2.0) deployed to app2.m8chat.au for testing. Production (app.m8chat.au) still runs the old FluffyChat fork — DO NOT deploy there.

What works

  • Chat messaging — rooms list, timeline, send/receive, reactions, replies, file upload, typing indicators
  • E2EE (Olm/Megolm) — Olm loads in browser, device keys upload, messages encrypt/decrypt between app2 and Element
  • Spaces — expandable space list with child rooms
  • User search — search Matrix user directory, start DMs
  • Jitsi conferencing — lazy-loaded iframe, no-login required
  • LiveKit video/audio calls — JWT fetch works, WebRTC connects, video+audio publish to LiveKit SFU
  • Session persistence — credentials in flutter_secure_storage, events in MatrixSdkDatabase (IndexedDB)
  • Brave browser — app loads and works (Olm included, graceful fallback if WASM blocked)

What is broken / incomplete

  • Video call rendering — SCRAMBLED VIDEO from Element X: Root cause identified. Element X sends media with encryption: GCM (AES-GCM frame encryption). App2 sends encryption: NONE. The LiveKit Flutter SDK needs E2EE frame encryption enabled to decrypt Element X video. This is the #1 priority fix.
  • Incoming call detection: App listens for old m.call.invite events. Element X sends MSC3401 call.member state events. Incoming calls from Element X to app2 are not detected.
  • Avatar 404s: ~10 room avatars return 404 on legacy /_matrix/media/v3/download/ path. Server may require authenticated media.
  • Rooms list spam: debugPrint in rooms_repository.dart dumps all 15 rooms to console on every sync. Needs removal.
  • Old ghost devices: 20 devices for @try user, 5 without keys (from pre-Olm builds). Should be cleaned up server-side.
  • Red exclamation mark in Element: Try device is unverified (no cross-signing). Cosmetic — requires manual verification or Phase 2 cross-signing.
  • Profile screen: E2EE status shows dynamically but notifications/cross-signing are placeholders.

Key file paths

  • Project root: /srv/wp-dev/pwa-sites/m8chat-app2/
  • Web entry: web/index.html (Olm load + fallback + Flutter bootstrap)
  • App config: lib/core/config/app_config.dart (server URLs, version 1.2.0)
  • Matrix client: lib/core/network/matrix_client.dart (MatrixSdkDatabase provider)
  • Auth flow: lib/core/auth/auth_notifier.dart + lib/features/auth/data/auth_repository.dart
  • LiveKit service: lib/features/calls/data/livekit_service.dart (JWT fetch, MatrixRTC state events)
  • Call screen: lib/features/calls/presentation/call_screen.dart (video rendering)
  • Call controller: lib/features/calls/presentation/call_controller.dart (state machine)
  • Chat repo: lib/features/chat/data/chat_repository.dart (timeline, send, react, redact)
  • Jitsi service: lib/features/jitsi/data/jitsi_web_service.dart (lazy script load)
  • Build output: build/web/ (flutter build web --release)

Server infrastructure (chat.m8chat.au)

  • Synapse 1.151.0 (healthy, 86 active users)
  • LiveKit 1.10.1 + lk-jwt-service (both healthy)
  • Element Web 1.12.15, Element Call
  • PostgreSQL on host (user: synapse_user, pass: kijPt4cPWkoaZk8BVm, db: synapse)
  • LiveKit WSS URL: wss://matrix.m8chat.au/livekit/
  • JWT endpoint: https://matrix.m8chat.au/_matrix/livekit/jwt/sfu/get

Deployment

  • Target: app2.m8chat.au (NOT app.m8chat.au)
  • SSH: m8chat@app.m8chat.au:2233 (key: ~/.ssh/m8chat_prod), path: public_html/app2.m8chat.au/
  • Build: cd /srv/wp-dev/pwa-sites/m8chat-app2 && flutter build web --release
  • Deploy: rsync -avz --delete --exclude='.htaccess' --exclude='.ftpquota' -e "ssh -p 2233 -i ~/.ssh/m8chat_prod" build/web/ m8chat@app.m8chat.au:public_html/app2.m8chat.au/
  • Backup on server: public_html/app2.m8chat.au_backup_20260410_*.tar.gz