about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Shared')
-rw-r--r--MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor7
-rw-r--r--MatrixRoomUtils.Web/Shared/InlineUserItem.razor4
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor1
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor13
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor1
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor1
-rw-r--r--MatrixRoomUtils.Web/Shared/UserListItem.razor6
7 files changed, 13 insertions, 20 deletions
diff --git a/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor b/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor
index 8ab44fb..975da43 100644
--- a/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor
+++ b/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor
@@ -22,12 +22,13 @@
     private int _roomCount { get; set; } = 0;
 
     protected override async Task OnInitializedAsync() {
-        var hs = await new AuthenticatedHomeServer(User.LoginResponse.HomeServer, User.AccessToken, TODO).Configure();
+        await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
+
         if (User.Profile.AvatarUrl != null && User.Profile.AvatarUrl != "")
-            _avatarUrl = hs.ResolveMediaUri(User.Profile.AvatarUrl);
+            _avatarUrl = RuntimeCache.CurrentHomeServer.ResolveMediaUri(User.Profile.AvatarUrl);
         else _avatarUrl = "https://api.dicebear.com/6.x/identicon/svg?seed=" + User.LoginResponse.UserId;
         try {
-            _roomCount = (await hs.GetJoinedRooms()).Count;
+            _roomCount = (await RuntimeCache.CurrentHomeServer.GetJoinedRooms()).Count;
         }
         catch {
             _roomCount = -1;
diff --git a/MatrixRoomUtils.Web/Shared/InlineUserItem.razor b/MatrixRoomUtils.Web/Shared/InlineUserItem.razor
index 43a4111..0a58b4d 100644
--- a/MatrixRoomUtils.Web/Shared/InlineUserItem.razor
+++ b/MatrixRoomUtils.Web/Shared/InlineUserItem.razor
@@ -36,13 +36,11 @@
 
         await _semaphoreSlim.WaitAsync();
 
-        var hs = await new AuthenticatedHomeServer(RuntimeCache.CurrentHomeServer.HomeServerDomain, RuntimeCache.CurrentHomeServer.AccessToken, TODO).Configure();
-
         if (User == null) {
             if (UserId == null) {
                 throw new ArgumentNullException(nameof(UserId));
             }
-            User = await hs.GetProfile(UserId);
+            User = await RuntimeCache.CurrentHomeServer.GetProfile(UserId);
         }
 
     // UserId = User.;
diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor
index 42a5f64..ea7d2ec 100644
--- a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor
+++ b/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor
@@ -1,4 +1,3 @@
-@using MatrixRoomUtils.Core.Extensions
 <table>
     @foreach (var i in Items.Keys) {
         var key = i;
diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
index 4fb5596..f89dc44 100644
--- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
+++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
@@ -1,22 +1,21 @@
-@using MatrixRoomUtils.Core.Extensions
-@if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "ban") {
+@if (Event.membership"]!.GetValue<string>() == "ban") {
     <i>@Event.StateKey was banned</i>
 }
-else if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "invite") {
+else if (Event.membership"]!.GetValue<string>() == "invite") {
     <i>@Event.StateKey was invited</i>
 }
-else if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "join") {
+else if (Event.membership"]!.GetValue<string>() == "join") {
     @if (Event.ReplacesState != null) {
-        <i>@Event.StateKey changed their display name to @(Event.ContentAsJsonNode["displayname"]!.GetValue<string>())</i>
+        <i>@Event.StateKey changed their display name to @(Event.displayname"]!.GetValue<string>())</i>
     }
     else {
         <i><InlineUserItem UserId="@Event.StateKey"></InlineUserItem> joined</i>
     }
 }
-else if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "leave") {
+else if (Event.membership"]!.GetValue<string>() == "leave") {
     <i>@Event.StateKey left</i>
 }
-else if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "knock") {
+else if (Event.membership"]!.GetValue<string>() == "knock") {
     <i>@Event.StateKey knocked</i>
 }
 else {
diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor
index 80a432b..6c26dc2 100644
--- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor
+++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor
@@ -1,4 +1,3 @@
-@using MatrixRoomUtils.Core.Extensions
 @using MatrixRoomUtils.Core.Responses
 <pre>
     @ObjectExtensions.ToJson(Event.Content, indent: false)
diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor
index f78bdc9..d8ea7e2 100644
--- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor
+++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor
@@ -1,4 +1,3 @@
-@using MatrixRoomUtils.Core.Extensions
 <div>
 
     <details style="display: inline;">
diff --git a/MatrixRoomUtils.Web/Shared/UserListItem.razor b/MatrixRoomUtils.Web/Shared/UserListItem.razor
index b99671a..52f398a 100644
--- a/MatrixRoomUtils.Web/Shared/UserListItem.razor
+++ b/MatrixRoomUtils.Web/Shared/UserListItem.razor
@@ -25,7 +25,7 @@
     private string? profileAvatar { get; set; } = "/icon-192.png";
     private string? profileName { get; set; } = "Loading...";
 
-    private static SemaphoreSlim _semaphoreSlim = new(128);
+    private static SemaphoreSlim _semaphoreSlim = new(8);
 
     protected override async Task OnInitializedAsync() {
         await base.OnInitializedAsync();
@@ -33,13 +33,11 @@
 
         await _semaphoreSlim.WaitAsync();
 
-        var hs = await new AuthenticatedHomeServer(RuntimeCache.CurrentHomeServer.HomeServerDomain, RuntimeCache.CurrentHomeServer.AccessToken, TODO).Configure();
-
         if (User == null) {
             if (UserId == null) {
                 throw new ArgumentNullException(nameof(UserId));
             }
-            User = await hs.GetProfile(UserId);
+            User = await RuntimeCache.CurrentHomeServer.GetProfile(UserId);
         }
 
     // UserId = User.;