@page "/HSAdmin/HSE/ManageExternalProfiles"
@using ArcaneLibs.Extensions
@using LibMatrix.Responses
Manage external profiles
Add local sessions
@foreach(var p in ExternalProfiles)
{
@p.Key
@p.Value.ToJson(indent: true)
}
@code {
public AuthenticatedHomeserverGeneric? Homeserver { get; set; }
private Dictionary ExternalProfiles = new();
protected override async Task OnInitializedAsync()
{
Homeserver = await sessionStore.GetCurrentHomeserver(navigateOnFailure: true);
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 sessionStore.GetAllSessions();
foreach(var session in sessions) {
await hse.SetExternalProfile(session.Value.Auth.UserId, session.Value.Auth);
}
await LoadProfiles();
}
}
}