Files
m8chat-app2/help4bis-claude-notes/decisions.md
help4bis 923c0ad878 fix: Jitsi meeting join rendered blank page — call JitsiMeetExternalAPI with 'new'
- Bind JitsiMeetExternalAPI as extension type external constructor;
  the old external function binding invoked the ES6 class without 'new'
  and threw at runtime (silently, in release builds)
- joinMeeting: wait up to 5s for platform-view container div (post-frame
  race), build options via setProperty (jsify cannot carry DOM nodes),
  return success bool, log failures to browser console
- jitsi_screen: show 'Could not start the meeting' UI instead of blank
- v1.6.2+10, deployed to app2.m8chat.au

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 07:05:32 +10:00

85 lines
7.6 KiB
Markdown

### 2026-04-10 18:00 — Enable Olm E2EE in web build
- **Decision:** Re-enabled Olm encryption in index.html with synchronous load + Olm.init() before Flutter boots, graceful fallback if Olm fails
- **Rationale:** 45 of 88 rooms have Megolm encryption. MatrixSdkDatabase persists Olm keys in IndexedDB resolving /keys/upload 400 errors
- **Files affected:** web/index.html, lib/main.dart, app_config.dart, auth_repository.dart, pubspec.yaml
- **Status:** Working — device keys uploaded, messages encrypt/decrypt correctly
### 2026-04-10 17:25 — Deploy target is app2.m8chat.au NOT app.m8chat.au
- **Decision:** app.m8chat.au = PRODUCTION (old FluffyChat). app2.m8chat.au = dev/test for m8chat-app2
- **Rationale:** User corrected after accidental production deploy. Production restored from backup.
- **Status:** All future deploys to app2.m8chat.au
### 2026-04-10 17:15 — Lazy-load Jitsi external_api.js
- **Decision:** Moved from index.html to dynamic load in jitsi_web_service.dart
- **Rationale:** Brave blocks cross-origin scripts at page load
- **Status:** Done
### 2026-04-10 17:10 — Add MessageType.encrypted with lock icon UX
- **Files:** message_model.dart, chat_repository.dart, message_bubble.dart, room_preview.dart
- **Status:** Done
### 2026-04-10 17:05 — Fix web metadata to M8Chat branding
- **Files:** web/index.html, web/manifest.json
- **Status:** Done
### 2026-04-11 02:00 — Add Jitsi Conference tab to bottom nav
- **Decision:** Added 4th tab (videocam icon) to authenticated bottom nav so logged-in users can join Jitsi conferences
- **Rationale:** Jitsi join was only accessible on the unauthenticated welcome screen. Logged-in users could never reach it.
- **Files affected:** rooms_screen.dart (v1.3.0), conference_tab.dart (new), jitsi_screen.dart (Back→/rooms)
- **Status:** Done and deployed
### 2026-04-11 03:00 — LiveKit E2EE frame encryption attempt
- **Decision:** Added CallE2EEManager for m.rtc.encryption_keys to-device key exchange + E2EEOptions on LiveKit Room
- **Rationale:** Element X encrypts video frames with AES-GCM. Without decryption, video is scrambled.
- **Files affected:** call_e2ee.dart (new), livekit_service.dart (v1.4.0)
- **Status:** PARTIALLY WORKING — E2EE worker requires SharedArrayBuffer which needs COOP/COEP headers. Headers added to .htaccess on 2026-04-11. Key exchange protocol (m.rtc.encryption_keys) implemented but interop with Element X NOT YET VERIFIED.
### 2026-04-11 04:00 — Web auth: fresh login every session (no session persistence)
- **Decision:** Removed session restore entirely for web. Every visit requires login. No access token stored.
- **Rationale:** Security — web app runs on untrusted/shared devices. Can't assume same user. Different from future APK which will persist sessions.
- **Files affected:** auth_notifier.dart (v2.0.0), secure_storage.dart (v2.0.0), auth_repository.dart (v2.0.0), app_config.dart (v2.0.0)
- **Status:** Done. Removed StoredCredentials, restoreSession(), storage key constants. Device ID persistence also removed (caused keys/upload 400 because Olm account not persisted).
### 2026-04-11 04:30 — SSSS + cross-signing + key backup bootstrap
- **Decision:** Implemented full security setup dialog using Matrix SDK Bootstrap class
- **Rationale:** Users need to create/restore SSSS to decrypt old messages. Replaces "Phase 2" placeholder.
- **Files affected:** security_setup_dialog.dart (new), key_restore_dialog.dart (new), profile_screen.dart (v1.4.0)
- **Status:** Done. User 'try' successfully ran security setup. Recovery key generated.
### 2026-04-11 05:00 — Fix authenticated media (Synapse 1.151.0)
- **Decision:** Switched from frozen /_matrix/media/v3/download/ to /_matrix/client/v1/media/download/ with access_token query param
- **Rationale:** Synapse 1.151.0 froze the old media endpoint. All room avatars returned 404.
- **Files affected:** mxc_url.dart (v2.0.0)
- **Status:** Done — avatars load correctly now
### 2026-04-11 06:00 — Add Help tab + Account management info
- **Decision:** Added 5th bottom nav tab (Help) with expandable help cards
- **Rationale:** Users need in-app guidance for encrypted messages, security setup, account management
- **Files affected:** help_tab.dart (new), rooms_screen.dart (v1.3.0)
- **Status:** Done. Contains: encrypted messages fix guide, getting started, conference guide, video call issues, account management (links to m8chat.au), privacy statement.
### 2026-04-11 07:00 — COOP/COEP headers for E2EE workers
- **Decision:** Added Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy to .htaccess
- **Rationale:** LiveKit E2EE frame encryption uses Web Workers that need SharedArrayBuffer
- **Files affected:** .htaccess on app2.m8chat.au (production server)
- **Status:** Headers verified active. E2EE re-enabled in code. NOT YET TESTED with a live call.
### 2026-04-11 07:00 — Fix hangup call termination
- **Decision:** Changed _clearCallMemberEvent to send {} instead of {'memberships': []}
- **Rationale:** Element X sends {} when ending calls (verified from DB). Our {'memberships': []} wasn't being recognised.
- **Files affected:** livekit_service.dart
- **Status:** Deployed. NOT YET TESTED.
### 2026-07-03 05:20 — Functionality audit + brand retheme (v1.6.0+8)
- **Decision:** Retheme app from purple (#5C35C9) to m8chat.au brand blues taken from the site's Elementor kit: brandBlue #1265ED, accentBlue #3B8BFF, navy darks derived from Ancop Blue #010B46.
- **Rationale:** Full audit (2026-07-03) found look and feel did not match m8chat.au. Logo rendered black because flutter_svg does not parse SVG <style> blocks; fills now inlined as attributes in m8logo.svg. Profile screen showed stale hardcoded appVersion 1.3.0. UI strings contained em-dashes (global style rule violation).
- **Audit results:** Backend all healthy (client API, livekit JWT, Jitsi external_api.js, push gateway, TURN 3478/5349). Full E2E pass in headless Chromium: login, rooms, spaces, profile, conference, help tabs, room open, message send verified on Synapse. Disposable audit users created and erased via admin API.
- **Files affected:** assets/images/m8logo.svg, lib/app/theme.dart (2.0.0), lib/core/config/app_config.dart (2.1.0), web/manifest.json, pubspec.yaml (1.6.0+8), em-dash fixes in 8 presentation/util files, chat_screen.dart lint fix (_leaveRoom context param).
- **Status:** Done — built, deployed to app2.m8chat.au (backup public_html.bak.20260703_pre160.tar.gz), visually verified light+dark.
### 2026-07-04 07:15 — Jitsi conference join fixed (v1.6.2+10)
- **Decision:** Root cause of "blank page on join" was the JS interop binding calling JitsiMeetExternalAPI (an ES6 class) as a plain function, i.e. without `new`. Browsers throw "Class constructor cannot be invoked without 'new'" and the meeting screen stayed blank. Feature had never worked in the web release build.
- **Fix:** `_JitsiApi` extension type with an external constructor (compiles to `new`), container-div wait loop in joinMeeting (post-frame callback could fire before the platform view div existed), JS options built via setProperty instead of Map.jsify (DOM node in a jsify map is unsupported), joinMeeting returns bool, jitsi_screen shows an error screen instead of blank on failure.
- **Verified:** headless Chromium on production build: iframe renders, prejoin page shows, devices pass, name entry works, reaches the Prosody JWT auth gate (expected for a tokenless room). COEP require-corp turned out NOT to block conf.m8chat.au in current Chromium.
- **Files affected:** lib/features/jitsi/data/jitsi_web_service.dart (1.2.0), lib/features/jitsi/presentation/jitsi_screen.dart (1.3.0), app_config 1.6.2, pubspec 1.6.2+10.
- **Status:** Done — deployed to app2.m8chat.au (backups pre160/pre161 tarballs on server).