about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/About.razor
blob: b8d9c4a6706eab74986a5738b92dd2b880e7d224 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
@page "/About"
@using System.Net
@using System.Net.Sockets
@inject NavigationManager NavigationManager
@inject ILocalStorageService LocalStorage
@using XtermBlazor

<PageTitle>About</PageTitle>

<h3>Rory&::MatrixUtils - About</h3>
<hr/>
<p>Rory&::MatrixRoomUtils is a "small" collection of tools to do not-so-everyday things.</p>
<p>These range from joining rooms on dead homeservers, to managing your accounts and rooms, and creating rooms based on templates.</p>

<br/><br/>
<p>You can find the source code on <a href="https://git.rory.gay/MatrixRoomUtils.git/">my git server</a>.<br/></p>
<p>You can also join the <a href="https://matrix.to/#/%23mru%3Arory.gay?via=rory.gay&via=matrix.org&via=feline.support">Matrix room</a> for this project.</p>
@if (showBinDownload) {
    <p>This deployment also serves a copy of the compiled, hosting-ready binaries at <a href="MRU-BIN.tar.xz">/MRU-BIN.tar.xz</a>!</p>
}
@if (showSrcDownload) {
    <p>This deployment also serves a copy of the compiled, hosting-ready binaries at <a href="MRU-SRC.tar.xz">/MRU-SRC.tar.xz</a>!</p>
}

<Xterm @ref="_terminal" Options="_options" OnFirstRender="@OnFirstRender"  style="max-width: fit-content; overflow-x: hidden;"/>



@code {
    private bool showBinDownload { get; set; }
    private bool showSrcDownload { get; set; }

    protected override async Task OnInitializedAsync() {
        using var hc = new HttpClient();
        var hr = await hc.SendAsync(new HttpRequestMessage(HttpMethod.Head, NavigationManager.ToAbsoluteUri("/MRU-BIN.tar.xz").AbsoluteUri));
        showBinDownload = hr.StatusCode == HttpStatusCode.OK;
        hr = await hc.SendAsync(new HttpRequestMessage(HttpMethod.Head, NavigationManager.ToAbsoluteUri("/MRU-SRC.tar.xz").AbsoluteUri));
        showSrcDownload = hr.StatusCode == HttpStatusCode.OK;
        await base.OnInitializedAsync();
    }


    private Xterm _terminal;

    private TerminalOptions _options = new TerminalOptions
    {
        CursorBlink = true,
        CursorStyle = CursorStyle.Block,
        Theme =
        {
            Background = "#17615e",
        },
    };

    private async Task OnFirstRender() {
        var message = "Hello, World!\nThis is a terminal emulator!\n\nYou can type stuff here, and it will be sent to the server!\n\nThis is a test of the emergency broadcast system.\n\nThis is only a t";
        _terminal.Options.RendererType = RendererType.Dom;
        _terminal.Options.ScreenReaderMode = true;
        TcpClient.
        for (var i = 0; i < message.Length; i++) {
            await _terminal.Write(message[i].ToString());

            await Task.Delay(50);
            _terminal.Options.Theme.Background = $"#{(i * 2):X6}";
        }
    }
}