about summary refs log tree commit diff
path: root/ModerationClient/Services/MatrixAuthenticationService.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/Services/MatrixAuthenticationService.cs
parentChanges (diff)
downloadModerationClient-8838a3b20ba95bca34954b6ec828991adb028d4d.tar.xz
Various work
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();