about summary refs log tree commit diff
path: root/ModerationClient/Services/MatrixAuthenticationService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ModerationClient/Services/MatrixAuthenticationService.cs')
-rw-r--r--ModerationClient/Services/MatrixAuthenticationService.cs12
1 files changed, 9 insertions, 3 deletions
diff --git a/ModerationClient/Services/MatrixAuthenticationService.cs b/ModerationClient/Services/MatrixAuthenticationService.cs

index 46ec067..e4fb99b 100644 --- a/ModerationClient/Services/MatrixAuthenticationService.cs +++ b/ModerationClient/Services/MatrixAuthenticationService.cs
@@ -28,6 +28,7 @@ public class MatrixAuthenticationService(ILogger<MatrixAuthenticationService> lo if (login is null) return; try { Homeserver = await hsProvider.GetAuthenticatedWithToken(login.Homeserver, login.AccessToken); + await Homeserver.UpdateProfilePropertyAsync("meow", "h"); IsLoggedIn = true; } catch (MatrixException e) { @@ -35,10 +36,15 @@ public class MatrixAuthenticationService(ILogger<MatrixAuthenticationService> lo } } - public async Task LoginAsync(string username, string password) { + public async Task LoginAsync(string username, string password, string? homeserver = null) { Directory.CreateDirectory(Util.ExpandPath($"{cfg.ProfileDirectory}")!); - var mxidParts = username.Split(':', 2); - var res = await hsProvider.Login(mxidParts[1], username, password); + + if (string.IsNullOrWhiteSpace(homeserver)) { + var mxidParts = username.Split(':', 2); + homeserver = mxidParts[1]; + } + + var res = await hsProvider.Login(homeserver, username, password); await File.WriteAllTextAsync(Path.Combine(cfg.ProfileDirectory, "login.json"), res.ToJson()); await LoadProfileAsync();