diff options
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/Rooms')
-rw-r--r-- | MatrixRoomUtils.Web/Pages/Rooms/Create.razor | 22 | ||||
-rw-r--r-- | MatrixRoomUtils.Web/Pages/Rooms/Index.razor | 10 | ||||
-rw-r--r-- | MatrixRoomUtils.Web/Pages/Rooms/PolicyList.razor | 28 | ||||
-rw-r--r-- | MatrixRoomUtils.Web/Pages/Rooms/Space.razor | 2 | ||||
-rw-r--r-- | MatrixRoomUtils.Web/Pages/Rooms/StateEditor.razor | 3 | ||||
-rw-r--r-- | MatrixRoomUtils.Web/Pages/Rooms/StateViewer.razor | 3 | ||||
-rw-r--r-- | MatrixRoomUtils.Web/Pages/Rooms/Timeline.razor | 8 |
7 files changed, 38 insertions, 38 deletions
diff --git a/MatrixRoomUtils.Web/Pages/Rooms/Create.razor b/MatrixRoomUtils.Web/Pages/Rooms/Create.razor index 3b7d000..c6fd5b6 100644 --- a/MatrixRoomUtils.Web/Pages/Rooms/Create.razor +++ b/MatrixRoomUtils.Web/Pages/Rooms/Create.razor @@ -1,15 +1,15 @@ @page "/Rooms/Create" @using System.Text.Json @using System.Reflection +@using ArcaneLibs.Extensions @using LibMatrix @using LibMatrix.Extensions @using LibMatrix.Helpers +@using LibMatrix.Homeservers @using LibMatrix.Responses @using LibMatrix.StateEventTypes.Spec -@using LibMatrix.StateEventTypes @using MatrixRoomUtils.Web.Classes.RoomCreationTemplates @* @* ReSharper disable once RedundantUsingDirective - Must not remove this, Rider marks this as "unused" when it's not */ *@ -@using MatrixRoomUtils.Web.Shared.SimpleComponents <h3>Room Manager - Create Room</h3> @@ -135,7 +135,7 @@ } else { <details> - <summary>@((creationEvent["m.room.server_acls"].TypedContent as ServerACLEventData).Allow.Count) allow rules</summary> + <summary>@((creationEvent["m.room.server_acls"].TypedContent as ServerACLEventContent).Allow.Count) allow rules</summary> @* <StringListEditor @bind-Items="@serverAcl.Allow"></StringListEditor> *@ </details> } @@ -145,7 +145,7 @@ } else { <details> - <summary>@((creationEvent["m.room.server_acls"].TypedContent as ServerACLEventData).Deny.Count) deny rules</summary> + <summary>@((creationEvent["m.room.server_acls"].TypedContent as ServerACLEventContent).Deny.Count) deny rules</summary> @* <StringListEditor @bind-Items="@serverAcl.Allow"></StringListEditor> *@ </details> } @@ -251,14 +251,14 @@ private CreateRoomRequest? creationEvent { get; set; } private Dictionary<string, CreateRoomRequest>? Presets { get; set; } = new(); - private AuthenticatedHomeServer? HomeServer { get; set; } + private AuthenticatedHomeserverGeneric? HomeServer { get; set; } private MatrixException? _matrixException { get; set; } - private HistoryVisibilityEventData? historyVisibility => creationEvent?["m.room.history_visibility"].TypedContent as HistoryVisibilityEventData; - private GuestAccessEventData? guestAccessEvent => creationEvent?["m.room.guest_access"].TypedContent as GuestAccessEventData; - private ServerACLEventData? serverAcl => creationEvent?["m.room.server_acls"].TypedContent as ServerACLEventData; - private RoomAvatarEventData? roomAvatarEvent => creationEvent?["m.room.avatar"].TypedContent as RoomAvatarEventData; + private HistoryVisibilityEventContent? historyVisibility => creationEvent?["m.room.history_visibility"].TypedContent as HistoryVisibilityEventContent; + private GuestAccessEventContent? guestAccessEvent => creationEvent?["m.room.guest_access"].TypedContent as GuestAccessEventContent; + private ServerACLEventContent? serverAcl => creationEvent?["m.room.server_acls"].TypedContent as ServerACLEventContent; + private RoomAvatarEventContent? roomAvatarEvent => creationEvent?["m.room.avatar"].TypedContent as RoomAvatarEventContent; protected override async Task OnInitializedAsync() { HomeServer = await MRUStorage.GetCurrentSessionOrNavigate(); @@ -284,7 +284,7 @@ private async Task RoomIconFilePicked(InputFileChangeEventArgs obj) { var res = await HomeServer.UploadFile(obj.File.Name, obj.File.OpenReadStream(), obj.File.ContentType); Console.WriteLine(res); - (creationEvent["m.room.avatar"].TypedContent as RoomAvatarEventData).Url = res; + (creationEvent["m.room.avatar"].TypedContent as RoomAvatarEventContent).Url = res; StateHasChanged(); } @@ -305,7 +305,7 @@ creationEvent.InitialState.Add(new StateEvent { Type = "m.room.member", StateKey = mxid, - TypedContent = new RoomMemberEventData { + TypedContent = new RoomMemberEventContent { Membership = "invite", Reason = "Automatically invited at room creation time." } diff --git a/MatrixRoomUtils.Web/Pages/Rooms/Index.razor b/MatrixRoomUtils.Web/Pages/Rooms/Index.razor index ad3a714..c2daba7 100644 --- a/MatrixRoomUtils.Web/Pages/Rooms/Index.razor +++ b/MatrixRoomUtils.Web/Pages/Rooms/Index.razor @@ -1,10 +1,10 @@ @page "/Rooms" -@using LibMatrix.StateEventTypes @using LibMatrix.StateEventTypes.Spec @using LibMatrix.Filters @using LibMatrix.Helpers @using LibMatrix.Responses <h3>Room list</h3> + <p>@Status</p> @if (RenderContents) { <RoomList Rooms="Rooms" GlobalProfile="@GlobalProfile"></RoomList> @@ -16,7 +16,7 @@ public List<RoomInfo> KnownRooms { get; set; } = new(); private List<RoomInfo> Rooms { get; set; } = new(); - private ProfileResponseEventData GlobalProfile { get; set; } + private ProfileResponseEventContent GlobalProfile { get; set; } private SyncFilter filter = new() { AccountData = new SyncFilter.EventFilter { @@ -93,7 +93,7 @@ if (!roomInfo.StateEvents.Any(x => x.Type == "m.room.name")) { roomInfo.StateEvents.Add(new StateEventResponse { Type = "m.room.name", - TypedContent = new RoomNameEventData { + TypedContent = new RoomNameEventContent { Name = roomInfo.Room.RoomId } }); @@ -101,7 +101,7 @@ if (!roomInfo.StateEvents.Any(x => x.Type == "m.room.avatar")) { roomInfo.StateEvents.Add(new StateEventResponse { Type = "m.room.avatar", - TypedContent = new RoomAvatarEventData { + TypedContent = new RoomAvatarEventContent { } }); @@ -121,7 +121,7 @@ roomInfo.StateEvents.Add(new StateEventResponse { Type = "m.room.member", StateKey = hs.WhoAmI.UserId, - TypedContent = await roomInfo.Room.GetStateAsync<RoomMemberEventData>("m.room.member", hs.WhoAmI.UserId) ?? new RoomMemberEventData { + TypedContent = await roomInfo.Room.GetStateAsync<RoomMemberEventContent>("m.room.member", hs.WhoAmI.UserId) ?? new RoomMemberEventContent { Membership = "unknown" } }); diff --git a/MatrixRoomUtils.Web/Pages/Rooms/PolicyList.razor b/MatrixRoomUtils.Web/Pages/Rooms/PolicyList.razor index 2b31389..d2b8360 100644 --- a/MatrixRoomUtils.Web/Pages/Rooms/PolicyList.razor +++ b/MatrixRoomUtils.Web/Pages/Rooms/PolicyList.razor @@ -1,11 +1,11 @@ @page "/Rooms/{RoomId}/Policies" -@using LibMatrix.StateEventTypes -@using System.Text.Json @using LibMatrix @using LibMatrix.Extensions @using LibMatrix.Helpers +@using LibMatrix.Homeservers @using LibMatrix.Responses @using LibMatrix.StateEventTypes.Spec +@using ArcaneLibs.Extensions <h3>Policy list editor - Editing @RoomId</h3> <hr/> @@ -33,8 +33,8 @@ else { </tr> </thead> <tbody> - @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.server" && (x.TypedContent as PolicyRuleStateEventData).Entity is not null)) { - var policyData = policyEvent.TypedContent as PolicyRuleStateEventData; + @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.server" && (x.TypedContent as PolicyRuleEventContent).Entity is not null)) { + var policyData = policyEvent.TypedContent as PolicyRuleEventContent; <tr> <td>Entity: @policyData.Entity<br/>State: @policyEvent.StateKey</td> <td>@policyData.Reason</td> @@ -59,8 +59,8 @@ else { </tr> </thead> <tbody> - @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.server" && (x.TypedContent as PolicyRuleStateEventData).Entity == null)) { - var policyData = policyEvent.TypedContent as PolicyRuleStateEventData; + @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.server" && (x.TypedContent as PolicyRuleEventContent).Entity == null)) { + var policyData = policyEvent.TypedContent as PolicyRuleEventContent; <tr> <td>@policyEvent.StateKey</td> <td>@policyEvent.RawContent.ToJson(false, true)</td> @@ -86,8 +86,8 @@ else { </tr> </thead> <tbody> - @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.room" && (x.TypedContent as PolicyRuleStateEventData).Entity is not null)) { - var policyData = policyEvent.TypedContent as PolicyRuleStateEventData; + @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.room" && (x.TypedContent as PolicyRuleEventContent).Entity is not null)) { + var policyData = policyEvent.TypedContent as PolicyRuleEventContent; <tr> <td>Entity: @policyData.Entity<br/>State: @policyEvent.StateKey</td> <td>@policyData.Reason</td> @@ -111,7 +111,7 @@ else { </tr> </thead> <tbody> - @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.room" && (x.TypedContent as PolicyRuleStateEventData).Entity == null)) { + @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.room" && (x.TypedContent as PolicyRuleEventContent).Entity == null)) { <tr> <td>@policyEvent.StateKey</td> <td>@policyEvent.RawContent!.ToJson(false, true)</td> @@ -140,8 +140,8 @@ else { </tr> </thead> <tbody> - @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.user" && (x.TypedContent as PolicyRuleStateEventData).Entity is not null)) { - var policyData = policyEvent.TypedContent as PolicyRuleStateEventData; + @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.user" && (x.TypedContent as PolicyRuleEventContent).Entity is not null)) { + var policyData = policyEvent.TypedContent as PolicyRuleEventContent; <tr> @if (_enableAvatars) { <td scope="col"> @@ -170,7 +170,7 @@ else { </tr> </thead> <tbody> - @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.user" && (x.TypedContent as PolicyRuleStateEventData).Entity == null)) { + @foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.user" && (x.TypedContent as PolicyRuleEventContent).Entity == null)) { <tr> <td>@policyEvent.StateKey</td> <td>@policyEvent.RawContent.ToJson(false, true)</td> @@ -245,8 +245,8 @@ else { } private async Task GetAllAvatars() { - foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.user" && (x.TypedContent as PolicyRuleStateEventData).Entity is not null)) { - await GetAvatar((policyEvent.TypedContent as PolicyRuleStateEventData).Entity); + foreach (var policyEvent in PolicyEvents.Where(x => x.Type == "m.policy.rule.user" && (x.TypedContent as PolicyRuleEventContent).Entity is not null)) { + await GetAvatar((policyEvent.TypedContent as PolicyRuleEventContent).Entity); } StateHasChanged(); } diff --git a/MatrixRoomUtils.Web/Pages/Rooms/Space.razor b/MatrixRoomUtils.Web/Pages/Rooms/Space.razor index c37b8ab..ef0ea5a 100644 --- a/MatrixRoomUtils.Web/Pages/Rooms/Space.razor +++ b/MatrixRoomUtils.Web/Pages/Rooms/Space.razor @@ -1,8 +1,8 @@ @page "/Rooms/{RoomId}/Space" -@using System.Text.Json @using LibMatrix.Extensions @using LibMatrix.Responses @using LibMatrix.RoomTypes +@using ArcaneLibs.Extensions <h3>Room manager - Viewing Space</h3> <button onclick="@JoinAllRooms">Join all rooms</button> diff --git a/MatrixRoomUtils.Web/Pages/Rooms/StateEditor.razor b/MatrixRoomUtils.Web/Pages/Rooms/StateEditor.razor index ef7cd51..fefcabc 100644 --- a/MatrixRoomUtils.Web/Pages/Rooms/StateEditor.razor +++ b/MatrixRoomUtils.Web/Pages/Rooms/StateEditor.razor @@ -1,8 +1,7 @@ @page "/Rooms/{RoomId}/State/Edit" -@using System.Net.Http.Headers -@using System.Text.Json @using LibMatrix.Extensions @using LibMatrix.Responses +@using ArcaneLibs.Extensions @inject ILocalStorageService LocalStorage @inject NavigationManager NavigationManager <h3>Room state editor - Editing @RoomId</h3> diff --git a/MatrixRoomUtils.Web/Pages/Rooms/StateViewer.razor b/MatrixRoomUtils.Web/Pages/Rooms/StateViewer.razor index 5a48b32..1c3f28b 100644 --- a/MatrixRoomUtils.Web/Pages/Rooms/StateViewer.razor +++ b/MatrixRoomUtils.Web/Pages/Rooms/StateViewer.razor @@ -1,8 +1,7 @@ @page "/Rooms/{RoomId}/State/View" -@using System.Net.Http.Headers -@using System.Text.Json @using LibMatrix.Extensions @using LibMatrix.Responses +@using ArcaneLibs.Extensions @inject ILocalStorageService LocalStorage @inject NavigationManager NavigationManager <h3>Room state viewer - Viewing @RoomId</h3> diff --git a/MatrixRoomUtils.Web/Pages/Rooms/Timeline.razor b/MatrixRoomUtils.Web/Pages/Rooms/Timeline.razor index 4a5298b..2c95c99 100644 --- a/MatrixRoomUtils.Web/Pages/Rooms/Timeline.razor +++ b/MatrixRoomUtils.Web/Pages/Rooms/Timeline.razor @@ -1,6 +1,7 @@ @page "/Rooms/{RoomId}/Timeline" @using MatrixRoomUtils.Web.Shared.TimelineComponents @using LibMatrix +@using LibMatrix.Homeservers @using LibMatrix.Responses @using LibMatrix.StateEventTypes.Spec <h3>RoomManagerTimeline</h3> @@ -23,7 +24,7 @@ private List<MessagesResponse> Messages { get; } = new(); private List<StateEventResponse> Events { get; } = new(); - private AuthenticatedHomeServer? HomeServer { get; set; } + private AuthenticatedHomeserverGeneric? HomeServer { get; set; } protected override async Task OnInitializedAsync() { Console.WriteLine("RoomId: " + RoomId); @@ -46,8 +47,9 @@ private StateEventResponse GetProfileEventBefore(StateEventResponse Event) => Events.TakeWhile(x => x != Event).Last(e => e.Type == "m.room.member" && e.StateKey == Event.Sender); private Type ComponentType(StateEvent Event) => Event.TypedContent switch { - RoomMessageEventData => typeof(TimelineMessageItem), - RoomMemberEventData => typeof(TimelineMemberItem), + RoomMessageEventContent => typeof(TimelineMessageItem), + RoomMemberEventContent => typeof(TimelineMemberItem), + RoomCreateEventContent => typeof(TimelineRoomCreateItem), _ => typeof(TimelineUnknownItem) }; |