diff options
Diffstat (limited to '')
36 files changed, 304 insertions, 61 deletions
diff --git a/LibMatrix b/LibMatrix -Subproject b5860ce2011b96a2919d5306445b0e8bd8408b3 +Subproject 16e314ed714f8b3e298c0ecf2ebfe67b48e5f69 diff --git a/MatrixRoomUtils.sln b/MatrixRoomUtils.sln index f52a446..23d86b0 100644 --- a/MatrixRoomUtils.sln +++ b/MatrixRoomUtils.sln @@ -1,5 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 +# Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatrixUtils.Web", "MatrixUtils.Web\MatrixUtils.Web.csproj", "{D38DA95D-DD83-4340-96A4-6F59FC6AE3D9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatrixUtils.Web.Server", "MatrixUtils.Web.Server\MatrixUtils.Web.Server.csproj", "{F997F26F-2EC1-4D18-B3DD-C46FB2AD65C0}" @@ -60,6 +61,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArcaneLibs.UsageTest", "Lib EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatrixUtils.DmSpaced", "MatrixUtils.DmSpaced\MatrixUtils.DmSpaced.csproj", "{B3FEA1EF-6CFE-49C5-A0B2-11DB58D4CD1C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArcaneLibs.Legacy", "LibMatrix\ArcaneLibs\ArcaneLibs.Legacy\ArcaneLibs.Legacy.csproj", "{748D215E-CA40-4D0F-BE1D-D2350D4AB8CA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArcaneLibs.Logging", "LibMatrix\ArcaneLibs\ArcaneLibs.Logging\ArcaneLibs.Logging.csproj", "{E33F7CB0-A03D-4ED0-9AE8-95B31A2D7ACC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArcaneLibs.StringNormalisation", "LibMatrix\ArcaneLibs\ArcaneLibs.StringNormalisation\ArcaneLibs.StringNormalisation.csproj", "{FDB12B6A-01AA-46C0-A55E-0F984496AB81}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArcaneLibs.Timings", "LibMatrix\ArcaneLibs\ArcaneLibs.Timings\ArcaneLibs.Timings.csproj", "{84EE78FF-E198-4090-BFE9-C47D266E115E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArcaneLib.Tests", "LibMatrix\ArcaneLibs\ArcaneLib.Tests\ArcaneLib.Tests.csproj", "{1607FCA9-7B5B-45B0-8D1F-205ABACB7173}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibMatrix.MxApiExtensions", "LibMatrix\LibMatrix.MxApiExtensions\LibMatrix.MxApiExtensions.csproj", "{56A42391-4514-4352-B22B-622EE7A618AA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -162,6 +175,30 @@ Global {B3FEA1EF-6CFE-49C5-A0B2-11DB58D4CD1C}.Debug|Any CPU.Build.0 = Debug|Any CPU {B3FEA1EF-6CFE-49C5-A0B2-11DB58D4CD1C}.Release|Any CPU.ActiveCfg = Release|Any CPU {B3FEA1EF-6CFE-49C5-A0B2-11DB58D4CD1C}.Release|Any CPU.Build.0 = Release|Any CPU + {748D215E-CA40-4D0F-BE1D-D2350D4AB8CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {748D215E-CA40-4D0F-BE1D-D2350D4AB8CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {748D215E-CA40-4D0F-BE1D-D2350D4AB8CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {748D215E-CA40-4D0F-BE1D-D2350D4AB8CA}.Release|Any CPU.Build.0 = Release|Any CPU + {E33F7CB0-A03D-4ED0-9AE8-95B31A2D7ACC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E33F7CB0-A03D-4ED0-9AE8-95B31A2D7ACC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E33F7CB0-A03D-4ED0-9AE8-95B31A2D7ACC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E33F7CB0-A03D-4ED0-9AE8-95B31A2D7ACC}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB12B6A-01AA-46C0-A55E-0F984496AB81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB12B6A-01AA-46C0-A55E-0F984496AB81}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB12B6A-01AA-46C0-A55E-0F984496AB81}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB12B6A-01AA-46C0-A55E-0F984496AB81}.Release|Any CPU.Build.0 = Release|Any CPU + {84EE78FF-E198-4090-BFE9-C47D266E115E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84EE78FF-E198-4090-BFE9-C47D266E115E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84EE78FF-E198-4090-BFE9-C47D266E115E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84EE78FF-E198-4090-BFE9-C47D266E115E}.Release|Any CPU.Build.0 = Release|Any CPU + {1607FCA9-7B5B-45B0-8D1F-205ABACB7173}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1607FCA9-7B5B-45B0-8D1F-205ABACB7173}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1607FCA9-7B5B-45B0-8D1F-205ABACB7173}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1607FCA9-7B5B-45B0-8D1F-205ABACB7173}.Release|Any CPU.Build.0 = Release|Any CPU + {56A42391-4514-4352-B22B-622EE7A618AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {56A42391-4514-4352-B22B-622EE7A618AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {56A42391-4514-4352-B22B-622EE7A618AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {56A42391-4514-4352-B22B-622EE7A618AA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {F4E241C3-0300-4B87-8707-BCBDEF1F0185} = {8F4F6BEC-0C66-486B-A21A-1C35B2EDAD33} @@ -185,5 +222,11 @@ Global {5CE239F8-C124-4A96-A0F8-B56B9AE27434} = {A4BCBF5F-4936-44B9-BAB3-FAF240BDF40D} {6D93DA72-69D8-43BD-BC19-7FFF8A313971} = {7D2C9959-8309-4110-A67F-DEE64E97C1D8} {EDFC9BA8-CAA9-4B51-AFAF-834C1D74DCF0} = {B00C5CB6-6200-4B41-96BE-C6EAF1085A14} + {748D215E-CA40-4D0F-BE1D-D2350D4AB8CA} = {B00C5CB6-6200-4B41-96BE-C6EAF1085A14} + {E33F7CB0-A03D-4ED0-9AE8-95B31A2D7ACC} = {B00C5CB6-6200-4B41-96BE-C6EAF1085A14} + {FDB12B6A-01AA-46C0-A55E-0F984496AB81} = {B00C5CB6-6200-4B41-96BE-C6EAF1085A14} + {84EE78FF-E198-4090-BFE9-C47D266E115E} = {B00C5CB6-6200-4B41-96BE-C6EAF1085A14} + {1607FCA9-7B5B-45B0-8D1F-205ABACB7173} = {B00C5CB6-6200-4B41-96BE-C6EAF1085A14} + {56A42391-4514-4352-B22B-622EE7A618AA} = {8F4F6BEC-0C66-486B-A21A-1C35B2EDAD33} EndGlobalSection EndGlobal diff --git a/MatrixUtils.Desktop/MatrixUtils.Desktop.csproj b/MatrixUtils.Desktop/MatrixUtils.Desktop.csproj index f1bd2b6..ce009d5 100644 --- a/MatrixUtils.Desktop/MatrixUtils.Desktop.csproj +++ b/MatrixUtils.Desktop/MatrixUtils.Desktop.csproj @@ -20,20 +20,20 @@ <ItemGroup> - <PackageReference Include="Avalonia" Version="11.0.6" /> - <PackageReference Include="Avalonia.Desktop" Version="11.0.6" /> - <PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.6" /> - <PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.6" /> + <PackageReference Include="Avalonia" Version="11.0.10" /> + <PackageReference Include="Avalonia.Desktop" Version="11.0.10" /> + <PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.10" /> + <PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.10" /> <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.--> - <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.6" /> - <PackageReference Include="Sentry" Version="3.36.0" /> + <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10" /> + <PackageReference Include="Sentry" Version="4.7.0" /> </ItemGroup> <ItemGroup> - <PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.5" /> + <PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.0.10.9" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" /> </ItemGroup> <ItemGroup> diff --git a/MatrixUtils.Web.Server/MatrixUtils.Web.Server.csproj b/MatrixUtils.Web.Server/MatrixUtils.Web.Server.csproj index c4318d0..f2d47ea 100644 --- a/MatrixUtils.Web.Server/MatrixUtils.Web.Server.csproj +++ b/MatrixUtils.Web.Server/MatrixUtils.Web.Server.csproj @@ -8,7 +8,7 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0" /> + <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.6" /> </ItemGroup> <ItemGroup> diff --git a/MatrixUtils.Web/App.razor b/MatrixUtils.Web/App.razor index a8cf817..5e87bc3 100644 --- a/MatrixUtils.Web/App.razor +++ b/MatrixUtils.Web/App.razor @@ -1,4 +1,5 @@ -<Router AppAssembly="@typeof(App).Assembly"> +@using Microsoft.AspNetCore.Components.Routing +<Router AppAssembly="@typeof(App).Assembly"> <Found Context="routeData"> <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)"/> <FocusOnNavigate RouteData="@routeData" Selector="h1"/> diff --git a/MatrixUtils.Web/MatrixUtils.Web.csproj b/MatrixUtils.Web/MatrixUtils.Web.csproj index f27ae40..8760e7a 100644 --- a/MatrixUtils.Web/MatrixUtils.Web.csproj +++ b/MatrixUtils.Web/MatrixUtils.Web.csproj @@ -16,10 +16,10 @@ </PropertyGroup> <ItemGroup> - <PackageReference Include="Blazored.LocalStorage" Version="4.4.0" /> + <PackageReference Include="Blazored.LocalStorage" Version="4.5.0" /> <PackageReference Include="Blazored.SessionStorage" Version="2.4.0" /> - <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" /> - <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" PrivateAssets="all" /> + <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6" /> + <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.6" PrivateAssets="all" /> <PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" /> </ItemGroup> diff --git a/MatrixUtils.Web/Pages/Dev/DevOptions.razor b/MatrixUtils.Web/Pages/Dev/DevOptions.razor index fa0cdff..7b646d1 100644 --- a/MatrixUtils.Web/Pages/Dev/DevOptions.razor +++ b/MatrixUtils.Web/Pages/Dev/DevOptions.razor @@ -2,8 +2,10 @@ @using ArcaneLibs.Extensions @using System.Text @using System.Text.Json +@using Microsoft.JSInterop @inject NavigationManager NavigationManager -@inject ILocalStorageService LocalStorage +@inject IJSRuntime JSRuntime +@inject TieredStorageService TieredStorage <PageTitle>Developer options</PageTitle> diff --git a/MatrixUtils.Web/Pages/Dev/DevUtilities.razor b/MatrixUtils.Web/Pages/Dev/DevUtilities.razor index 87416a2..bf5a396 100644 --- a/MatrixUtils.Web/Pages/Dev/DevUtilities.razor +++ b/MatrixUtils.Web/Pages/Dev/DevUtilities.razor @@ -1,8 +1,7 @@ @page "/Dev/Utilities" @using ArcaneLibs.Extensions @using MatrixUtils.Abstractions -@inject ILocalStorageService LocalStorage -@inject NavigationManager NavigationManager + <h3>Debug Tools</h3> <hr/> @if (Rooms.Count == 0) { diff --git a/MatrixUtils.Web/Pages/HSEInit.razor b/MatrixUtils.Web/Pages/HSEInit.razor index b76dfe6..cabc671 100644 --- a/MatrixUtils.Web/Pages/HSEInit.razor +++ b/MatrixUtils.Web/Pages/HSEInit.razor @@ -1,6 +1,7 @@ @page "/HSEInit" +@using Blazored.LocalStorage @inject ILocalStorageService LocalStorage -@inject IJSRuntime JsRuntime + <h3>HSE Initialising...</h3> <hr/> diff --git a/MatrixUtils.Web/Pages/Index.razor b/MatrixUtils.Web/Pages/Index.razor index 8dfd1be..a7619ae 100644 --- a/MatrixUtils.Web/Pages/Index.razor +++ b/MatrixUtils.Web/Pages/Index.razor @@ -108,6 +108,9 @@ Small collection of tools to do not-so-everyday things. </p> </td> <td> + <LinkButton OnClick="@(() => Task.Run(()=>NavigationManager.NavigateTo($"/InvalidSession?ctx={session.AccessToken}")))">Re-login</LinkButton> + </td> + <td> <LinkButton OnClick="@(() => RemoveUser(session))">Remove</LinkButton> </td> </tr> diff --git a/MatrixUtils.Web/Pages/Labs/Client/ClientComponents/MatrixClient.razor b/MatrixUtils.Web/Pages/Labs/Client/ClientComponents/MatrixClient.razor index 7d3e52a..67dcae5 100644 --- a/MatrixUtils.Web/Pages/Labs/Client/ClientComponents/MatrixClient.razor +++ b/MatrixUtils.Web/Pages/Labs/Client/ClientComponents/MatrixClient.razor @@ -1,5 +1,4 @@ @using Index = MatrixUtils.Web.Pages.Labs.Client.Index -@using MatrixUtils.Web.Pages.Client.ClientComponents <div class="container-fluid"> <div class="row"> diff --git a/MatrixUtils.Web/Pages/Labs/Client/Index.razor b/MatrixUtils.Web/Pages/Labs/Client/Index.razor index 5b489b0..ef4a0b9 100644 --- a/MatrixUtils.Web/Pages/Labs/Client/Index.razor +++ b/MatrixUtils.Web/Pages/Labs/Client/Index.razor @@ -1,5 +1,4 @@ @page "/Labs/Client" -@using LibMatrix @using MatrixUtils.Abstractions @using MatrixUtils.Web.Pages.Client.ClientComponents @using System.Collections.ObjectModel diff --git a/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage1.razor b/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage1.razor index 2176467..55e17d6 100644 --- a/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage1.razor +++ b/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage1.razor @@ -1,10 +1,8 @@ -@using LibMatrix.Homeservers @using LibMatrix.RoomTypes @using LibMatrix @using LibMatrix.Responses @using MatrixUtils.LibDMSpace @using MatrixUtils.LibDMSpace.StateEvents -@using Microsoft.Extensions.Primitives @using ArcaneLibs.Extensions @using LibMatrix.EventTypes.Spec.State @using MatrixUtils.Abstractions diff --git a/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage2.razor b/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage2.razor index a70e9c5..be6027a 100644 --- a/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage2.razor +++ b/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage2.razor @@ -1,12 +1,6 @@ -@using LibMatrix.Homeservers @using LibMatrix.RoomTypes -@using LibMatrix @using LibMatrix.EventTypes.Spec.State -@using LibMatrix.Responses -@using MatrixUtils.LibDMSpace -@using MatrixUtils.LibDMSpace.StateEvents @using ArcaneLibs.Extensions -@using System.Text.Json.Serialization @using MatrixUtils.Abstractions <b> <u>DM Space setup tool - stage 2: Fix DM room attribution</u> diff --git a/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage3.razor b/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage3.razor index 865e956..09de5d3 100644 --- a/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage3.razor +++ b/MatrixUtils.Web/Pages/Labs/DMSpace/DMSpaceStages/DMSpaceStage3.razor @@ -1,11 +1,7 @@ -@using LibMatrix.Homeservers @using LibMatrix.RoomTypes -@using LibMatrix @using LibMatrix.EventTypes.Spec.State @using LibMatrix.Responses @using MatrixUtils.LibDMSpace -@using MatrixUtils.LibDMSpace.StateEvents -@using ArcaneLibs.Extensions @using System.Text.Json.Serialization @using MatrixUtils.Abstractions diff --git a/MatrixUtils.Web/Pages/LoginPage.razor b/MatrixUtils.Web/Pages/LoginPage.razor index ec4f57d..6c869ac 100644 --- a/MatrixUtils.Web/Pages/LoginPage.razor +++ b/MatrixUtils.Web/Pages/LoginPage.razor @@ -2,8 +2,7 @@ @using System.Text.Json @using System.Text.Json.Serialization @using LibMatrix -@inject ILocalStorageService LocalStorage -@inject IJSRuntime JsRuntime + <h3>Login</h3> <hr/> diff --git a/MatrixUtils.Web/Pages/Rooms/Create.razor b/MatrixUtils.Web/Pages/Rooms/Create.razor index 368211a..f2dfb01 100644 --- a/MatrixUtils.Web/Pages/Rooms/Create.razor +++ b/MatrixUtils.Web/Pages/Rooms/Create.razor @@ -7,6 +7,7 @@ @using LibMatrix.EventTypes.Spec.State.RoomInfo @using LibMatrix.Responses @using MatrixUtils.Web.Classes.RoomCreationTemplates +@using Microsoft.AspNetCore.Components.Forms @* @* ReSharper disable once RedundantUsingDirective - Must not remove this, Rider marks this as "unused" when it's not */ *@ <h3>Room Manager - Create Room</h3> diff --git a/MatrixUtils.Web/Pages/Rooms/StateEditor.razor b/MatrixUtils.Web/Pages/Rooms/StateEditor.razor index fc3a310..6110b83 100644 --- a/MatrixUtils.Web/Pages/Rooms/StateEditor.razor +++ b/MatrixUtils.Web/Pages/Rooms/StateEditor.razor @@ -1,8 +1,6 @@ @page "/Rooms/{RoomId}/State/Edit" @using ArcaneLibs.Extensions @using LibMatrix -@inject ILocalStorageService LocalStorage -@inject NavigationManager NavigationManager <h3>Room state editor - Editing @RoomId</h3> <hr/> diff --git a/MatrixUtils.Web/Pages/Rooms/StateViewer.razor b/MatrixUtils.Web/Pages/Rooms/StateViewer.razor index fabc33c..7c31136 100644 --- a/MatrixUtils.Web/Pages/Rooms/StateViewer.razor +++ b/MatrixUtils.Web/Pages/Rooms/StateViewer.razor @@ -1,7 +1,7 @@ @page "/Rooms/{RoomId}/State/View" @using ArcaneLibs.Extensions @using LibMatrix -@inject ILocalStorageService LocalStorage + @inject NavigationManager NavigationManager <h3>Room state viewer - Viewing @RoomId</h3> <hr/> diff --git a/MatrixUtils.Web/Pages/ServerInfo.razor b/MatrixUtils.Web/Pages/ServerInfo.razor index aa6ad51..e6f1f16 100644 --- a/MatrixUtils.Web/Pages/ServerInfo.razor +++ b/MatrixUtils.Web/Pages/ServerInfo.razor @@ -1,7 +1,7 @@ @page "/ServerInfo/{Homeserver}" @using LibMatrix.Responses @using ArcaneLibs.Extensions -<h3>ServerInfo</h3> +<h3>Server info for @Homeserver</h3> <hr/> @if (ServerVersionResponse is not null) { <p>Server version: @ServerVersionResponse.Server.Name @ServerVersionResponse.Server.Version</p> diff --git a/MatrixUtils.Web/Pages/Tools/Index.razor b/MatrixUtils.Web/Pages/Tools/Index.razor index 3aec2e3..e68bb9a 100644 --- a/MatrixUtils.Web/Pages/Tools/Index.razor +++ b/MatrixUtils.Web/Pages/Tools/Index.razor @@ -13,6 +13,10 @@ <a href="/Tools/User/CopyPowerlevel">Copy highest powerlevel across all session</a><br/> <a href="/Tools/User/ViewAccountData">View account data</a><br/> +<h4 class="tool-category">Room tools</h4> +<hr/> +<a href="/Tools/Moderation/SpaceRestrictedJoins">Change space children join access rules</a><br/> + <h4 class="tool-category">Moderation tools</h4> <hr/> <a href="/Tools/Moderation/InviteCounter">Count invites by inviter</a><br/> diff --git a/MatrixUtils.Web/Pages/Tools/Info/PolicyListActivity.razor b/MatrixUtils.Web/Pages/Tools/Info/PolicyListActivity.razor index c94d0b0..de0bfe7 100644 --- a/MatrixUtils.Web/Pages/Tools/Info/PolicyListActivity.razor +++ b/MatrixUtils.Web/Pages/Tools/Info/PolicyListActivity.razor @@ -1,4 +1,4 @@ -@page "/Tools/PolicyListActivity" +@page "/Tools/Info/PolicyListActivity" @using LibMatrix.EventTypes.Spec.State.Policy @using System.Diagnostics @using LibMatrix.RoomTypes diff --git a/MatrixUtils.Web/Pages/Tools/InviteCounter.razor b/MatrixUtils.Web/Pages/Tools/InviteCounter.razor new file mode 100644 index 0000000..8f4b4dd --- /dev/null +++ b/MatrixUtils.Web/Pages/Tools/InviteCounter.razor @@ -0,0 +1,73 @@ +@page "/Tools/InviteCounter" +@using ArcaneLibs.Extensions +@using LibMatrix.RoomTypes +@using System.Collections.ObjectModel +@using LibMatrix +@using System.Collections.Frozen +@using LibMatrix.EventTypes.Spec.State +@using MatrixUtils.Abstractions +<h3>User Trace</h3> +<hr/> + +<br/> +<span>Room ID: </span> +<InputText @bind-Value="@roomId"></InputText> +<LinkButton OnClick="@Execute">Execute</LinkButton> + +<br/> + +<details> + <summary>Results</summary> + @foreach (var (userId, events) in invites.OrderByDescending(x=>x.Value).ToList()) { + <p>@userId: @events</p> + } +</details> + +<br/> +@foreach (var line in log.Reverse()) { + <pre>@line</pre> +} + +@code { + private ObservableCollection<string> log { get; set; } = new(); + private Dictionary<string, int> invites { get; set; } = new(); + private AuthenticatedHomeserverGeneric hs { get; set; } + + [Parameter, SupplyParameterFromQuery(Name = "room")] + public string roomId { get; set; } + + + protected override async Task OnInitializedAsync() { + log.CollectionChanged += (sender, args) => StateHasChanged(); + hs = await RMUStorage.GetCurrentSessionOrNavigate(); + if (hs is null) return; + + StateHasChanged(); + Console.WriteLine("Rerendered!"); + await base.OnInitializedAsync(); + } + + private async Task<string> Execute() { + var room = hs.GetRoom(roomId); + var events = room.GetManyMessagesAsync(limit: int.MaxValue); + await foreach (var resp in events) { + var all = resp.State.Concat(resp.Chunk); + foreach (var evt in all) { + if(evt.Type != RoomMemberEventContent.EventId) continue; + var content = evt.TypedContent as RoomMemberEventContent; + if(content.Membership != "invite") continue; + if(!invites.ContainsKey(evt.Sender)) invites[evt.Sender] = 0; + invites[evt.Sender]++; + } + + log.Add($"{resp.State.Count} state, {resp.Chunk.Count} timeline"); + } + + + + StateHasChanged(); + + return ""; + } + +} \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Tools/MassCMEBan.razor b/MatrixUtils.Web/Pages/Tools/MassCMEBan.razor new file mode 100644 index 0000000..cbbca9e --- /dev/null +++ b/MatrixUtils.Web/Pages/Tools/MassCMEBan.razor @@ -0,0 +1,75 @@ +@page "/Tools/MassCMEBan" +@using ArcaneLibs.Extensions +@using LibMatrix.RoomTypes +@using System.Collections.ObjectModel +@using LibMatrix +@using System.Collections.Frozen +@using LibMatrix.EventTypes.Spec.State +@using LibMatrix.EventTypes.Spec.State.Policy +@using MatrixUtils.Abstractions +<h3>User Trace</h3> +<hr/> + +<br/> +<span>Users:</span> +<InputTextArea @bind-Value="@roomId"></InputTextArea> +<LinkButton OnClick="@Execute">Execute</LinkButton> + +<br/> + +<br/> +@foreach (var line in log.Reverse()) { + <pre>@line</pre> +} + +@code { + // TODO: Properly implement page to be more useful + private ObservableCollection<string> log { get; set; } = new(); + private AuthenticatedHomeserverGeneric hs { get; set; } + + [Parameter, SupplyParameterFromQuery(Name = "room")] + public string roomId { get; set; } + + + protected override async Task OnInitializedAsync() { + log.CollectionChanged += (sender, args) => StateHasChanged(); + hs = await RMUStorage.GetCurrentSessionOrNavigate(); + if (hs is null) return; + + StateHasChanged(); + Console.WriteLine("Rerendered!"); + await base.OnInitializedAsync(); + } + + private async Task<string> Execute() { + var room = hs.GetRoom("!fTjMjIzNKEsFlUIiru:neko.dev"); + // var room = hs.GetRoom("!yf7OpOiRDXx6zUGpT6:conduit.rory.gay"); + var users = roomId.Split("\n").Select(x => x.Trim()).Where(x=>x.StartsWith('@')).ToList(); + foreach (var user in users) { + var exists = false; + try { + exists = !string.IsNullOrWhiteSpace((await room.GetStateAsync<UserPolicyRuleEventContent>(UserPolicyRuleEventContent.EventId, user.Replace('@', '_'))).Entity); + } catch (Exception e) { + log.Add($"Failed to get {user}"); + } + + if (!exists) { + var evt = await room.SendStateEventAsync(UserPolicyRuleEventContent.EventId, user.Replace('@', '_'), new UserPolicyRuleEventContent() { + Entity = user, + Reason = "spam (invite)", + Recommendation = "m.ban" + }); + log.Add($"Sent {evt.EventId} to ban {user}"); + } + else { + log.Add($"User {user} already exists"); + } + } + + + StateHasChanged(); + + return ""; + } + +} \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Tools/Room/SpaceRestrictedJoins.razor b/MatrixUtils.Web/Pages/Tools/Room/SpaceRestrictedJoins.razor new file mode 100644 index 0000000..80a03f2 --- /dev/null +++ b/MatrixUtils.Web/Pages/Tools/Room/SpaceRestrictedJoins.razor @@ -0,0 +1,75 @@ +@page "/Tools/Room/SpaceRestrictedJoins" +@using System.Collections.ObjectModel +@using LibMatrix.EventTypes.Spec.State +<h3>Allow space to restricted join children</h3> +<hr/> + +<p>Room ID: </p> +<InputText @bind-Value="@RoomId"></InputText> +<p><InputCheckbox @bind-Value="@ChangeGuestAccess"/> Change guest access: <InputCheckbox @bind-Value="@GuestAccess"/></p> +<p><InputCheckbox @bind-Value="@ChangeKnocking"/> Change knock access: <InputCheckbox @bind-Value="@Knocking"/></p> + +<br/> +<LinkButton OnClick="Execute">Execute</LinkButton> +<br/> + +<br/> +@foreach (var line in log.Reverse()) { + <pre>@line</pre> +} + +@code { + private ObservableCollection<string> log { get; set; } = new(); + + private string RoomId { get; set; } + private AuthenticatedHomeserverGeneric hs { get; set; } + + private bool ChangeGuestAccess { get; set; } + private bool GuestAccess { get; set; } + private bool ChangeKnocking { get; set; } + private bool Knocking { get; set; } + + protected override async Task OnInitializedAsync() { + log.CollectionChanged += (sender, args) => StateHasChanged(); + hs = await RMUStorage.GetCurrentSessionOrNavigate(); + if (hs is null) return; + + StateHasChanged(); + Console.WriteLine("Rerendered!"); + await base.OnInitializedAsync(); + } + + private async Task Execute() { + var space = hs.GetRoom(RoomId).AsSpace; + await foreach (var room in space.GetChildrenAsync()) { + log.Add($"Got room {room.RoomId}"); + if (ChangeGuestAccess) { + var targetGuestAccess = GuestAccess ? "can_join" : "forbidden"; + var currentGuestAccess = (await room.GetStateAsync<RoomGuestAccessEventContent>(RoomGuestAccessEventContent.EventId))?.GuestAccess; + if (currentGuestAccess != targetGuestAccess) { + log.Add($"Changing guest access from {currentGuestAccess} to {targetGuestAccess}"); + await room.SendStateEventAsync(RoomGuestAccessEventContent.EventId, new RoomGuestAccessEventContent { GuestAccess = targetGuestAccess }); + } + } + + var currentJoinRules = (await room.GetStateOrNullAsync<RoomJoinRulesEventContent>(RoomJoinRulesEventContent.EventId)) ?? new(); + if (ChangeKnocking) { + var targetJoinRule = Knocking ? "knock_restricted" : "restricted"; + if (currentJoinRules.JoinRuleValue != targetJoinRule) { + log.Add($"Changing knocking from {currentJoinRules.JoinRuleValue} to {targetJoinRule}"); + currentJoinRules.JoinRuleValue = targetJoinRule; + await room.SendStateEventAsync(RoomJoinRulesEventContent.EventId, currentJoinRules); + } + } + + if (currentJoinRules.Allow == null || !currentJoinRules.Allow.Any(x => x.Type == "m.room_membership" && x.RoomId == RoomId)) { + log.Add($"Adding {RoomId} to allowed rooms"); + currentJoinRules.Allow ??= new(); + currentJoinRules.Allow.Add(new RoomJoinRulesEventContent.AllowEntry() { Type = "m.room_membership", RoomId = RoomId }); + await room.SendStateEventAsync(RoomJoinRulesEventContent.EventId, currentJoinRules); + } + } + log.Add("Done!"); + } + +} \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/User/Profile.razor b/MatrixUtils.Web/Pages/User/Profile.razor index 129f706..49af22f 100644 --- a/MatrixUtils.Web/Pages/User/Profile.razor +++ b/MatrixUtils.Web/Pages/User/Profile.razor @@ -4,6 +4,7 @@ @using LibMatrix @using LibMatrix.Responses @using MatrixUtils.Abstractions +@using Microsoft.AspNetCore.Components.Forms <h3>Manage Profile - @Homeserver?.WhoAmI?.UserId</h3> <hr/> diff --git a/MatrixUtils.Web/Shared/ActivityGraph.razor b/MatrixUtils.Web/Shared/ActivityGraph.razor index fa648c7..0f970af 100644 --- a/MatrixUtils.Web/Shared/ActivityGraph.razor +++ b/MatrixUtils.Web/Shared/ActivityGraph.razor @@ -1,6 +1,4 @@ -@using System.Drawing @using System.Runtime.InteropServices -@using System.Diagnostics @if (Data is { Count: > 0 }) { diff --git a/MatrixUtils.Web/Shared/EditablePre.razor b/MatrixUtils.Web/Shared/EditablePre.razor index acb477c..acb39c9 100644 --- a/MatrixUtils.Web/Shared/EditablePre.razor +++ b/MatrixUtils.Web/Shared/EditablePre.razor @@ -1,4 +1,4 @@ -@inherits InputBase<string> +@inherits Microsoft.AspNetCore.Components.Forms.InputBase<string> <pre id="@Id" class="@CssClass" @onkeyup="Callback" contenteditable="true">@CurrentValue</pre> @code { diff --git a/MatrixUtils.Web/Shared/InlineUserItem.razor b/MatrixUtils.Web/Shared/InlineUserItem.razor index 6df2307..9c6608a 100644 --- a/MatrixUtils.Web/Shared/InlineUserItem.razor +++ b/MatrixUtils.Web/Shared/InlineUserItem.razor @@ -1,7 +1,4 @@ -@using LibMatrix @using LibMatrix.EventTypes.Spec.State -@using LibMatrix.Helpers -@using LibMatrix.Homeservers @using LibMatrix.Responses <div style="background-color: #ffffff11; border-radius: 0.5em; height: 1em; display: inline-block; vertical-align: middle;" alt="@UserId"> <img style="@(ChildContent is not null ? "vertical-align: baseline;" : "vertical-align: top;") width: 1em; height: 1em; border-radius: 50%;" src="@ProfileAvatar"/> diff --git a/MatrixUtils.Web/Shared/RoomList.razor b/MatrixUtils.Web/Shared/RoomList.razor index 2ab3cef..42c5a9f 100644 --- a/MatrixUtils.Web/Shared/RoomList.razor +++ b/MatrixUtils.Web/Shared/RoomList.razor @@ -1,12 +1,7 @@ @using MatrixUtils.Web.Shared.RoomListComponents; -@using LibMatrix -@using LibMatrix.Extensions -@using ArcaneLibs.Extensions -@using LibMatrix.EventTypes.Spec.State @using System.Collections.ObjectModel @using LibMatrix.Responses @using MatrixUtils.Abstractions -@using _Imports = MatrixUtils.Web._Imports @if (!StillFetching) { <p>Fetching room details... @RoomsWithTypes.Sum(x => x.Value.Count) out of @Rooms.Count done!</p> @foreach (var category in RoomsWithTypes.OrderBy(x => x.Value.Count)) { diff --git a/MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor b/MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor index 7670ec5..1f5ce89 100644 --- a/MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor +++ b/MatrixUtils.Web/Shared/RoomListComponents/RoomListCategory.razor @@ -1,7 +1,5 @@ @using MatrixUtils.Web.Classes.Constants -@using LibMatrix @using LibMatrix.EventTypes.Spec.State -@using LibMatrix.Homeservers @using LibMatrix.Responses @using MatrixUtils.Abstractions <details open> diff --git a/MatrixUtils.Web/Shared/RoomListItem.razor b/MatrixUtils.Web/Shared/RoomListItem.razor index 5a33b65..bfaa900 100644 --- a/MatrixUtils.Web/Shared/RoomListItem.razor +++ b/MatrixUtils.Web/Shared/RoomListItem.razor @@ -1,10 +1,6 @@ -@using System.Text.Json @using LibMatrix @using LibMatrix.EventTypes.Spec.State -@using LibMatrix.Helpers -@using LibMatrix.Homeservers @using LibMatrix.Responses -@using LibMatrix.RoomTypes @using MatrixUtils.Abstractions @using MatrixUtils.Web.Classes.Constants @if (RoomInfo is not null) { diff --git a/MatrixUtils.Web/Shared/UserListItem.razor b/MatrixUtils.Web/Shared/UserListItem.razor index daa9c9e..d4652b2 100644 --- a/MatrixUtils.Web/Shared/UserListItem.razor +++ b/MatrixUtils.Web/Shared/UserListItem.razor @@ -1,6 +1,3 @@ -@using LibMatrix.Helpers -@using LibMatrix.EventTypes.Spec.State -@using LibMatrix.Homeservers @using LibMatrix.Responses @using ArcaneLibs <div style="background-color: #ffffff11; border-radius: 25px; margin: 8px; width: fit-Content;"> diff --git a/MatrixUtils.Web/_Imports.razor b/MatrixUtils.Web/_Imports.razor index 87d7cb2..81c7874 100644 --- a/MatrixUtils.Web/_Imports.razor +++ b/MatrixUtils.Web/_Imports.razor @@ -1,18 +1,19 @@ @using System.Net.Http @using System.Net.Http.Json -@using Blazored.LocalStorage +@* @using Blazored.LocalStorage *@ @using LibMatrix.Services @using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web -@using Microsoft.AspNetCore.Components.Web.Virtualization +@* @using Microsoft.AspNetCore.Components.Web.Virtualization *@ @using Microsoft.AspNetCore.Components.WebAssembly.Http -@using Microsoft.JSInterop +@* @using Microsoft.JSInterop *@ @using MatrixUtils.Web @using MatrixUtils.Web.Classes @using MatrixUtils.Web.Shared @using ArcaneLibs.Blazor.Components @using LibMatrix.Homeservers +@using Microsoft.JSInterop @inject NavigationManager NavigationManager @inject RMUStorageWrapper RMUStorage diff --git a/MxApiExtensions b/MxApiExtensions -Subproject c673f705cd62346f5995415414e309bb56b18c6 +Subproject 86e41aa749d961c5731ea52e570cf0f9e8f8d3a diff --git a/global.json b/global.json index 37704f0..ecc6db8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.0", + "version": "8.0.0", "rollForward": "latestMajor", "allowPrerelease": true } |