diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-04 02:17:10 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-09-04 02:17:10 +0200 |
commit | 21da6cde79ccd0cb7f895a29e3d8cab959ef11ba (patch) | |
tree | fb0b89566b64ae907d7ca3ea8a29adcf0c0361d0 /LibMatrix/Helpers | |
parent | Clean up some extension functions (diff) | |
download | LibMatrix-21da6cde79ccd0cb7f895a29e3d8cab959ef11ba.tar.xz |
Too many changes to name...
Diffstat (limited to 'LibMatrix/Helpers')
-rw-r--r-- | LibMatrix/Helpers/HomeserverWeightEstimation.cs | 58 | ||||
-rw-r--r-- | LibMatrix/Helpers/MatrixEventAttribute.cs | 9 | ||||
-rw-r--r-- | LibMatrix/Helpers/SyncHelper.cs | 15 |
3 files changed, 78 insertions, 4 deletions
diff --git a/LibMatrix/Helpers/HomeserverWeightEstimation.cs b/LibMatrix/Helpers/HomeserverWeightEstimation.cs new file mode 100644 index 0000000..8f1bf3a --- /dev/null +++ b/LibMatrix/Helpers/HomeserverWeightEstimation.cs @@ -0,0 +1,58 @@ +namespace LibMatrix.Helpers; + +public class HomeserverWeightEstimation { + public static Dictionary<string, int> EstimatedSize = new() { + { "matrix.org", 84387 }, + { "anontier.nl", 44809 }, + { "nixos.org", 8195 }, + { "the-apothecary.club", 6983 }, + { "waifuhunter.club", 3953 }, + { "neko.dev", 2666 }, + { "nerdsin.space", 2647 }, + { "feline.support", 2633 }, + { "gitter.im", 2584 }, + { "midov.pl", 2219 }, + { "no.lgbtqia.zone", 2083 }, + { "nheko.im", 1883 }, + { "fachschaften.org", 1849 }, + { "pixelthefox.net", 1478 }, + { "arcticfoxes.net", 981 }, + { "pixie.town", 817 }, + { "privacyguides.org", 809 }, + { "rory.gay", 653 }, + { "artemislena.eu", 599 }, + { "alchemi.dev", 445 }, + { "jameskitt616.one", 390 }, + { "hackint.org", 382 }, + { "pikaviestin.fi", 368 }, + { "matrix.nomagic.uk", 337 }, + { "thearcanebrony.net", 178 }, + { "fairydust.space", 176 }, + { "grin.hu", 176 }, + { "envs.net", 165 }, + { "tastytea.de", 143 }, + { "koneko.chat", 121 }, + { "vscape.tk", 115 }, + { "funklause.de", 112 }, + { "seirdy.one", 107 }, + { "pcg.life", 72 }, + { "draupnir.midnightthoughts.space", 22 }, + { "tchncs.de", 19 }, + { "catgirl.cloud", 16 }, + { "possum.city", 16 }, + { "tu-dresden.de", 9 }, + { "fosscord.com", 9 }, + { "nightshade.fun", 8 }, + { "matrix.eclipse.org", 8 }, + { "masfloss.net", 8 }, + { "e2e.zone", 8 }, + { "hyteck.de", 8 } + }; + + public static Dictionary<string, int> LargeRooms = new() { + { "!ehXvUhWNASUkSLvAGP:matrix.org", 21957 }, + { "!fRRqjOaQcUbKOfCjvc:anontier.nl", 19117 }, + { "!OGEhHVWSdvArJzumhm:matrix.org", 101457 }, + { "!YTvKGNlinIzlkMTVRl:matrix.org", 30164 } + }; +} diff --git a/LibMatrix/Helpers/MatrixEventAttribute.cs b/LibMatrix/Helpers/MatrixEventAttribute.cs new file mode 100644 index 0000000..7556019 --- /dev/null +++ b/LibMatrix/Helpers/MatrixEventAttribute.cs @@ -0,0 +1,9 @@ +using System; + +namespace LibMatrix.Helpers; + +[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] +public class MatrixEventAttribute : Attribute { + public string EventName { get; set; } + public bool Legacy { get; set; } +} diff --git a/LibMatrix/Helpers/SyncHelper.cs b/LibMatrix/Helpers/SyncHelper.cs index b957c0c..de4f3d4 100644 --- a/LibMatrix/Helpers/SyncHelper.cs +++ b/LibMatrix/Helpers/SyncHelper.cs @@ -1,19 +1,26 @@ +using System; +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Net.Http.Json; using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; +using ArcaneLibs.Extensions; using LibMatrix.Extensions; using LibMatrix.Filters; +using LibMatrix.Homeservers; using LibMatrix.Responses; using LibMatrix.Services; namespace LibMatrix.Helpers; public class SyncHelper { - private readonly AuthenticatedHomeServer _homeServer; + private readonly AuthenticatedHomeserverGeneric _homeserver; private readonly TieredStorageService _storageService; - public SyncHelper(AuthenticatedHomeServer homeServer, TieredStorageService storageService) { - _homeServer = homeServer; + public SyncHelper(AuthenticatedHomeserverGeneric homeserver, TieredStorageService storageService) { + _homeserver = homeserver; _storageService = storageService; } @@ -33,7 +40,7 @@ public class SyncHelper { // else url += "&full_state=true"; Console.WriteLine("Calling: " + url); try { - var req = await _homeServer._httpClient.GetAsync(url, cancellationToken: cancellationToken ?? CancellationToken.None); + var req = await _homeserver._httpClient.GetAsync(url, cancellationToken: cancellationToken ?? CancellationToken.None); // var res = await JsonSerializer.DeserializeAsync<SyncResult>(await req.Content.ReadAsStreamAsync()); |