mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 16:46:08 +02:00
191 lines
7.7 KiB
HTML
191 lines
7.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Media & Services | EchoHub Documentation </title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="title" content="Media & Services | 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="../articles/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 "{query}"">
|
|
<meta name="loc:searchNoResults" content="No results for "{query}"">
|
|
<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="media--services">Media & Services</h1>
|
|
|
|
<h2 id="file-upload">File Upload</h2>
|
|
<p>Files are uploaded via REST, validated by magic bytes, stored with GUID filenames,
|
|
and broadcast as a message with a download link.</p>
|
|
<pre><code class="lang-mermaid">sequenceDiagram
|
|
participant Client as Client
|
|
participant CC as ChannelsController
|
|
participant FV as FileValidationHelper
|
|
participant FS as FileStorageService
|
|
participant CS as ChatService
|
|
participant DB as SQLite
|
|
|
|
Client->>CC: POST /api/channels/{channel}/upload (multipart)
|
|
CC->>CC: Check file size limits
|
|
CC->>FV: IsValidImage(stream) — magic byte check
|
|
FV->>FV: Read header: JPEG(FFD8FF) / PNG(89504E47) / GIF / WebP(RIFF+WEBP)
|
|
FV-->>CC: true/false
|
|
CC->>FS: SaveFileAsync(stream, extension)
|
|
FS->>FS: Generate GUID filename, write to uploads/
|
|
FS-->>CC: fileId (GUID)
|
|
CC->>CC: Determine MessageType (Image/Audio/File)
|
|
CC->>CS: SendMessageAsync (with file URL + optional ASCII art)
|
|
CS->>DB: INSERT Message
|
|
CS->>CS: BroadcastToAllAsync → fan out to clients
|
|
</code></pre>
|
|
<hr>
|
|
<h2 id="link-embed-resolution">Link Embed Resolution</h2>
|
|
<p>When a message contains URLs, the server fetches OpenGraph metadata for preview
|
|
embeds.</p>
|
|
<pre><code class="lang-mermaid">sequenceDiagram
|
|
participant CS as ChatService
|
|
participant LE as LinkEmbedService
|
|
participant Web as External Website
|
|
|
|
CS->>LE: TryGetEmbedsAsync(messageContent)
|
|
LE->>LE: Extract URLs via regex
|
|
LE->>LE: Filter: max URLs per message, skip duplicates
|
|
|
|
loop For each URL
|
|
LE->>LE: Validate: http(s) only, block private IPs
|
|
LE->>Web: GET URL (timeout + size limit)
|
|
Web-->>LE: HTML response
|
|
LE->>LE: Parse og:title, og:description, og:site_name
|
|
LE->>LE: Parse theme-color meta tag
|
|
LE->>LE: Fallback to <title> if no og:title
|
|
end
|
|
|
|
LE-->>CS: List<EmbedDto> (or null)
|
|
Note over CS: Attached to MessageDto before broadcast
|
|
</code></pre>
|
|
<hr>
|
|
<h2 id="server-directory-registration">Server Directory Registration</h2>
|
|
<p>Public servers register with the EchoHubSpace directory for discoverability.</p>
|
|
<pre><code class="lang-mermaid">sequenceDiagram
|
|
participant SDS as ServerDirectoryService
|
|
participant Dir as EchoHubSpace Directory
|
|
participant PT as PresenceTracker
|
|
|
|
SDS->>SDS: Check Server:PublicServer config
|
|
SDS->>Dir: SignalR connect (echohub.voidcube.cloud/hubs/servers)
|
|
SDS->>Dir: RegisterServer(name, description, host, userCount)
|
|
Dir-->>SDS: Registered
|
|
|
|
loop Every 30 seconds
|
|
SDS->>PT: Get online user count
|
|
alt Count changed
|
|
SDS->>Dir: UpdateUserCount(count)
|
|
end
|
|
end
|
|
|
|
Dir->>SDS: Ping
|
|
SDS->>Dir: Heartbeat
|
|
|
|
Note over SDS,Dir: Exponential backoff on disconnect (2s → 30s max)
|
|
</code></pre>
|
|
|
|
</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'>·</span><a href='https://github.com/HueByte/EchoHub'>GitHub</a><span class='footer-sep'>·</span><a href='https://echohub.voidcube.cloud'>Website</a></div></div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|