Files
2026-02-24 22:08:54 +00:00

210 lines
12 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>v0.2.3 - Moderation, Embeds &amp; UI Overhaul | EchoHub Documentation </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="v0.2.3 - Moderation, Embeds &amp; UI Overhaul | EchoHub Documentation ">
<link rel="icon" href="../images/hue_icon.svg">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="docfx:docurl" content="https://github.com/HueByte/EchoHub/blob/master/docs/#L1">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../images/hue_icon.svg" alt="EchoHub">
EchoHub
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="">
<h1 id="v023---moderation-embeds--ui-overhaul">v0.2.3 - Moderation, Embeds &amp; UI Overhaul</h1>
<h2 id="features">Features</h2>
<h3 id="moderation-system">Moderation System</h3>
<ul>
<li>Added server roles: Owner, Admin, Mod, Member — first registered user is automatically Owner</li>
<li>New <code>/kick</code>, <code>/ban</code>, <code>/unban</code>, <code>/mute</code>, <code>/unmute</code>, <code>/role</code>, <code>/nuke</code> commands for moderators and admins</li>
<li><code>ModerationController</code> with full REST API for role assignment, kicks, bans, mutes, message deletion, and channel nuking</li>
<li>Mutes support optional duration (auto-expire) and blocked users cannot log in</li>
<li>Role claim included in JWT tokens; role badges shown in the online users panel</li>
<li>Kicked and banned users are forcibly disconnected in real time — server cleans up presence, broadcasts departures, and signals client disconnect</li>
<li>Works for both SignalR and IRC connections; client shows an error dialog with the reason</li>
</ul>
<h3 id="private-channels">Private Channels</h3>
<ul>
<li>Channels can be created as public or private via a checkbox in the Create Channel dialog</li>
<li>Public channels are visible to all users; private channels only appear for members who joined them</li>
<li>Persistent channel membership tracked in the database (<code>ChannelMembership</code> table)</li>
<li><code>GET /api/channels</code> returns the combined list: public channels + user's joined private channels</li>
<li>Channel creators are automatically added as members</li>
</ul>
<h3 id="opengraph-link-embeds">OpenGraph Link Embeds</h3>
<ul>
<li>Messages containing URLs now show a rich preview below the message text</li>
<li>Multiple URLs per message supported (up to 3) — each gets its own embed</li>
<li>Server-side fetching: detects URLs in a message, fetches each page, and parses OpenGraph meta tags (<code>og:title</code>, <code>og:description</code>, <code>og:site_name</code>)</li>
<li>Embeds are persisted in the database as a JSON array and included in channel history</li>
<li>TUI client renders embeds with a <code></code> left border bar — site name and border in blue, title in white, description in gray; text word-wraps at actual viewport width</li>
<li>IRC gateway receives a text-only embed preview (site name, title, description)</li>
<li>Falls back to <code>&lt;title&gt;</code> tag when no OG tags are present; gracefully skips if no useful metadata is found</li>
<li>5-second fetch timeout ensures message delivery is never significantly delayed</li>
<li>SSRF protection rejects private/loopback IP addresses before fetching</li>
</ul>
<h3 id="notification-sounds">Notification Sounds</h3>
<ul>
<li>Incoming messages play a notification sound when the terminal is not focused</li>
<li>Embedded MP3 asset with cross-platform playback support</li>
</ul>
<h3 id="online-users-panel">Online Users Panel</h3>
<ul>
<li>Collapsible right-side panel showing online users in the current channel (toggle with F2)</li>
<li>Users displayed with status indicators, role badges, and their custom nickname colors</li>
<li>Panel updates on join, leave, and status change events</li>
</ul>
<h3 id="-highlighting">@mention Highlighting</h3>
<ul>
<li><code>@username</code> text rendered in orange accent color in all messages</li>
<li>Messages mentioning the current user get a full-line amber background highlight</li>
<li>Works across multi-line messages and continuation lines</li>
</ul>
<h3 id="ascii-art-improvements">ASCII Art Improvements</h3>
<ul>
<li>Half-block character rendering (<code></code>/<code></code>) with separate foreground + background colors for 2x vertical resolution</li>
<li>Switched from ANSI escape codes to printable color tags (<code>{F:RRGGBB}</code>, <code>{B:RRGGBB}</code>, <code>{X}</code>) — no control bytes in stored content</li>
<li>Optional size parameter for <code>/send</code> command: <code>-s</code> (40x40), <code>-m</code> (80x80, default), <code>-l</code> (120x120)</li>
<li>IRC gateway converts color tags back to ANSI for IRC client compatibility</li>
</ul>
<h3 id="client-ui">Client UI</h3>
<ul>
<li>Version number shown in the status bar</li>
<li>Custom colored rendering for channel list (active indicator, unread count badges)</li>
<li>Avatar upload field added to the profile edit dialog (file path or URL)</li>
<li>Profile avatar now renders with full color tag support in the profile view dialog</li>
<li>Update check notification on connect — shows a system message if a newer GitHub release exists</li>
<li>Chat messages no longer show selection/focus highlight</li>
<li>Exit shortcut changed from Ctrl+C to Alt+Q — frees Ctrl+C for copy</li>
<li>Default history increased from 50 to 100 messages on channel join</li>
</ul>
<h2 id="fixes">Fixes</h2>
<ul>
<li>Fixed <code>#general</code> channel not visible after adding the <code>IsPublic</code> column — migration default changed to <code>true</code> and startup service ensures it</li>
<li>Fixed channels disappearing when creating a new channel — replaced full re-fetch with incremental updates</li>
<li>Wired <code>OnChannelUpdated</code> SignalR event so new public channels appear for all connected users in real time</li>
<li>Fixed color tag parser using wrong regex group numbers (6,7,8 instead of 1,2,3) — new ASCII art was rendering without colors</li>
<li>Full Unicode/emoji support — renderers use Terminal.Gui v2 grapheme cluster API (<code>GraphemeHelper</code>, <code>AddStr</code>) for proper wide character handling</li>
<li>Emoji-to-text shortcode conversion for consistent cross-platform rendering</li>
<li>Fixed <code>/send</code> and <code>/avatar</code> commands not handling file paths with spaces correctly, even when quoted</li>
<li>Server-side newline spam protection — consecutive blank/whitespace-only lines collapsed to 1 and total lines capped at 30</li>
<li>Fixed OG tag regex truncating descriptions containing apostrophes (e.g. <code>&quot;HueByte's portfolio&quot;</code> was cut to <code>&quot;HueByte&quot;</code>) — switched to backreference-based quote pairing</li>
</ul>
<h2 id="infrastructure">Infrastructure</h2>
<ul>
<li>New <code>LinkEmbedService</code> on the server — URL detection, HTML fetching (first 64KB), OG tag parsing via compiled regex</li>
<li><code>EmbedDto</code> record added to shared Core DTOs; <code>MessageDto.Embeds</code> list for multiple embeds per message</li>
<li><code>EmbedJson</code> nullable column on the <code>Message</code> table stores serialized embed data as JSON array (max 8KB); <code>DataMigrationService</code> auto-migrates old single-object format</li>
<li>Dedicated <code>&quot;OgFetch&quot;</code> named HttpClient with bot User-Agent header and 5-second timeout</li>
<li><code>PresenceTracker.ForceRemoveUser()</code> for atomic user cleanup on kick/ban</li>
<li><code>IChatBroadcaster.ForceDisconnectUserAsync()</code> and <code>IEchoHubClient.ForceDisconnect</code> for force-disconnect signaling</li>
<li><code>NotificationSoundService</code> for cross-platform audio playback of embedded notification sounds</li>
<li>Startup <code>DataMigrationService</code> automatically converts old ANSI-format messages to the new color tag format on server boot, logging the count of migrated records</li>
<li><code>EmojiHelper</code> utility for emoji-to-shortcode conversion</li>
<li>Heartbeat handling in <code>ServerDirectoryService</code> for connection health checks</li>
<li>Four new EF Core migrations: <code>AddModerationRoles</code>, <code>AddChannelIsPublic</code>, <code>AddChannelMembership</code>, <code>AddMessageEmbed</code></li>
<li><code>ChannelMembership</code> table with cascade delete on both channel and user removal</li>
</ul>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/HueByte/EchoHub/blob/master/docs/#L1" class="edit-link">Edit this page</a>
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<div class='footer-custom'><div class='footer-inner'><span class='footer-brand'>EchoHub</span><span class='footer-sep'>&middot;</span><a href='https://github.com/HueByte/EchoHub'>GitHub</a><span class='footer-sep'>&middot;</span><a href='https://echohub.voidcube.cloud'>Website</a></div></div>
</div>
</div>
</footer>
</body>
</html>