@page "/Debug"
@using MatrixRoomUtils.Core.Interfaces
@using MatrixRoomUtils.Core.Extensions
@using System.Reflection
@inject ILocalStorageService LocalStorage
@inject NavigationManager NavigationManager
Debug Tools
@if (Rooms.Count == 0)
{
You are not in any rooms!
@* Loading progress: @checkedRoomCount/@totalRoomCount
*@
}
else
{
Room List
@foreach (var room in Rooms)
{
}
}
Send GET request to URL
@get_request_result
@code {
public List Rooms { get; set; } = new();
protected override async Task OnInitializedAsync()
{
await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
await base.OnInitializedAsync();
if (RuntimeCache.CurrentHomeServer == null)
{
NavigationManager.NavigateTo("/Login");
return;
}
Rooms = (await RuntimeCache.CurrentHomeServer.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(IHomeServer).GetRuntimeFields().First(x => x.ToString().Contains("<_httpClient>k__BackingField"));
var httpClient = field.GetValue(RuntimeCache.CurrentHomeServer) as HttpClient;
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