mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
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:
@@ -1,56 +1,56 @@
|
||||
using EchoHub.Client;
|
||||
using EchoHub.Client.Config;
|
||||
using EchoHub.Client.Themes;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using Terminal.Gui.App;
|
||||
|
||||
var appSettingsPath = Path.Combine(AppContext.BaseDirectory, "appsettings.json");
|
||||
if (!File.Exists(appSettingsPath))
|
||||
{
|
||||
using var stream = typeof(AppOrchestrator).Assembly
|
||||
.GetManifestResourceStream("EchoHub.Client.appsettings.example.json");
|
||||
|
||||
if (stream is not null)
|
||||
{
|
||||
using var file = File.Create(appSettingsPath);
|
||||
stream.CopyTo(file);
|
||||
}
|
||||
}
|
||||
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(AppContext.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||
.Build();
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.CreateLogger();
|
||||
|
||||
Log.Information("EchoHub client starting");
|
||||
|
||||
try
|
||||
{
|
||||
var config = ConfigManager.Load();
|
||||
Log.Information("Configuration loaded, active theme: {Theme}", config.ActiveTheme);
|
||||
|
||||
var app = Application.Create().Init();
|
||||
|
||||
var theme = ThemeManager.GetTheme(config.ActiveTheme);
|
||||
ThemeManager.ApplyTheme(theme);
|
||||
|
||||
using var orchestrator = new AppOrchestrator(app, config);
|
||||
|
||||
app.Run(orchestrator.MainWindow);
|
||||
app.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "EchoHub client crashed");
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.Information("EchoHub client shutting down");
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
using EchoHub.Client;
|
||||
using EchoHub.Client.Config;
|
||||
using EchoHub.Client.Themes;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using Terminal.Gui.App;
|
||||
|
||||
var appSettingsPath = Path.Combine(AppContext.BaseDirectory, "appsettings.json");
|
||||
if (!File.Exists(appSettingsPath))
|
||||
{
|
||||
using var stream = typeof(AppOrchestrator).Assembly
|
||||
.GetManifestResourceStream("EchoHub.Client.appsettings.example.json");
|
||||
|
||||
if (stream is not null)
|
||||
{
|
||||
using var file = File.Create(appSettingsPath);
|
||||
stream.CopyTo(file);
|
||||
}
|
||||
}
|
||||
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(AppContext.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||
.Build();
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.CreateLogger();
|
||||
|
||||
Log.Information("EchoHub client starting");
|
||||
|
||||
try
|
||||
{
|
||||
var config = ConfigManager.Load();
|
||||
Log.Information("Configuration loaded, active theme: {Theme}", config.ActiveTheme);
|
||||
|
||||
var app = Application.Create().Init();
|
||||
|
||||
var theme = ThemeManager.GetTheme(config.ActiveTheme);
|
||||
ThemeManager.ApplyTheme(theme);
|
||||
|
||||
using var orchestrator = new AppOrchestrator(app, config);
|
||||
|
||||
app.Run(orchestrator.MainWindow);
|
||||
app.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "EchoHub client crashed");
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.Information("EchoHub client shutting down");
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user