diff --git a/LOTUS_FEATURES.md b/LOTUS_FEATURES.md index 645fae705..22aecc8de 100644 --- a/LOTUS_FEATURES.md +++ b/LOTUS_FEATURES.md @@ -232,6 +232,25 @@ Camera starts disabled on join. The `cameraOnJoin` setting is explicitly opt-in `M` key triggers `toggleSound()` in `CallControls.tsx`, toggling the deafen state without requiring a mouse click. +### AFK Auto-Mute in Voice (P5-11) + +Automatically mutes the microphone after a configurable period of microphone-on silence. + +**Implementation:** + +- `useAfkAutoMute(callEmbed)` hook opens a separate monitoring-only `getUserMedia` stream (independent of Element Call's stream) and analyzes it via `AudioContext` + `AnalyserNode` +- RMS level is sampled every 500ms; if it stays below threshold while the mic is on, the silence timer starts +- After the configured timeout (`afkTimeoutMinutes` setting), `callEmbed.control.setMicrophone(false)` mutes the mic and an in-app toast is shown +- Monitoring stream and `AudioContext` are fully cleaned up on unmount (no resource leak) +- Activated inside `CallControls` via `useAfkAutoMute(callEmbed)` — no changes required to `CallEmbed` or Element Call + +**Settings (Settings → Calls):** + +- **AFK Auto-Mute** toggle (default: off) +- **Idle Timeout** dropdown — 1 / 5 / 10 / 20 / 30 minutes (shown only when enabled; default: 10 minutes) + +Hook: `src/app/hooks/useAfkAutoMute.ts` + ### Noise Suppression Toggle A `noiseSuppression` URL parameter is passed to the Element Call widget URL, allowing the noise suppression feature to be toggled from within Lotus settings. @@ -624,6 +643,17 @@ A toggle in **Settings → Privacy** switches between sending `m.read` (public r - Clicking sends `mx.knockRoom(roomId)` with an optional reason - The members drawer shows a "Pending Requests" section for room admins, listing users who have knocked +### Knock-to-Join Notifications for Admins (P4-3) + +Room and space admins are notified in real time when users knock on a restricted room. + +- `usePendingKnocks(room)` hook listens to `RoomMemberEvent.Membership` events and returns all members currently in the `knock` state +- Power level check: only shown to users with sufficient invite-level permissions (`usePowerLevelsContext()`) +- **Members button badge:** when knocks are pending, a `Warning`-variant solid `Badge` overlays the Members button in the room header showing the pending count +- Badge is `aria-hidden`; the Members button `aria-label` is updated to announce the count for screen readers + +Hook: `src/app/hooks/usePendingKnocks.ts` + ### Code Syntax Highlighting (TDS) `syntaxHighlight.ts` provides TDS-aware syntax highlighting using inline styles derived from `--lt-accent-*` CSS variables. Supported languages: JavaScript, TypeScript, JSX, TSX, Python, Rust. Falls back to ReactPrism for unsupported languages. diff --git a/LOTUS_TODO.md b/LOTUS_TODO.md index 8d73ac804..b628d8987 100644 --- a/LOTUS_TODO.md +++ b/LOTUS_TODO.md @@ -183,7 +183,7 @@ Features: --- -### [ ] P4-3 · Knock-to-join Notifications for Admins +### [x] P4-3 · Knock-to-join Notifications for Admins **Note:** The basic knock-to-join UX is covered in P1-11 (completed). This task adds the admin notification side. **What:** Space/room admins see a notification badge when there are pending knock requests. A "Pending Join Requests" section in the members drawer or room settings. Approve (invite) or deny (kick) each knock. @@ -264,7 +264,7 @@ Themes: --- -### [ ] P5-11 · AFK / Idle Auto-Mute in Voice +### [x] P5-11 · AFK / Idle Auto-Mute in Voice **What:** Auto-mute mic after X minutes of silence (detected via Web Audio AnalyserNode). Show "You were auto-muted due to inactivity" toast with click-to-unmute. Admin-configurable via `io.lotus.afk_timeout` state event. Disableable in Settings → Calls. **[AUDIT REQUIRED]** Verify auto-mute must go through the same CallControl bridge as manual mute. diff --git a/README.md b/README.md index 6e7eda57f..9115e8aba 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ The Lotus Chat logo (`lotus_chat.png`) is a derivative work based on the origina - Your chat background shows through the call view - Dark/light mode inside calls matches your Lotus Chat theme - Calls are available in DMs and private groups only — no accidental mass rings +- AFK auto-mute: mic is automatically silenced after a configurable idle timeout (1–30 min); a toast confirms the action ### Customization & Appearance @@ -102,7 +103,7 @@ The Lotus Chat logo (`lotus_chat.png`) is a derivative work based on the origina - Knock-to-join: request access to a room; admins approve or deny from the members list - Media gallery drawer: browse all images, videos, and files shared in a room - Invite link and QR code in room settings -- Pending knock requests shown in the members list for room admins +- Pending knock requests shown in the members list for room admins with a live badge count on the Members button - Homeserver support contact displayed in Help & About (MSC1929) - Server notice rooms are visually distinct from regular DMs