diff --git a/MatrixRoomUtils.Web/Pages/Dev/DevOptions.razor b/MatrixRoomUtils.Web/Pages/Dev/DevOptions.razor
new file mode 100644
index 0000000..9b0f61c
--- /dev/null
+++ b/MatrixRoomUtils.Web/Pages/Dev/DevOptions.razor
@@ -0,0 +1,30 @@
+@page "/Dev/Options"
+@using ArcaneLibs.Extensions
+@inject NavigationManager NavigationManager
+@inject ILocalStorageService LocalStorage
+
+<PageTitle>Developer options</PageTitle>
+
+<h3>Rory&::MatrixUtils - Developer options</h3>
+<hr/>
+
+<InputCheckbox @bind-Value="@settings.DeveloperSettings.EnableLogViewers" @oninput="@LogStuff"></InputCheckbox><label> Enable log views</label><br/>
+<InputCheckbox @bind-Value="@settings.DeveloperSettings.EnableConsoleLogging" @oninput="@LogStuff"></InputCheckbox><label> Enable console logging</label><br/>
+<InputCheckbox @bind-Value="@settings.DeveloperSettings.EnablePortableDevtools" @oninput="@LogStuff"></InputCheckbox><label> Enable portable devtools</label><br/>
+<br/>
+
+@code {
+
+ MRUStorageWrapper.Settings settings { get; set; } = new();
+ protected override async Task OnInitializedAsync() {
+ settings = await TieredStorage.DataStorageProvider.LoadObjectAsync<MRUStorageWrapper.Settings>("mru.settings");
+ await base.OnInitializedAsync();
+ }
+
+ private async Task LogStuff() {
+ await Task.Delay(100);
+ Console.WriteLine($"Settings: {settings.ToJson()}");
+ await TieredStorage.DataStorageProvider.SaveObjectAsync("mru.settings", settings);
+ }
+
+}
diff --git a/MatrixRoomUtils.Web/Pages/Dev/DevUtilities.razor b/MatrixRoomUtils.Web/Pages/Dev/DevUtilities.razor
new file mode 100644
index 0000000..f7e6aec
--- /dev/null
+++ b/MatrixRoomUtils.Web/Pages/Dev/DevUtilities.razor
@@ -0,0 +1,79 @@
+@page "/Dev/Utilities"
+@using System.Reflection
+@using ArcaneLibs.Extensions
+@using LibMatrix.Extensions
+@using LibMatrix.Homeservers
+@inject ILocalStorageService LocalStorage
+@inject NavigationManager NavigationManager
+<h3>Debug Tools</h3>
+<hr/>
+@if (Rooms.Count == 0) {
+ <p>You are not in any rooms!</p>
+ @* <p>Loading progress: @checkedRoomCount/@totalRoomCount</p> *@
+}
+else {
+ <details>
+ <summary>Room List</summary>
+ @foreach (var room in Rooms) {
+ <a style="color: unset; text-decoration: unset;" href="/RoomStateViewer/@room.Replace('.', '~')">
+ <RoomListItem RoomId="@room"></RoomListItem>
+ </a>
+ }
+ </details>
+}
+
+<details open>
+ <summary>Send GET request to URL</summary>
+ <div class="input-group">
+ <input type="text" class="form-control" @bind-value="get_request_url" placeholder="URL">
+ <button class="btn btn-outline-secondary" type="button" @onclick="SendGetRequest">Send</button>
+ </div>
+ <br/>
+ <pre>@get_request_result</pre>
+</details>
+
+<div style="margin-bottom: 4em;"></div>
+<LogView></LogView>
+
+@code {
+ public List<string> Rooms { get; set; } = new();
+
+ protected override async Task OnInitializedAsync() {
+ await base.OnInitializedAsync();
+ var hs = await MRUStorage.GetCurrentSessionOrNavigate();
+ if (hs == null) return;
+ Rooms = (await hs.GetJoinedRooms()).Select(x => x.RoomId).ToList();
+ Console.WriteLine("Fetched joined rooms!");
+ }
+
+ //send req
+ string get_request_url { get; set; } = "";
+ string get_request_result { get; set; } = "";
+
+ private async Task SendGetRequest() {
+ var field = typeof(RemoteHomeServer).GetRuntimeFields().First(x => x.ToString().Contains("<_httpClient>k__BackingField"));
+ var hs = await MRUStorage.GetCurrentSessionOrNavigate();
+ if (hs == null) return;
+ var httpClient = field.GetValue(hs) as MatrixHttpClient;
+ try {
+ var res = await httpClient.GetAsync(get_request_url);
+ if (res.IsSuccessStatusCode) {
+ if (res.Content.Headers.ContentType.MediaType == "application/json")
+ get_request_result = (await res.Content.ReadFromJsonAsync<object>()).ToJson();
+ else
+ get_request_result = await res.Content.ReadAsStringAsync();
+ StateHasChanged();
+ return;
+ }
+ if (res.Content.Headers.ContentType.MediaType == "application/json")
+ get_request_result = $"Error: {res.StatusCode}\n" + (await res.Content.ReadFromJsonAsync<object>()).ToJson();
+ else
+ get_request_result = $"Error: {res.StatusCode}\n" + await res.Content.ReadAsStringAsync();
+ }
+ catch (Exception e) {
+ get_request_result = $"Error: {e}";
+ }
+ StateHasChanged();
+ }
+
+}
diff --git a/MatrixRoomUtils.Web/Pages/Dev/ModalTest.razor b/MatrixRoomUtils.Web/Pages/Dev/ModalTest.razor
new file mode 100644
index 0000000..4a0487f
--- /dev/null
+++ b/MatrixRoomUtils.Web/Pages/Dev/ModalTest.razor
@@ -0,0 +1,88 @@
+@page "/Dev/ModalTest"
+@inject IJSRuntime JsRuntime
+<h3>ModalTest</h3>
+
+@foreach (var (key, value) in _windowInfos) {
+ @* <ModalWindow X="@value.X" Y="@value.Y" Title="@value.Title">@value.Content</ModalWindow> *@
+}
+@for (var i = 0; i < 5; i++) {
+ var i1 = i;
+ <ModalWindow X="@Random.Shared.Next(1400)" Y="@Random.Shared.Next(1000)" Title="@("Window " + i1)" OnCloseClicked="() => OnCloseClicked(i1)">
+ @for (var j = 0; j < i1; j++) {
+ <h1>@j</h1>
+ }
+ </ModalWindow>
+}
+
+@code {
+
+ private Dictionary<int, WindowInfo> _windowInfos = new();
+
+ private class WindowInfo {
+ public double X;
+ public double Y;
+ public string Title;
+ public RenderFragment Content;
+ }
+
+ protected override async Task OnInitializedAsync() {
+ double _x = 2;
+ double _xv = 20;
+ double _y = 0;
+ double multiplier = 1;
+
+ for (var i = 0; i < 200; i++) {
+ var i1 = i;
+ _windowInfos.Add(_windowInfos.Count, new WindowInfo {
+ X = _x,
+ Y = _y,
+ Title = "Win" + i1,
+ Content = builder => {
+ builder.OpenComponent<ModalWindow>(0);
+ builder.AddAttribute(1, "X", _x);
+ builder.AddAttribute(2, "Y", _y);
+ builder.AddAttribute(3, "Title", "Win" + i1);
+ builder.AddAttribute(4, "ChildContent", (RenderFragment)(builder2 => {
+ builder2.OpenElement(0, "h1");
+ builder2.AddContent(1, "Hello " + i1);
+ builder2.CloseElement();
+ }));
+ builder.CloseComponent();
+ }
+ });
+ //_x += _xv /= 1000/System.Math.Sqrt((double)_windowInfos.Count)*_windowInfos.Count.ToString().Length*multiplier;
+ _y += 20;
+ _x += 20;
+ var dimension = await JsRuntime.InvokeAsync<WindowDimension>("getWindowDimensions");
+ if (_x > dimension.Width - 100) _x %= dimension.Width - 100;
+ if (_y > dimension.Height - 50) {
+ _y %= dimension.Height - 50;
+ _xv = 20;
+ }
+ if (
+ (_windowInfos.Count < 10 && _windowInfos.Count % 2 == 0) ||
+ (_windowInfos.Count < 100 && _windowInfos.Count % 10 == 0) ||
+ (_windowInfos.Count < 1000 && _windowInfos.Count % 50 == 0) ||
+ (_windowInfos.Count < 10000 && _windowInfos.Count % 100 == 0)
+ ) {
+ StateHasChanged();
+ await Task.Delay(25);
+ }
+ if(_windowInfos.Count > 750) multiplier = 2;
+ if(_windowInfos.Count > 1500) multiplier = 3;
+
+ }
+
+ await base.OnInitializedAsync();
+ }
+
+ private void OnCloseClicked(int i1) {
+ Console.WriteLine("Close clicked on " + i1);
+ }
+
+ public class WindowDimension {
+ public int Width { get; set; }
+ public int Height { get; set; }
+ }
+
+}
|