about summary refs log tree commit diff
path: root/ModerationClient/ViewModels/LoginViewModel.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-03-10 07:41:43 +0100
committerRory& <root@rory.gay>2025-03-10 07:41:43 +0100
commit8838a3b20ba95bca34954b6ec828991adb028d4d (patch)
tree4fb6d6efdb04107e10daf8dc311894c3f6050b34 /ModerationClient/ViewModels/LoginViewModel.cs
parentChanges (diff)
downloadModerationClient-8838a3b20ba95bca34954b6ec828991adb028d4d.tar.xz
Various work
Diffstat (limited to '')
-rw-r--r--ModerationClient/ViewModels/LoginViewModel.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/ModerationClient/ViewModels/LoginViewModel.cs b/ModerationClient/ViewModels/LoginViewModel.cs

index 32f0d6e..34c8d28 100644 --- a/ModerationClient/ViewModels/LoginViewModel.cs +++ b/ModerationClient/ViewModels/LoginViewModel.cs
@@ -1,13 +1,15 @@ using System; using System.Threading.Tasks; +using LibMatrix.Services; using ModerationClient.Services; namespace ModerationClient.ViewModels; -public partial class LoginViewModel(MatrixAuthenticationService authService) : ViewModelBase +public partial class LoginViewModel(MatrixAuthenticationService authService, HomeserverResolverService hsResolver) : ViewModelBase { private Exception? _exception; public string Username { get; set; } + public string? Homeserver { get; set; } public string Password { get; set; } public Exception? Exception { @@ -15,6 +17,15 @@ public partial class LoginViewModel(MatrixAuthenticationService authService) : V private set => SetProperty(ref _exception, value); } + public async Task ResolveHomeserverAsync() { + try { + string[] parts = Username.Split(':', 2); + Homeserver = (await hsResolver.ResolveHomeserverFromWellKnown(Username, enableServer: false)).Client; + } catch (Exception e) { + Console.WriteLine(e); + } + } + public async Task LoginAsync() { try { Exception = null;