about summary refs log tree commit diff
path: root/MatrixUtils.Web/Pages/HSAdmin/HSE
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-02-21 18:13:02 +0100
committerRory& <root@rory.gay>2025-02-21 18:13:02 +0100
commit863faaa050c4ba02190c0d53e41d931df890e593 (patch)
tree30db3ea27fb6866c319f70ca9c0ae158ef123528 /MatrixUtils.Web/Pages/HSAdmin/HSE
parentSome cleanup (diff)
downloadMatrixUtils-863faaa050c4ba02190c0d53e41d931df890e593.tar.xz
HomeserverEmulator changes
Diffstat (limited to 'MatrixUtils.Web/Pages/HSAdmin/HSE')
-rw-r--r--MatrixUtils.Web/Pages/HSAdmin/HSE/ManageExternalProfiles.razor43
1 files changed, 43 insertions, 0 deletions
diff --git a/MatrixUtils.Web/Pages/HSAdmin/HSE/ManageExternalProfiles.razor b/MatrixUtils.Web/Pages/HSAdmin/HSE/ManageExternalProfiles.razor
new file mode 100644

index 0000000..6d492a7 --- /dev/null +++ b/MatrixUtils.Web/Pages/HSAdmin/HSE/ManageExternalProfiles.razor
@@ -0,0 +1,43 @@ +@page "/HSAdmin/HSE/ManageExternalProfiles" +@using ArcaneLibs.Extensions +@using LibMatrix.Responses +<h3>Manage external profiles</h3> + +<LinkButton OnClick="AddAllLocalProfiles">Add local sessions</LinkButton> + +@foreach(var p in ExternalProfiles) +{ + <h4>@p.Key</h4> + <pre>@p.Value.ToJson(indent: true)</pre> +} + +@code { + public AuthenticatedHomeserverGeneric? Homeserver { get; set; } + private Dictionary<string, LoginResponse> ExternalProfiles = new(); + + protected override async Task OnInitializedAsync() + { + Homeserver = await RmuStorage.GetCurrentSessionOrNavigate(); + if (Homeserver is null) return; + await LoadProfiles(); + await base.OnInitializedAsync(); + } + + private async Task LoadProfiles() { + if(Homeserver is AuthenticatedHomeserverHSE hse) + { + ExternalProfiles = await hse.GetExternalProfilesAsync(); + } + StateHasChanged(); + } + + private async Task AddAllLocalProfiles() { + if(Homeserver is AuthenticatedHomeserverHSE hse) { + var sessions = await RmuStorage.GetAllTokens(); + foreach(var session in sessions) { + await hse.SetExternalProfile(session.UserId, session); + } + await LoadProfiles(); + } + } +} \ No newline at end of file