From c37bcb0e4a878d4f4c0e47988adb8624131c82cd Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Thu, 9 Nov 2023 07:38:33 +0100 Subject: event types --- MatrixRoomUtils.Web/Pages/Index.razor | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'MatrixRoomUtils.Web/Pages/Index.razor') diff --git a/MatrixRoomUtils.Web/Pages/Index.razor b/MatrixRoomUtils.Web/Pages/Index.razor index 74dd651..804fde3 100644 --- a/MatrixRoomUtils.Web/Pages/Index.razor +++ b/MatrixRoomUtils.Web/Pages/Index.razor @@ -3,6 +3,7 @@ @using LibMatrix @using LibMatrix.Homeservers @using ArcaneLibs.Extensions +@using MatrixRoomUtils.Web.Pages.Dev Index @@ -28,13 +29,18 @@ Small collection of tools to do not-so-everyday things.

@__auth.UserInfo.RoomCount rooms - @__auth.ServerVersion.Server.Name @__auth.ServerVersion.Server.Version + @__auth.ServerVersion.Server.Name @__auth.ServerVersion.Server.Version @if (_auth.Proxy != null) { (proxied via @_auth.Proxy) } else {

Not proxied

} + @if (DEBUG) { +

T=@__auth.Homeserver.GetType().FullName

+

D=@__auth.Homeserver.WhoAmI.DeviceId

+

U=@__auth.Homeserver.WhoAmI.UserId

+ }

@@ -51,10 +57,17 @@ Small collection of tools to do not-so-everyday things. @code { +#if DEBUG + bool DEBUG = true; +#else + bool DEBUG = false; +#endif + private class AuthInfo { public UserAuth UserAuth { get; set; } public UserInfo UserInfo { get; set; } public ServerVersionResponse ServerVersion { get; set; } + public AuthenticatedHomeserverGeneric Homeserver { get; set; } } // private Dictionary _users = new(); @@ -69,7 +82,7 @@ Small collection of tools to do not-so-everyday things. UserInfo userInfo = new(); AuthenticatedHomeserverGeneric hs; try { - hs = await hsProvider.GetAuthenticatedWithToken(token.Homeserver, token.AccessToken); + hs = await hsProvider.GetAuthenticatedWithToken(token.Homeserver, token.AccessToken, token.Proxy); } catch (MatrixException e) { if (e.ErrorCode == "M_UNKNOWN_TOKEN") { @@ -88,7 +101,8 @@ Small collection of tools to do not-so-everyday things. _auth.Add(new() { UserInfo = userInfo, UserAuth = token, - ServerVersion = await hs.GetServerVersionAsync() + ServerVersion = await hs.GetServerVersionAsync(), + Homeserver = hs }); // StateHasChanged(); }); @@ -105,7 +119,7 @@ Small collection of tools to do not-so-everyday things. private async Task RemoveUser(UserAuth auth, bool logout = false) { try { if (logout) { - await (await hsProvider.GetAuthenticatedWithToken(auth.Homeserver, auth.AccessToken)).Logout(); + await (await hsProvider.GetAuthenticatedWithToken(auth.Homeserver, auth.AccessToken, auth.Proxy)).Logout(); } } catch (Exception e) { -- cgit 1.5.1