about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/MediaLocator.razor
blob: cd244ef434d65e38e9db2bdf6b18396f5ab2f160 (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
@page "/MediaLocator"
<h3>MediaLocator</h3>
<hr/>

<span>MXC URL: </span>
<input type="text" @bind="mxcUrl" />
<button @onclick="executeSearch">Search</button>


@code {
    string mxcUrl { get; set; }
    List<string> successResults = new List<string>();
    List<string> errorResults = new List<string>();
    List<string> homeservers = new List<string>();

    protected override async Task OnInitializedAsync()
    {
        base.OnInitializedAsync();
        
    }

    async Task executeSearch()
    {
        var client = new HttpClient();
        var response = await client.GetAsync($"https://matrix.org/_matrix/media/r0/identicon/{mxcUrl}");
        if (response.IsSuccessStatusCode)
        {
            successResults.Add(mxcUrl);
        }
        else
        {
            errorResults.Add(mxcUrl);
        }
    }

}