about summary refs log tree commit diff
path: root/MatrixUtils.Web/Pages/HSAdmin/HSAdmin.razor
blob: 9c614314e8b8338408a68baafe6b568f00b92e3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@page "/HSAdmin"
@using ArcaneLibs.Extensions
<h3>Homeserver Admininistration</h3>
<hr/>

@if (Homeserver is null) {
    <p>Homeserver is null...</p>
}
else {
    @if (Homeserver is AuthenticatedHomeserverSynapse) {
        <h4>Synapse tools</h4>
        <hr/>
        <a href="/HSAdmin/RoomQuery">Query rooms</a>
    }
    else {
        <p>Homeserver type @Homeserver.GetType().Name does not have any administration tools in RMU.</p>
        <p>Server info:</p>
        <pre>@ServerVersionResponse?.ToJson(ignoreNull: true)</pre>
    }
}

@code {
    public AuthenticatedHomeserverGeneric? Homeserver { get; set; }
    public ServerVersionResponse? ServerVersionResponse { get; set; }

    protected override async Task OnInitializedAsync() {
        Homeserver = await RMUStorage.GetCurrentSessionOrNavigate();
        if (Homeserver is null) return;
        ServerVersionResponse = await (Homeserver.FederationClient?.GetServerVersionAsync() ?? Task.FromResult<ServerVersionResponse?>(null));
        await base.OnInitializedAsync();
    }

}