mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
Server: - Add Let's Encrypt (ACME) TLS mode with autocert, HTTP-01 challenges on :80, and automatic certificate renewal (tls.mode: "acme" in config.yaml) - Add ASCII art startup banner with server info and endpoint URLs - Fix CSP blocking admin panel inline styles/scripts (per-route override) - Suppress TLS handshake error noise in console output - Fix TOCTOU race in invite consumption (atomic UPDATE with row-count check) - Fix sendMsg mutex race condition (hold lock for entire send) - Fix permission override formula (deny-first, allow-wins) - Fix voice join parsing channelID before permission check - Add session expiry check at WebSocket auth and periodic revalidation - Add message length limit (4000 chars) and emoji length validation (32 bytes) - Add file size enforcement in storage after io.Copy - Add checksum URL validation in updater - Add backup path traversal protection (BackupToSafe) - Add self-modification guard in admin handlePatchUser - Fix admin ownerOnlyMiddleware to use context user instead of re-auth - Remove redundant startup log lines (banner shows same info) - Add periodic expired session cleanup (15-min ticker) - Add permissions package with bitfield constants and EffectivePerms - Add rate limiter cleanup goroutine to prevent unbounded growth - Add auth helpers (IsEffectivelyBanned, IsSessionExpired) - Add WebSocket origin validation Client: - Add TOFU certificate trust service - Add receive loop error handling - Fix redundant else-if in OnChatMessage
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using OwnCord.Client.Services;
|
|
using OwnCord.Client.ViewModels;
|
|
using OwnCord.Client.Views;
|
|
|
|
namespace OwnCord.Client;
|
|
|
|
public partial class App : Application
|
|
{
|
|
private void Application_Startup(object sender, StartupEventArgs e)
|
|
{
|
|
var dataDir = Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
|
"OwnCord");
|
|
|
|
var profileService = new ProfileService(dataDir);
|
|
var credentialService = new CredentialService();
|
|
var trustService = new CertificateTrustService();
|
|
var wsService = new WebSocketService(trustService);
|
|
var apiClient = ApiClient.CreateWithTofuTls(trustService);
|
|
var chatService = new ChatService(apiClient, wsService);
|
|
|
|
var connectVm = new ConnectViewModel(profileService, credentialService);
|
|
var mainVm = new MainViewModel();
|
|
|
|
var mainWindow = new MainWindow(connectVm, mainVm, chatService);
|
|
mainWindow.Show();
|
|
|
|
// Clean up old binary from previous update
|
|
var updateService = new UpdateService();
|
|
updateService.CleanupOldVersion();
|
|
|
|
// Check for updates (non-blocking)
|
|
_ = Task.Run(async () =>
|
|
{
|
|
var info = await updateService.CheckForUpdateAsync();
|
|
if (info?.UpdateAvailable == true)
|
|
{
|
|
await Current.Dispatcher.InvokeAsync(() =>
|
|
{
|
|
var vm = new UpdateViewModel(updateService, info);
|
|
var dialog = new UpdateDialog(vm);
|
|
dialog.ShowDialog();
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|