diff --git a/MatrixRoomUtils.Web/Pages/About.razor b/MatrixRoomUtils.Web/Pages/About.razor
index 971bd9b..48c7686 100644
--- a/MatrixRoomUtils.Web/Pages/About.razor
+++ b/MatrixRoomUtils.Web/Pages/About.razor
@@ -3,7 +3,6 @@
@using System.Net.Sockets
@inject NavigationManager NavigationManager
@inject ILocalStorageService LocalStorage
-@using XtermBlazor
<PageTitle>About</PageTitle>
@@ -22,10 +21,6 @@
<p>This deployment also serves a copy of the compiled, hosting-ready binaries at <a href="MRU-SRC.tar.xz">/MRU-SRC.tar.xz</a>!</p>
}
-<Xterm @ref="_terminal" Options="_options" OnFirstRender="@OnFirstRender" style="max-width: fit-content; overflow-x: hidden;"/>
-
-
-
@code {
private bool showBinDownload { get; set; }
private bool showSrcDownload { get; set; }
@@ -39,29 +34,4 @@
await base.OnInitializedAsync();
}
-
- private Xterm _terminal;
-
- private TerminalOptions _options = new TerminalOptions
- {
- CursorBlink = true,
- CursorStyle = CursorStyle.Block,
- Theme =
- {
- Background = "#17615e",
- },
- };
-
- private async Task OnFirstRender() {
- var message = "Hello, World!\nThis is a terminal emulator!\n\nYou can type stuff here, and it will be sent to the server!\n\nThis is a test of the emergency broadcast system.\n\nThis is only a t";
- _terminal.Options.RendererType = RendererType.Dom;
- _terminal.Options.ScreenReaderMode = true;
-// TcpClient.
- for (var i = 0; i < message.Length; i++) {
- await _terminal.Write(message[i].ToString());
-
- await Task.Delay(50);
- _terminal.Options.Theme.Background = $"#{(i * 2):X6}";
- }
- }
}
diff --git a/MatrixRoomUtils.Web/Pages/Rooms/Index.razor b/MatrixRoomUtils.Web/Pages/Rooms/Index.razor
index 816299f..6d12dc2 100644
--- a/MatrixRoomUtils.Web/Pages/Rooms/Index.razor
+++ b/MatrixRoomUtils.Web/Pages/Rooms/Index.razor
@@ -13,45 +13,54 @@
@code {
+ public List<RoomInfo> KnownRooms { get; set; } = new();
+
private List<RoomInfo> Rooms { get; set; } = new();
private ProfileResponseEventData GlobalProfile { get; set; }
- protected override async Task OnInitializedAsync() {
- var hs = await MRUStorage.GetCurrentSessionOrNavigate();
- if (hs is null) return;
- GlobalProfile = await hs.GetProfile(hs.WhoAmI.UserId);
- var filter = new SyncFilter() {
+ private SyncFilter filter = new() {
+ AccountData = new() {
+ NotTypes = new() { "*" },
+ Limit = 1
+ },
+ Presence = new() {
+ NotTypes = new() { "*" },
+ Limit = 1
+ },
+ Room = new() {
AccountData = new() {
- NotTypes = new() { "*" }
+ NotTypes = new() { "*" },
+ Limit = 1
},
- Presence = new() {
- NotTypes = new() { "*" }
+ Ephemeral = new() {
+ NotTypes = new() { "*" },
+ Limit = 1
},
- Room = new RoomFilter() {
- AccountData = new() {
- NotTypes = new() { "*" }
- },
- Ephemeral = new() {
- NotTypes = new() { "*" }
- },
- State = new RoomFilter.StateFilter() {
- Types = new List<string>() {
- "m.room.name",
- "m.room.avatar",
- "m.room.create",
- "org.matrix.mjolnir.shortcode",
- }
- },
- Timeline = new() {
- NotTypes = new() { "*" },
- Limit = 1
+ State = new() {
+ Types = new List<string>() {
+ "m.room.name",
+ "m.room.avatar",
+ "m.room.create",
+ "org.matrix.mjolnir.shortcode",
+ "m.room.power_levels"
}
+ },
+ Timeline = new() {
+ NotTypes = new() { "*" },
+ Limit = 1
}
- };
+ }
+ };
+
+ protected override async Task OnInitializedAsync() {
+ var hs = await MRUStorage.GetCurrentSessionOrNavigate();
+ if (hs is null) return;
+ GlobalProfile = await hs.GetProfile(hs.WhoAmI.UserId);
+
Status = "Syncing...";
SyncResult? sync = null;
string? nextBatch = null;
- while (sync is null or { Rooms.Join.Count: > 10}) {
+ while (sync is null or { Rooms.Join.Count: >= 1}) {
sync = await hs.SyncHelper.Sync(since: nextBatch, filter: filter, timeout: 0);
nextBatch = sync?.NextBatch ?? nextBatch;
if (sync is null) continue;
@@ -70,11 +79,13 @@
StateEvents = new()
};
Rooms.Add(room);
+ KnownRooms.Add(room);
}
room.StateEvents.AddRange(roomData.State.Events);
}
- Status = $"Got {Rooms.Count} rooms so far!";
+ Status = $"Got {Rooms.Count} rooms so far! Next batch: {nextBatch}";
StateHasChanged();
+ await Task.Delay(100);
}
Console.WriteLine("Sync done!");
Status = "Sync complete!";
@@ -103,8 +114,10 @@
}
Console.WriteLine("Set stub data!");
Status = "Set stub data!";
+ SemaphoreSlim semaphore = new(8, 8);
var memberTasks = Rooms.Select(async roomInfo => {
if (!roomInfo.StateEvents.Any(x => x.Type == "m.room.member" && x.StateKey == hs.WhoAmI.UserId)) {
+ await semaphore.WaitAsync();
roomInfo.StateEvents.Add(new StateEventResponse() {
Type = "m.room.member",
StateKey = hs.WhoAmI.UserId,
@@ -112,6 +125,7 @@
Membership = "unknown"
}
});
+ semaphore.Release();
}
}).ToList();
await Task.WhenAll(memberTasks);
diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor b/MatrixRoomUtils.Web/Pages/Rooms/Space.razor
index afa39b9..91f97d0 100644
--- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
+++ b/MatrixRoomUtils.Web/Pages/Rooms/Space.razor
@@ -1,4 +1,4 @@
-@page "/RoomManager/Space/{RoomId}"
+@page "/Rooms/{RoomId}/Space"
@using System.Text.Json
@using MatrixRoomUtils.Core.Responses
<h3>Room manager - Viewing Space</h3>
@@ -93,4 +93,4 @@
}
}
-}
\ No newline at end of file
+}
diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor b/MatrixRoomUtils.Web/Pages/Rooms/StateEditor.razor
index 8b2ff0c..8b2ff0c 100644
--- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
+++ b/MatrixRoomUtils.Web/Pages/Rooms/StateEditor.razor
diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor b/MatrixRoomUtils.Web/Pages/Rooms/StateViewer.razor
index 09b38f0..09b38f0 100644
--- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor
+++ b/MatrixRoomUtils.Web/Pages/Rooms/StateViewer.razor
|