From cb719c315e225ba97e32b2dca7d9b184755234cc Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 27 Oct 2023 14:21:15 +0200 Subject: Update --- MxApiExtensions/Controllers/GenericProxyController.cs | 6 +++--- MxApiExtensions/Controllers/LoginController.cs | 2 +- MxApiExtensions/Controllers/SyncController.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/MxApiExtensions/Controllers/GenericProxyController.cs b/MxApiExtensions/Controllers/GenericProxyController.cs index 3481914..c004fcb 100644 --- a/MxApiExtensions/Controllers/GenericProxyController.cs +++ b/MxApiExtensions/Controllers/GenericProxyController.cs @@ -37,7 +37,7 @@ public class GenericController : ControllerBase { .Replace($"access_token={access_token}", "") ); - var resp = await hs._httpClient.GetAsync($"{Request.Path}{Request.QueryString}"); + var resp = await hs.ClientHttpClient.GetAsync($"{Request.Path}{Request.QueryString}"); if (resp.Content is null) { throw new MxApiMatrixException { @@ -91,7 +91,7 @@ public class GenericController : ControllerBase { .Replace($"access_token={access_token}", "") ); - var resp = await hs._httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Post, $"{Request.Path}{Request.QueryString}") { + var resp = await hs.ClientHttpClient.SendAsync(new HttpRequestMessage(HttpMethod.Post, $"{Request.Path}{Request.QueryString}") { Method = HttpMethod.Post, Content = new StreamContent(Request.Body) }); @@ -148,7 +148,7 @@ public class GenericController : ControllerBase { .Replace($"access_token={access_token}", "") ); - var resp = await hs._httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Put, $"{Request.Path}{Request.QueryString}") { + var resp = await hs.ClientHttpClient.SendAsync(new HttpRequestMessage(HttpMethod.Put, $"{Request.Path}{Request.QueryString}") { Method = HttpMethod.Put, Content = new StreamContent(Request.Body) }); diff --git a/MxApiExtensions/Controllers/LoginController.cs b/MxApiExtensions/Controllers/LoginController.cs index 1ad3247..bd354ef 100644 --- a/MxApiExtensions/Controllers/LoginController.cs +++ b/MxApiExtensions/Controllers/LoginController.cs @@ -43,7 +43,7 @@ public class LoginController : ControllerBase { if(!request.Identifier.User.StartsWith('@')) request.Identifier.User = '@' + request.Identifier.User; var hs = await _hsResolver.ResolveHomeserverFromWellKnown(hsCanonical); //var hs = await _hsProvider.Login(hsCanonical, mxid, request.Password); - var hsClient = new MatrixHttpClient { BaseAddress = new Uri(hs) }; + var hsClient = new MatrixHttpClient { BaseAddress = new Uri(hs.client) }; //hsClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", hsClient.DefaultRequestHeaders.Authorization!.Parameter); var resp = await hsClient.PostAsJsonAsync("/_matrix/client/r0/login", request); var loginResp = await resp.Content.ReadAsStringAsync(); diff --git a/MxApiExtensions/Controllers/SyncController.cs b/MxApiExtensions/Controllers/SyncController.cs index bd41021..0b0007f 100644 --- a/MxApiExtensions/Controllers/SyncController.cs +++ b/MxApiExtensions/Controllers/SyncController.cs @@ -48,7 +48,7 @@ public class SyncController : ControllerBase { if (!_config.FastInitialSync.Enabled) { _logger.LogInformation("Starting sync for {} on {} ({})", hs.WhoAmI.UserId, hs.ServerName, hs.AccessToken); - var result = await hs._httpClient.GetAsync($"{Request.Path}?{qs}"); + var result = await hs.ClientHttpClient.GetAsync($"{Request.Path}?{qs}"); await Response.WriteHttpResponse(result); return; } @@ -73,7 +73,7 @@ public class SyncController : ControllerBase { syncState.NextSyncResponse = Task.Delay(30_000); syncState.NextSyncResponse.ContinueWith(x => { _logger.LogInformation("Sync for {} on {} ({}) starting", hs.WhoAmI.UserId, hs.ServerName, hs.AccessToken); - syncState.NextSyncResponse = hs._httpClient.GetAsync($"{Request.Path}?{qs}"); + syncState.NextSyncResponse = hs.ClientHttpClient.GetAsync($"{Request.Path}?{qs}"); }); } -- cgit 1.4.1