@page "/Export"
@using MatrixRoomUtils.Web.Shared.IndexComponents
@using System.Text.Json
@inject NavigationManager NavigationManager
@inject ILocalStorageService LocalStorage
@user.LoginResponse.UserId[1..].Split(":")[0]\auth\access_token=@token @user.LoginResponse.UserId[1..].Split(":")[0]\auth\device_id=@user.LoginResponse.DeviceId @user.LoginResponse.UserId[1..].Split(":")[0]\auth\home_server=@(RuntimeCache.HomeserverResolutionCache.ContainsKey(user.LoginResponse.HomeServer) ? RuntimeCache.HomeserverResolutionCache[user.LoginResponse.HomeServer].Result : "loading...") @user.LoginResponse.UserId[1..].Split(":")[0]\auth\user_id=@@@user.LoginResponse.UserId @user.LoginResponse.UserId[1..].Split(":")[0]\user\automatically_share_keys_with_trusted_users=true @user.LoginResponse.UserId[1..].Split(":")[0]\user\muted_tags=global @user.LoginResponse.UserId[1..].Split(":")[0]\user\online_key_backup=true @user.LoginResponse.UserId[1..].Split(":")[0]\user\only_share_keys_with_verified_users=false} } else {
Loading...
@resolvedHomeservers/@totalHomeservers homeservers resolved...
} @code { private bool _isLoaded; private int resolvedHomeservers; private int totalHomeservers; protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); if (!RuntimeCache.WasLoaded) { await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); } var homeservers = RuntimeCache.LoginSessions.Values.Select(x => x.LoginResponse.HomeServer).Distinct(); totalHomeservers = homeservers.Count(); StateHasChanged(); foreach (var hs in homeservers) { if (RuntimeCache.HomeserverResolutionCache.ContainsKey(hs)) { resolvedHomeservers++; continue; } var resolvedHomeserver = (await new RemoteHomeServer(hs).Configure()).FullHomeServerDomain; RuntimeCache.HomeserverResolutionCache.Add(hs, new() { Result = resolvedHomeserver, ResolutionTime = DateTime.Now }); await LocalStorageWrapper.SaveToLocalStorage(LocalStorage); Console.WriteLine("Saved to local storage:"); Console.WriteLine(JsonSerializer.Serialize(RuntimeCache.HomeserverResolutionCache, new JsonSerializerOptions() { WriteIndented = true })); resolvedHomeservers++; StateHasChanged(); } StateHasChanged(); _isLoaded = true; } }