From 98e89232ff50b9c48a11fcae27869806490b1187 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Thu, 7 Dec 2023 07:27:37 +0100 Subject: Temp state --- MatrixRoomUtils.Web/Pages/Index.razor | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'MatrixRoomUtils.Web/Pages/Index.razor') diff --git a/MatrixRoomUtils.Web/Pages/Index.razor b/MatrixRoomUtils.Web/Pages/Index.razor index 804fde3..68a4f26 100644 --- a/MatrixRoomUtils.Web/Pages/Index.razor +++ b/MatrixRoomUtils.Web/Pages/Index.razor @@ -1,4 +1,5 @@ @page "/" +@inject ILogger logger @using LibMatrix.Responses @using LibMatrix @using LibMatrix.Homeservers @@ -26,7 +27,6 @@ Small collection of tools to do not-so-everyday things.

@__auth.UserInfo.DisplayName on @_auth.Homeserver
-

@__auth.UserInfo.RoomCount rooms @__auth.ServerVersion.Server.Name @__auth.ServerVersion.Server.Version @@ -91,20 +91,24 @@ Small collection of tools to do not-so-everyday things. } throw; } + catch (HttpRequestException e) { + logger.LogError(e, $"Failed to instantiate AuthenticatedHomeserver for {_auth}, homeserver may be offline?", token.UserId); + return; + } var roomCountTask = hs.GetJoinedRooms(); var profile = await hs.GetProfileAsync(hs.WhoAmI.UserId); userInfo.DisplayName = profile.DisplayName ?? hs.WhoAmI.UserId; Console.WriteLine(profile.ToJson()); - userInfo.AvatarUrl = string.IsNullOrWhiteSpace(profile.AvatarUrl) ? "https://api.dicebear.com/6.x/identicon/svg?seed=" + hs.WhoAmI.UserId : hs.ResolveMediaUri(profile.AvatarUrl); - userInfo.RoomCount = (await roomCountTask).Count; - // _users.Add(token, userInfo); _auth.Add(new() { - UserInfo = userInfo, + UserInfo = new() { + AvatarUrl = string.IsNullOrWhiteSpace(profile.AvatarUrl) ? "https://api.dicebear.com/6.x/identicon/svg?seed=" + hs.WhoAmI.UserId : hs.ResolveMediaUri(profile.AvatarUrl), + RoomCount = (await roomCountTask).Count, + DisplayName = profile.DisplayName ?? hs.WhoAmI.UserId + }, UserAuth = token, ServerVersion = await hs.GetServerVersionAsync(), Homeserver = hs }); - // StateHasChanged(); }); await Task.WhenAll(profileTasks); await base.OnInitializedAsync(); -- cgit 1.5.1