diff options
author | Emma [it/its]@Rory& <root@rory.gay> | 2024-02-09 16:32:46 +0100 |
---|---|---|
committer | Emma [it/its]@Rory& <root@rory.gay> | 2024-02-09 16:32:46 +0100 |
commit | 4ef9ae4b396b0eb37036d4008e8cb40e468dbe73 (patch) | |
tree | 6bb4d25754fefc52333a5fc44dd721c333314240 /LibMatrix/Homeservers/RemoteHomeServer.cs | |
parent | Consistently use EventId for event types (diff) | |
download | LibMatrix-4ef9ae4b396b0eb37036d4008e8cb40e468dbe73.tar.xz |
Apply syntax style to LibMatrix
Diffstat (limited to '')
-rw-r--r-- | LibMatrix/Homeservers/RemoteHomeServer.cs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/LibMatrix/Homeservers/RemoteHomeServer.cs b/LibMatrix/Homeservers/RemoteHomeServer.cs index f47dc4d..5c7d254 100644 --- a/LibMatrix/Homeservers/RemoteHomeServer.cs +++ b/LibMatrix/Homeservers/RemoteHomeServer.cs @@ -26,23 +26,21 @@ public class RemoteHomeserver(string baseUrl) { proxy = null; var homeserver = new RemoteHomeserver(baseUrl); homeserver.WellKnownUris = await new HomeserverResolverService().ResolveHomeserverFromWellKnown(baseUrl); - if(string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Client)) + if (string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Client)) Console.WriteLine($"Failed to resolve homeserver client URI for {baseUrl}"); - if(string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Server)) + if (string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Server)) Console.WriteLine($"Failed to resolve homeserver server URI for {baseUrl}"); - - Console.WriteLine(homeserver.WellKnownUris.ToJson(ignoreNull:false)); - - homeserver.ClientHttpClient = new() { + + Console.WriteLine(homeserver.WellKnownUris.ToJson(ignoreNull: false)); + + homeserver.ClientHttpClient = new MatrixHttpClient { BaseAddress = new Uri(proxy ?? homeserver.WellKnownUris.Client ?? throw new InvalidOperationException($"Failed to resolve homeserver client URI for {baseUrl}")), Timeout = TimeSpan.FromSeconds(120) }; - + homeserver.FederationClient = await FederationClient.TryCreate(baseUrl, proxy); - if (proxy is not null) { - homeserver.ClientHttpClient.DefaultRequestHeaders.Add("MXAE_UPSTREAM", baseUrl); - } + if (proxy is not null) homeserver.ClientHttpClient.DefaultRequestHeaders.Add("MXAE_UPSTREAM", baseUrl); return homeserver; } |