feat: implement notification sound functionality with user customization options

This commit is contained in:
HueByte
2026-02-19 22:03:16 +01:00
parent b508a5854a
commit 7a8b5f02d3
15 changed files with 236 additions and 35 deletions
+1
View File
@@ -8,3 +8,4 @@ Articles related to the EchoHub TUI client built with Terminal.Gui v2.
- Theme system and customization
- Command system reference
- Configuration management
- [Notification sounds](../../articles/notification-sounds.md)
+43
View File
@@ -0,0 +1,43 @@
# Notification Sounds
EchoHub can play a notification sound when someone @mentions you. This is **disabled by default** and must be enabled in your profile settings.
## Enabling Notifications
Open your profile (`/profile`) and check the **"Notification sound on @mention"** checkbox, then save. You can also adjust the **Volume** (0-100, default 30). All settings are persisted in `~/.echohub/config.json`.
## Customizing the Sound
The client ships with a default `Notification.mp3` in the `Assets` folder. To use your own notification sound, replace the file at:
```
<app-directory>/Assets/Notification.mp3
```
The file must be a valid `.mp3` or `.wav` audio file. The replacement takes effect on the next app launch.
Alternatively, set a custom path in `~/.echohub/config.json`:
```json
{
"notifications": {
"enabled": true,
"volume": 30,
"soundFile": "/path/to/your/sound.mp3"
}
}
```
When `soundFile` is set, EchoHub uses that file instead of the bundled default.
## Disabling Notifications
Uncheck the option in your profile, or edit the config directly:
```json
{
"notifications": {
"enabled": false
}
}
```
+1 -1
View File
@@ -4,7 +4,7 @@ Release history for EchoHub.
## Releases
- [v0.2.3](v0.2.3.md) - Moderation, Private Channels & UI Overhaul
- [v0.2.3](v0.2.3.md) - Moderation, Embeds & UI Overhaul
- [v0.2.2](v0.2.2.md) - Startup & Shutdown Fixes
- [v0.2.1](v0.2.1.md) - Shutdown & CI Fixes
- [v0.2.0](v0.2.0.md) - IRC Gateway
+26 -3
View File
@@ -1,4 +1,4 @@
# v0.2.3 - Moderation, Private Channels & UI Overhaul
# v0.2.3 - Moderation, Embeds & UI Overhaul
## Features
@@ -16,6 +16,21 @@
- `GET /api/channels` returns the combined list: public channels + user's joined private channels
- Channel creators are automatically added as members
### OpenGraph Link Embeds
- Messages containing URLs now show a rich preview below the message text
- Server-side fetching: detects the first URL in a message, fetches the page, and parses OpenGraph meta tags (`og:title`, `og:description`, `og:image`, `og:site_name`)
- OG images are converted to a small 24x12 colored ASCII thumbnail using the existing half-block renderer
- Embeds are persisted in the database and included in channel history
- TUI client renders embeds with a `▏` left border bar — site name and border in blue, title in white, description in gray, followed by the ASCII thumbnail
- IRC gateway receives a text-only embed preview (site name, title, description) — no ASCII thumbnail to keep IRC output clean
- Falls back to `<title>` tag when no OG tags are present; gracefully skips if no useful metadata is found
- 3-second fetch timeout ensures message delivery is never significantly delayed
- SSRF protection rejects private/loopback IP addresses before fetching
### Notification Sounds
- Incoming messages play a notification sound when the terminal is not focused
- Embedded MP3 asset with cross-platform playback support
### Online Users Panel
- Collapsible right-side panel showing online users in the current channel (toggle with F2)
- Users displayed with status indicators, role badges, and their custom nickname colors
@@ -36,6 +51,7 @@
- Version number shown in the status bar
- Custom colored rendering for channel list (active indicator, unread count badges)
- Avatar upload field added to the profile edit dialog (file path or URL)
- Profile avatar now renders with full color tag support in the profile view dialog
- Update check notification on connect — shows a system message if a newer GitHub release exists
- Chat messages no longer show selection/focus highlight
- Exit shortcut changed from Ctrl+C to Alt+Q — frees Ctrl+C for copy
@@ -48,12 +64,19 @@
- Wired `OnChannelUpdated` SignalR event so new public channels appear for all connected users in real time
- Fixed color tag parser using wrong regex group numbers (6,7,8 instead of 1,2,3) — new ASCII art was rendering without colors
- Full Unicode/emoji support — renderers use Terminal.Gui v2 grapheme cluster API (`GraphemeHelper`, `AddStr`) for proper wide character handling
- Emoji-to-text shortcode conversion for consistent cross-platform rendering
- Fixed `/send` and `/avatar` commands not handling file paths with spaces correctly, even when quoted
- Profile avatar now renders with full color tag support instead of showing raw tags
- Server-side newline spam protection — consecutive blank/whitespace-only lines collapsed to 1 and total lines capped at 30
## Infrastructure
- New `LinkEmbedService` on the server — URL detection, HTML fetching (first 64KB), OG tag parsing via regex, image thumbnail generation
- `EmbedDto` record added to shared Core DTOs; `MessageDto` extended with optional `Embed` field (backward-compatible)
- `EmbedJson` nullable column on the `Message` table stores serialized embed data (max 8KB)
- Dedicated `"OgFetch"` named HttpClient with bot User-Agent header and 5-second timeout
- `NotificationSoundService` for cross-platform audio playback of embedded notification sounds
- Startup `DataMigrationService` automatically converts old ANSI-format messages to the new color tag format on server boot, logging the count of migrated records
- Three new EF Core migrations: `AddModerationRoles`, `AddChannelIsPublic`, `AddChannelMembership`
- `EmojiHelper` utility for emoji-to-shortcode conversion
- Heartbeat handling in `ServerDirectoryService` for connection health checks
- Four new EF Core migrations: `AddModerationRoles`, `AddChannelIsPublic`, `AddChannelMembership`, `AddMessageEmbed`
- `ChannelMembership` table with cascade delete on both channel and user removal
-22
View File
@@ -1,22 +0,0 @@
# v0.2.4 - Link Embeds
## Features
### OpenGraph Link Embeds
- Messages containing URLs now show a rich preview below the message text, similar to Discord
- Server-side fetching: detects the first URL in a message, fetches the page, and parses OpenGraph meta tags (`og:title`, `og:description`, `og:image`, `og:site_name`)
- OG images are converted to a small 24x12 colored ASCII thumbnail using the existing half-block renderer
- Embeds are persisted in the database and included in channel history
- TUI client renders embeds with a `▏` left border bar — site name and border in blue, title in white, description in gray, followed by the ASCII thumbnail
- IRC gateway receives a text-only embed preview (site name, title, description) — no ASCII thumbnail to keep IRC output clean
- Falls back to `<title>` tag when no OG tags are present; gracefully skips if no useful metadata is found
- 3-second fetch timeout ensures message delivery is never significantly delayed
- SSRF protection rejects private/loopback IP addresses before fetching
## Infrastructure
- New `LinkEmbedService` on the server — URL detection, HTML fetching (first 64KB), OG tag parsing via regex, image thumbnail generation
- `EmbedDto` record added to shared Core DTOs; `MessageDto` extended with optional `Embed` field (backward-compatible)
- `EmbedJson` nullable column on the `Message` table stores serialized embed data (max 8KB)
- Dedicated `"OgFetch"` named HttpClient with bot User-Agent header and 5-second timeout
- New EF Core migration: `AddMessageEmbed`