From 8130c84784cc4e696100fdda57c0d3b987ab4f80 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 9 Aug 2024 21:12:11 +0200 Subject: Minor cleanup --- LibMatrix/Services/HomeserverResolverService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'LibMatrix/Services/HomeserverResolverService.cs') diff --git a/LibMatrix/Services/HomeserverResolverService.cs b/LibMatrix/Services/HomeserverResolverService.cs index f899230..dc8e047 100644 --- a/LibMatrix/Services/HomeserverResolverService.cs +++ b/LibMatrix/Services/HomeserverResolverService.cs @@ -85,9 +85,9 @@ public class HomeserverResolverService { clientWellKnown ??= await _httpClient.TryGetFromJsonAsync($"http://{homeserver}/.well-known/matrix/client"); if (clientWellKnown is null) { - if (await _httpClient.CheckSuccessStatus($"https://{homeserver}/_matrix/client/versions")) + if (await MatrixHttpClient.CheckSuccessStatus($"https://{homeserver}/_matrix/client/versions")) return $"https://{homeserver}"; - if (await _httpClient.CheckSuccessStatus($"http://{homeserver}/_matrix/client/versions")) + if (await MatrixHttpClient.CheckSuccessStatus($"http://{homeserver}/_matrix/client/versions")) return $"http://{homeserver}"; } } @@ -122,16 +122,16 @@ public class HomeserverResolverService { var resolved = serverWellKnown.Homeserver; if (resolved.StartsWith("https://") || resolved.StartsWith("http://")) return resolved; - if (await _httpClient.CheckSuccessStatus($"https://{resolved}/_matrix/federation/v1/version")) + if (await MatrixHttpClient.CheckSuccessStatus($"https://{resolved}/_matrix/federation/v1/version")) return $"https://{resolved}"; - if (await _httpClient.CheckSuccessStatus($"http://{resolved}/_matrix/federation/v1/version")) + if (await MatrixHttpClient.CheckSuccessStatus($"http://{resolved}/_matrix/federation/v1/version")) return $"http://{resolved}"; _logger.LogWarning("Server well-known points to invalid server: {resolved}", resolved); } // fallback: most servers host C2S and S2S on the same domain var clientUrl = await _tryResolveClientEndpoint(homeserver); - if (clientUrl is not null && await _httpClient.CheckSuccessStatus($"{clientUrl}/_matrix/federation/v1/version")) + if (clientUrl is not null && await MatrixHttpClient.CheckSuccessStatus($"{clientUrl}/_matrix/federation/v1/version")) return clientUrl; _logger.LogInformation("No server well-known for {server}...", homeserver); -- cgit 1.5.1