about summary refs log tree commit diff
diff options
context:
space:
mode:
m---------ArcaneLibs0
-rw-r--r--LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs5
-rw-r--r--LibMatrix/Homeservers/AuthenticatedHomeserverMxApiExtended.cs4
-rw-r--r--LibMatrix/Homeservers/AuthenticatedHomeserverSynapse.cs4
-rw-r--r--LibMatrix/Homeservers/RemoteHomeServer.cs6
-rw-r--r--LibMatrix/Services/HomeserverProviderService.cs12
6 files changed, 18 insertions, 13 deletions
diff --git a/ArcaneLibs b/ArcaneLibs
-Subproject e885d07cb1c0e75a1a16fb473118a86ff3dc5d2
+Subproject 68eca20fbf4d5c08b6960fb2362ba3733d2df9e
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) {
diff --git a/LibMatrix/Services/HomeserverProviderService.cs b/LibMatrix/Services/HomeserverProviderService.cs
index 9867184..3e42c21 100644
--- a/LibMatrix/Services/HomeserverProviderService.cs
+++ b/LibMatrix/Services/HomeserverProviderService.cs
@@ -19,7 +19,7 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger
 
         return await AuthenticatedHomeserverCache.GetOrAdd($"{homeserver}{accessToken}{proxy}{impersonatedMxid}", async () => {
             var wellKnownUris = await hsResolver.ResolveHomeserverFromWellKnown(homeserver, enableClient, enableServer);
-            var rhs = new RemoteHomeserver(homeserver, wellKnownUris, ref proxy);
+            var rhs = new RemoteHomeserver(homeserver, wellKnownUris, proxy);
 
             AuthenticatedHomeserverGeneric? hs = null;
             if (!useGeneric) {
@@ -42,10 +42,10 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger
 
                 try {
                     if (clientVersions.UnstableFeatures.TryGetValue("gay.rory.mxapiextensions.v0", out var a) && a)
-                        hs = new AuthenticatedHomeserverMxApiExtended(homeserver, wellKnownUris, ref proxy, accessToken);
+                        hs = new AuthenticatedHomeserverMxApiExtended(homeserver, wellKnownUris, proxy, accessToken);
                     else {
                         if (serverVersion is { Server.Name: "Synapse" })
-                            hs = new AuthenticatedHomeserverSynapse(homeserver, wellKnownUris, ref proxy, accessToken);
+                            hs = new AuthenticatedHomeserverSynapse(homeserver, wellKnownUris, proxy, accessToken);
                     }
                 }
                 catch (Exception e) {
@@ -54,7 +54,7 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger
                 }
             }
 
-            hs ??= new AuthenticatedHomeserverGeneric(homeserver, wellKnownUris, ref proxy, accessToken);
+            hs ??= new AuthenticatedHomeserverGeneric(homeserver, wellKnownUris, proxy, accessToken);
 
             await hs.Initialise();
 
@@ -68,8 +68,8 @@ public class HomeserverProviderService(ILogger<HomeserverProviderService> logger
     public async Task<RemoteHomeserver> GetRemoteHomeserver(string homeserver, string? proxy = null, bool useCache = true, bool enableServer = true) =>
         useCache
             ? await RemoteHomeserverCache.GetOrAdd($"{homeserver}{proxy}",
-                async () => { return new RemoteHomeserver(homeserver, await hsResolver.ResolveHomeserverFromWellKnown(homeserver, enableServer: enableServer), ref proxy); })
-            : new RemoteHomeserver(homeserver, await hsResolver.ResolveHomeserverFromWellKnown(homeserver, enableServer: enableServer), ref proxy);
+                async () => { return new RemoteHomeserver(homeserver, await hsResolver.ResolveHomeserverFromWellKnown(homeserver, enableServer: enableServer), proxy); })
+            : new RemoteHomeserver(homeserver, await hsResolver.ResolveHomeserverFromWellKnown(homeserver, enableServer: enableServer), proxy);
 
     public async Task<FederationClient> GetFederationClient(string homeserver, string keyId, string? proxy = null, bool useCache = true) =>
         useCache