blob: fb8c248347f65e55361befdf1d2769c757ad82d7 (
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
|
<img class="@Class" src="@ResolvedUri" style="@Style"/>
@code {
private string _mxcUri;
private string _style;
private string _resolvedUri;
[Parameter]
public string MxcUri {
get => _mxcUri ?? "";
set {
Console.WriteLine($"New MXC uri: {value}");
_mxcUri = value;
UriHasChanged(value);
}
}
//mxcuri binding
[Parameter]
public string Style {
get => _style;
set {
_style = value;
StateHasChanged();
}
}
[Parameter]
public RemoteHomeserver? Homeserver { get; set; }
private string ResolvedUri {
get => _resolvedUri;
set {
_resolvedUri = value;
StateHasChanged();
}
}
private async Task UriHasChanged(string value) {
var uri = value[5..].Split('/');
Console.WriteLine($"UriHasChanged: {value} {uri[0]}");
if (Homeserver is null) {
Console.WriteLine($"Homeserver is null, creating new remotehomeserver for {uri[0]}");
Homeserver = await hsProvider.GetRemoteHomeserver(uri[0]);
}
ResolvedUri = Homeserver.ResolveMediaUri(value);
Console.WriteLine($"ResolvedUri: {ResolvedUri}");
}
[Parameter]
public string Class { get; set; }
}
|