Refactor and update various components of EchoHub.Server

- Updated launchSettings.json for consistency.
- Refactored FileValidationHelper to improve image validation logic.
- Enhanced ServerDirectoryService for better connection handling and user count updates.
- Improved DatabaseSetup for legacy database handling and seeding default channels.
- Refined FirstRunSetup to ensure JWT secret generation.
- Removed appsettings.Development.json as it is no longer needed.
- Updated EchoHub.Tests project file for consistency.
- Added unit tests for FileValidationHelper and PresenceTracker with improved assertions.
- Updated ValidationConstantsTests to ensure regex validations are correct.
- Cleaned up solution file formatting for better readability.
This commit is contained in:
HueByte
2026-02-19 10:12:28 +01:00
parent 32e01e8d71
commit 9975f4e4be
57 changed files with 4401 additions and 4378 deletions
+17 -17
View File
@@ -1,17 +1,17 @@
# API Reference
Browse the generated API documentation for each EchoHub project.
## Projects
### Client
Terminal.Gui v2 TUI application -- UI components, services, themes, and configuration.
### Core
Shared library -- DTOs, models, constants, and the SignalR client contract.
### Server
ASP.NET Core server -- controllers, hubs, authentication, and data access.
# API Reference
Browse the generated API documentation for each EchoHub project.
## Projects
### Client
Terminal.Gui v2 TUI application -- UI components, services, themes, and configuration.
### Core
Shared library -- DTOs, models, constants, and the SignalR client contract.
### Server
ASP.NET Core server -- controllers, hubs, authentication, and data access.
+18 -18
View File
@@ -1,18 +1,18 @@
- name: Client
items:
- name: API Reference
href: ../_api_meta/client/toc.yml
- name: Articles
href: client-articles/
- name: Core
items:
- name: API Reference
href: ../_api_meta/core/toc.yml
- name: Articles
href: core-articles/
- name: Server
items:
- name: API Reference
href: ../_api_meta/server/toc.yml
- name: Articles
href: server-articles/
- name: Client
items:
- name: API Reference
href: ../_api_meta/client/toc.yml
- name: Articles
href: client-articles/
- name: Core
items:
- name: API Reference
href: ../_api_meta/core/toc.yml
- name: Articles
href: core-articles/
- name: Server
items:
- name: API Reference
href: ../_api_meta/server/toc.yml
- name: Articles
href: server-articles/
+41 -41
View File
@@ -1,41 +1,41 @@
# Architecture
## Overview
EchoHub follows a decentralized model where each server is fully independent. There is no central authority or account federation. Users create one account per server.
## Components
### EchoHub.Core
Shared library containing:
- **Models**: `User`, `Channel`, `Message`, `RefreshToken`
- **DTOs**: Record types for API requests/responses
- **Contracts**: `IEchoHubClient` -- the strongly-typed SignalR client interface
- **Constants**: `ValidationConstants` (shared regex patterns), `HubConstants`
### EchoHub.Server
ASP.NET Core web application:
- **Controllers**: REST API endpoints for auth, channels, users, files, server info
- **Hubs**: SignalR `ChatHub` for real-time messaging
- **Auth**: JWT token service (15-min access tokens, 30-day refresh tokens)
- **Data**: EF Core with SQLite
- **Services**: Presence tracking, file storage, image-to-ASCII conversion
### EchoHub.Client
Terminal.Gui v2 TUI application:
- **UI**: Main window, dialogs, chat renderer with ANSI color support
- **Services**: API client with automatic token refresh, SignalR connection wrapper
- **Themes**: 6 built-in color themes
- **Config**: Client configuration management
## Communication
- REST API for authentication, profile management, channel CRUD, file uploads
- SignalR WebSocket for real-time messaging and presence updates
- JWT tokens passed via query string for SignalR authentication
# Architecture
## Overview
EchoHub follows a decentralized model where each server is fully independent. There is no central authority or account federation. Users create one account per server.
## Components
### EchoHub.Core
Shared library containing:
- **Models**: `User`, `Channel`, `Message`, `RefreshToken`
- **DTOs**: Record types for API requests/responses
- **Contracts**: `IEchoHubClient` -- the strongly-typed SignalR client interface
- **Constants**: `ValidationConstants` (shared regex patterns), `HubConstants`
### EchoHub.Server
ASP.NET Core web application:
- **Controllers**: REST API endpoints for auth, channels, users, files, server info
- **Hubs**: SignalR `ChatHub` for real-time messaging
- **Auth**: JWT token service (15-min access tokens, 30-day refresh tokens)
- **Data**: EF Core with SQLite
- **Services**: Presence tracking, file storage, image-to-ASCII conversion
### EchoHub.Client
Terminal.Gui v2 TUI application:
- **UI**: Main window, dialogs, chat renderer with ANSI color support
- **Services**: API client with automatic token refresh, SignalR connection wrapper
- **Themes**: 6 built-in color themes
- **Config**: Client configuration management
## Communication
- REST API for authentication, profile management, channel CRUD, file uploads
- SignalR WebSocket for real-time messaging and presence updates
- JWT tokens passed via query string for SignalR authentication
+31 -31
View File
@@ -1,31 +1,31 @@
# Getting Started
## Prerequisites
- [.NET 10 SDK](https://dotnet.microsoft.com/download)
## Run the Server
```bash
dotnet run --project src/EchoHub.Server
```
On first run, the server automatically:
1. Creates `appsettings.json` from the example config
2. Generates a secure JWT secret
3. Creates the SQLite database with a `#general` channel
## Run the Client
```bash
dotnet run --project src/EchoHub.Client
```
Connect to a server, register an account, and start chatting.
## Build from Source
```bash
dotnet build src/EchoHub.slnx
```
# Getting Started
## Prerequisites
- [.NET 10 SDK](https://dotnet.microsoft.com/download)
## Run the Server
```bash
dotnet run --project src/EchoHub.Server
```
On first run, the server automatically:
1. Creates `appsettings.json` from the example config
2. Generates a secure JWT secret
3. Creates the SQLite database with a `#general` channel
## Run the Client
```bash
dotnet run --project src/EchoHub.Client
```
Connect to a server, register an account, and start chatting.
## Build from Source
```bash
dotnet build src/EchoHub.slnx
```
+4 -4
View File
@@ -1,4 +1,4 @@
- name: Getting Started
href: getting-started.md
- name: Architecture
href: architecture.md
- name: Getting Started
href: getting-started.md
- name: Architecture
href: architecture.md
+4 -4
View File
@@ -1,4 +1,4 @@
- name: Overview
href: index.md
- name: v0.1.0
href: v0.1.0.md
- name: Overview
href: index.md
- name: v0.1.0
href: v0.1.0.md
+13 -13
View File
@@ -1,13 +1,13 @@
# v0.1.0 - Initial Release
## Features
- Real-time messaging via SignalR
- JWT authentication with access and refresh tokens
- Channel management (create, set topic, delete)
- File and image uploads with magic-byte validation
- Image-to-ASCII conversion for terminal display
- Presence tracking (online, away, DND, invisible)
- 6 built-in TUI themes
- Rate limiting on auth, upload, and general endpoints
- Self-contained binary releases for Windows, Linux, and macOS
# v0.1.0 - Initial Release
## Features
- Real-time messaging via SignalR
- JWT authentication with access and refresh tokens
- Channel management (create, set topic, delete)
- File and image uploads with magic-byte validation
- Image-to-ASCII conversion for terminal display
- Presence tracking (online, away, DND, invisible)
- 6 built-in TUI themes
- Rate limiting on auth, upload, and general endpoints
- Self-contained binary releases for Windows, Linux, and macOS
+83 -83
View File
@@ -1,83 +1,83 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json",
"metadata": [
{
"src": [
{
"src": "../src/EchoHub.Core/bin/Release/net10.0",
"files": ["EchoHub.Core.dll"]
}
],
"dest": "_api_meta/core",
"filter": "filterConfig.yml"
},
{
"src": [
{
"src": "../src/EchoHub.Server/bin/Release/net10.0",
"files": ["EchoHub.Server.dll"]
}
],
"dest": "_api_meta/server",
"filter": "filterConfig.yml"
},
{
"src": [
{
"src": "../src/EchoHub.Client/bin/Release/net10.0",
"files": ["EchoHub.Client.dll"]
}
],
"dest": "_api_meta/client",
"filter": "filterConfig.yml"
}
],
"build": {
"content": [
{
"files": ["**/*.{md,yml}"],
"exclude": ["_site/**", "_api_meta/**"]
},
{
"src": "_api_meta/core",
"dest": "api/core",
"files": ["*.yml"],
"exclude": ["toc.yml"]
},
{
"src": "_api_meta/server",
"dest": "api/server",
"files": ["*.yml"],
"exclude": ["toc.yml"]
},
{
"src": "_api_meta/client",
"dest": "api/client",
"files": ["*.yml"],
"exclude": ["toc.yml"]
}
],
"resource": [
{
"files": ["images/**"]
}
],
"output": "_site",
"template": ["default", "modern", "templates/echohub"],
"globalMetadata": {
"_appName": "EchoHub",
"_appTitle": "EchoHub Documentation",
"_appLogoPath": "images/hue_icon.svg",
"_appFaviconPath": "images/hue_icon.svg",
"_appFooter": "<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><span class='footer-sep'>&middot;</span><span class='footer-credit'>Built with <a href='https://dotnet.github.io/docfx'>DocFX</a></span></div></div>",
"_enableSearch": true,
"_disableContribution": false,
"_gitContribute": {
"repo": "https://github.com/HueByte/EchoHub",
"branch": "master",
"path": "docs"
}
},
"markdownEngineName": "markdig"
}
}
{
"$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json",
"metadata": [
{
"src": [
{
"src": "../src/EchoHub.Core/bin/Release/net10.0",
"files": ["EchoHub.Core.dll"]
}
],
"dest": "_api_meta/core",
"filter": "filterConfig.yml"
},
{
"src": [
{
"src": "../src/EchoHub.Server/bin/Release/net10.0",
"files": ["EchoHub.Server.dll"]
}
],
"dest": "_api_meta/server",
"filter": "filterConfig.yml"
},
{
"src": [
{
"src": "../src/EchoHub.Client/bin/Release/net10.0",
"files": ["EchoHub.Client.dll"]
}
],
"dest": "_api_meta/client",
"filter": "filterConfig.yml"
}
],
"build": {
"content": [
{
"files": ["**/*.{md,yml}"],
"exclude": ["_site/**", "_api_meta/**"]
},
{
"src": "_api_meta/core",
"dest": "api/core",
"files": ["*.yml"],
"exclude": ["toc.yml"]
},
{
"src": "_api_meta/server",
"dest": "api/server",
"files": ["*.yml"],
"exclude": ["toc.yml"]
},
{
"src": "_api_meta/client",
"dest": "api/client",
"files": ["*.yml"],
"exclude": ["toc.yml"]
}
],
"resource": [
{
"files": ["images/**"]
}
],
"output": "_site",
"template": ["default", "modern", "templates/echohub"],
"globalMetadata": {
"_appName": "EchoHub",
"_appTitle": "EchoHub Documentation",
"_appLogoPath": "images/hue_icon.svg",
"_appFaviconPath": "images/hue_icon.svg",
"_appFooter": "<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><span class='footer-sep'>&middot;</span><span class='footer-credit'>Built with <a href='https://dotnet.github.io/docfx'>DocFX</a></span></div></div>",
"_enableSearch": true,
"_disableContribution": false,
"_gitContribute": {
"repo": "https://github.com/HueByte/EchoHub",
"branch": "master",
"path": "docs"
}
},
"markdownEngineName": "markdig"
}
}
+14 -14
View File
@@ -1,14 +1,14 @@
---
_layout: landing
---
# EchoHub Documentation
Welcome to the EchoHub documentation. EchoHub is a decentralized, IRC-like chat application built with .NET 10 and SignalR.
## Quick Links
- [Getting Started](articles/getting-started.md) - Set up and run EchoHub
- [Architecture](articles/architecture.md) - Understand the system design
- [API Reference](api/index.md) - Generated C# API documentation
- [Changelog](changelog/index.md) - Release history
---
_layout: landing
---
# EchoHub Documentation
Welcome to the EchoHub documentation. EchoHub is a decentralized, IRC-like chat application built with .NET 10 and SignalR.
## Quick Links
- [Getting Started](articles/getting-started.md) - Set up and run EchoHub
- [Architecture](articles/architecture.md) - Understand the system design
- [API Reference](api/index.md) - Generated C# API documentation
- [Changelog](changelog/index.md) - Release history
+9 -9
View File
@@ -1,9 +1,9 @@
- name: Articles
href: articles/
homepage: articles/getting-started.md
- name: Changelog
href: changelog/
homepage: changelog/index.md
- name: API
href: api/
homepage: api/index.md
- name: Articles
href: articles/
homepage: articles/getting-started.md
- name: Changelog
href: changelog/
homepage: changelog/index.md
- name: API
href: api/
homepage: api/index.md