diff options
author | Rory& <root@rory.gay> | 2024-05-16 11:46:45 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-05-16 11:46:45 +0200 |
commit | e1f99073f3d9788a4b48d2bb7091e3894dcefa1a (patch) | |
tree | 63eaa6ead968ca0fd3f2a85a2b6ae13bab900156 /LibMatrix/Homeservers | |
parent | Add valid room memberhip values as constants (diff) | |
download | LibMatrix-e1f99073f3d9788a4b48d2bb7091e3894dcefa1a.tar.xz |
Dont use refs for proxy
Diffstat (limited to 'LibMatrix/Homeservers')
4 files changed, 12 insertions, 7 deletions
diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs index 5520d3a..c729a44 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs @@ -19,8 +19,8 @@ using Microsoft.Extensions.Logging.Abstractions; namespace LibMatrix.Homeservers; public class AuthenticatedHomeserverGeneric : RemoteHomeserver { - public AuthenticatedHomeserverGeneric(string serverName, HomeserverResolverService.WellKnownUris wellKnownUris, ref string? proxy, string accessToken) : base(serverName, - wellKnownUris, ref proxy) { + public AuthenticatedHomeserverGeneric(string serverName, HomeserverResolverService.WellKnownUris wellKnownUris, string? proxy, string accessToken) : base(serverName, + wellKnownUris, proxy) { AccessToken = accessToken; ClientHttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); @@ -42,6 +42,7 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { public string UserLocalpart => UserId.Split(":")[0][1..]; public string ServerName => UserId.Split(":", 2)[1]; + [JsonIgnore] public string AccessToken { get; set; } public HsNamedCaches NamedCaches { get; set; } = null!; diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs index f55acb8..64d11f9 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs @@ -2,5 +2,5 @@ using LibMatrix.Services; namespace LibMatrix.Homeservers; -public class AuthenticatedHomeserverMxApiExtended(string serverName, HomeserverResolverService.WellKnownUris wellKnownUris, ref string? proxy, string accessToken) - : AuthenticatedHomeserverGeneric(serverName, wellKnownUris, ref proxy, accessToken); \ No newline at end of file +public class AuthenticatedHomeserverMxApiExtended(string serverName, HomeserverResolverService.WellKnownUris wellKnownUris, string? proxy, string accessToken) + : AuthenticatedHomeserverGeneric(serverName, wellKnownUris, proxy, accessToken); \ No newline at end of file diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs index 307a226..83ebf20 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs @@ -9,8 +9,8 @@ namespace LibMatrix.Homeservers; public class AuthenticatedHomeserverSynapse : AuthenticatedHomeserverGeneric { public readonly SynapseAdminApiClient Admin; - public AuthenticatedHomeserverSynapse(string serverName, HomeserverResolverService.WellKnownUris wellKnownUris, ref string? proxy, string accessToken) : base(serverName, - wellKnownUris, ref proxy, accessToken) { + public AuthenticatedHomeserverSynapse(string serverName, HomeserverResolverService.WellKnownUris wellKnownUris, string? proxy, string accessToken) : base(serverName, + wellKnownUris, proxy, accessToken) { Admin = new(this); } diff --git a/LibMatrix/Homeservers/RemoteHomeServer.cs b/LibMatrix/Homeservers/RemoteHomeServer.cs index c29137c..8669ca7 100644 --- a/LibMatrix/Homeservers/RemoteHomeServer.cs +++ b/LibMatrix/Homeservers/RemoteHomeServer.cs @@ -12,7 +12,7 @@ using Microsoft.Extensions.Logging.Abstractions; namespace LibMatrix.Homeservers; public class RemoteHomeserver { - public RemoteHomeserver(string baseUrl, HomeserverResolverService.WellKnownUris wellKnownUris, ref string? proxy) { + public RemoteHomeserver(string baseUrl, HomeserverResolverService.WellKnownUris wellKnownUris, string? proxy) { if (string.IsNullOrWhiteSpace(proxy)) proxy = null; BaseUrl = baseUrl; @@ -31,8 +31,12 @@ public class RemoteHomeserver { private Dictionary<string, object> _profileCache { get; set; } = new(); public string BaseUrl { get; } + [JsonIgnore] public MatrixHttpClient ClientHttpClient { get; set; } + + [JsonIgnore] public FederationClient? FederationClient { get; set; } + public HomeserverResolverService.WellKnownUris WellKnownUris { get; set; } public async Task<UserProfileResponse> GetProfileAsync(string mxid, bool useCache = false) { |