From 3e6a73599bb58161c08d8675ea23ee6c82c6675c Mon Sep 17 00:00:00 2001 From: Rory& Date: Mon, 29 Jan 2024 10:15:27 +0100 Subject: Room list fixes, migration fix, update available handler --- MatrixUtils.Web/Pages/Tools/Index.razor | 10 +++++ MatrixUtils.Web/Pages/Tools/LeaveRoom.razor | 56 ++++++++++++++++++++++++++++ MatrixUtils.Web/Pages/Tools/ToolsIndex.razor | 8 ---- 3 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 MatrixUtils.Web/Pages/Tools/Index.razor create mode 100644 MatrixUtils.Web/Pages/Tools/LeaveRoom.razor delete mode 100644 MatrixUtils.Web/Pages/Tools/ToolsIndex.razor (limited to 'MatrixUtils.Web/Pages/Tools') diff --git a/MatrixUtils.Web/Pages/Tools/Index.razor b/MatrixUtils.Web/Pages/Tools/Index.razor new file mode 100644 index 0000000..f1e04a3 --- /dev/null +++ b/MatrixUtils.Web/Pages/Tools/Index.razor @@ -0,0 +1,10 @@ +@page "/Tools" +

Other tools

+ +Copy highest powerlevel across all session
+Find all homeservers you share a room with
+Join room across all session
+Locate lost media
+Debug space relationships
+Migrate users from a split room to a new room
+Leave room by ID
diff --git a/MatrixUtils.Web/Pages/Tools/LeaveRoom.razor b/MatrixUtils.Web/Pages/Tools/LeaveRoom.razor new file mode 100644 index 0000000..b5df05f --- /dev/null +++ b/MatrixUtils.Web/Pages/Tools/LeaveRoom.razor @@ -0,0 +1,56 @@ +@page "/Tools/LeaveRoom" +@using System.Diagnostics +@using ArcaneLibs.Extensions +@using LibMatrix.Homeservers +@using LibMatrix.RoomTypes +@using System.Collections.ObjectModel +

Leave room

+
+Room ID: + +
+Leave +

+@foreach (var line in Log) { +

@line

+} +@code { + AuthenticatedHomeserverGeneric? hs { get; set; } + ObservableCollection Log { get; set; } = new ObservableCollection(); + [Parameter, SupplyParameterFromQuery(Name = "roomId")] + public string? RoomId { get; set; } + + protected override async Task OnInitializedAsync() { + hs = await RMUStorage.GetCurrentSessionOrNavigate(); + if (hs is null) return; + Log.CollectionChanged += (sender, args) => StateHasChanged(); + + StateHasChanged(); + Console.WriteLine("Rerendered!"); + await base.OnInitializedAsync(); + } + + private async Task Leave() { + if(string.IsNullOrWhiteSpace(RoomId)) return; + var room = hs.GetRoom(RoomId); + Log.Add("Got room object..."); + try { + await room.LeaveAsync(); + Log.Add("Left room!"); + } + catch (Exception e) { + Log.Add(e.ToString()); + } + + try { + await room.ForgetAsync(); + Log.Add("Forgot room!"); + } + catch (Exception e) { + Log.Add(e.ToString()); + } + + Log.Add("Done!"); + } + +} \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Tools/ToolsIndex.razor b/MatrixUtils.Web/Pages/Tools/ToolsIndex.razor deleted file mode 100644 index f4092d7..0000000 --- a/MatrixUtils.Web/Pages/Tools/ToolsIndex.razor +++ /dev/null @@ -1,8 +0,0 @@ -@page "/Tools" -

Other tools

- -Copy highest powerlevel across all session
-Find all homeservers you share a room with
-Join room across all session
-Locate lost media
-Debug space relationships
-- cgit 1.5.1