From 3ed00f732a284b5a3e96e52d4e3a71869135869b Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 26 Jun 2023 02:43:54 +0200 Subject: Dependency injection stuff --- MatrixRoomUtils.Core/Authentication/MatrixAuth.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'MatrixRoomUtils.Core/Authentication') diff --git a/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs b/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs index 83b279a..b1b0362 100644 --- a/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs +++ b/MatrixRoomUtils.Core/Authentication/MatrixAuth.cs @@ -10,7 +10,7 @@ public class MatrixAuth { public static async Task Login(string homeserver, string username, string password) { Console.WriteLine($"Logging in to {homeserver} as {username}..."); homeserver = (await new RemoteHomeServer(homeserver).Configure()).FullHomeServerDomain; - var hc = new HttpClient(); + var hc = new MatrixHttpClient(); var payload = new { type = "m.login.password", identifier = new { @@ -25,11 +25,6 @@ public class MatrixAuth { Console.WriteLine($"Login: {resp.StatusCode}"); var data = await resp.Content.ReadFromJsonAsync(); if (!resp.IsSuccessStatusCode) Console.WriteLine("Login: " + data); - if (data.TryGetProperty("retry_after_ms", out var retryAfter)) { - Console.WriteLine($"Login: Waiting {retryAfter.GetInt32()}ms before retrying"); - await Task.Delay(retryAfter.GetInt32()); - return await Login(homeserver, username, password); - } Console.WriteLine($"Login: {data.ToJson()}"); return data.Deserialize(); -- cgit 1.5.1