about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Pages')
-rw-r--r--MatrixRoomUtils.Web/Pages/DebugTools.razor1
-rw-r--r--MatrixRoomUtils.Web/Pages/DevOptions.razor1
-rw-r--r--MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor1
-rw-r--r--MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor1
-rw-r--r--MatrixRoomUtils.Web/Pages/LoginPage.razor2
-rw-r--r--MatrixRoomUtils.Web/Pages/MediaLocator.razor2
-rw-r--r--MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor3
-rw-r--r--MatrixRoomUtils.Web/Pages/PolicyList/PolicyListRoomList.razor1
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor38
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor1
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor2
-rw-r--r--MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor3
12 files changed, 19 insertions, 37 deletions
diff --git a/MatrixRoomUtils.Web/Pages/DebugTools.razor b/MatrixRoomUtils.Web/Pages/DebugTools.razor
index da5c172..4e4cec8 100644
--- a/MatrixRoomUtils.Web/Pages/DebugTools.razor
+++ b/MatrixRoomUtils.Web/Pages/DebugTools.razor
@@ -1,6 +1,5 @@
 @page "/Debug"
 @using System.Reflection
-@using MatrixRoomUtils.Core.Extensions
 @using MatrixRoomUtils.Core.Interfaces
 @inject ILocalStorageService LocalStorage
 @inject NavigationManager NavigationManager
diff --git a/MatrixRoomUtils.Web/Pages/DevOptions.razor b/MatrixRoomUtils.Web/Pages/DevOptions.razor
index 0843d5f..cdb5693 100644
--- a/MatrixRoomUtils.Web/Pages/DevOptions.razor
+++ b/MatrixRoomUtils.Web/Pages/DevOptions.razor
@@ -1,5 +1,4 @@
 @page "/DevOptions"
-@using MatrixRoomUtils.Core.Extensions
 @inject NavigationManager NavigationManager
 @inject ILocalStorageService LocalStorage
 
diff --git a/MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor b/MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor
index 1fe13bd..858fad9 100644
--- a/MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor
+++ b/MatrixRoomUtils.Web/Pages/HSAdmin/RoomQuery.razor
@@ -1,5 +1,4 @@
 @page "/HSAdmin/RoomQuery"
-@using MatrixRoomUtils.Core.Extensions
 @using MatrixRoomUtils.Core.Filters
 @using MatrixRoomUtils.Core.Responses.Admin
 @using MatrixRoomUtils.Web.Shared.SimpleComponents
diff --git a/MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor b/MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor
index 8031146..80dbfd1 100644
--- a/MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor
+++ b/MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor
@@ -1,6 +1,5 @@
 @page "/KnownHomeserverList"
 @using System.Text.Json
-@using MatrixRoomUtils.Core.Extensions
 @using System.Diagnostics
 @using MatrixRoomUtils.Core.Responses
 <h3>Known Homeserver List</h3>
diff --git a/MatrixRoomUtils.Web/Pages/LoginPage.razor b/MatrixRoomUtils.Web/Pages/LoginPage.razor
index 3b78817..9df7fa6 100644
--- a/MatrixRoomUtils.Web/Pages/LoginPage.razor
+++ b/MatrixRoomUtils.Web/Pages/LoginPage.razor
@@ -52,7 +52,7 @@
             var userinfo = new UserInfo {
                 LoginResponse = result
             };
-            userinfo.Profile = await (await new AuthenticatedHomeServer(result.HomeServer, result.AccessToken, TODO).Configure()).GetProfile(result.UserId);
+            userinfo.Profile = await RuntimeCache.CurrentHomeServer.GetProfile(result.UserId);
             RuntimeCache.LastUsedToken = result.AccessToken;
 
             RuntimeCache.LoginSessions.Add(result.AccessToken, userinfo);
diff --git a/MatrixRoomUtils.Web/Pages/MediaLocator.razor b/MatrixRoomUtils.Web/Pages/MediaLocator.razor
index 36cd8e6..38d1514 100644
--- a/MatrixRoomUtils.Web/Pages/MediaLocator.razor
+++ b/MatrixRoomUtils.Web/Pages/MediaLocator.razor
@@ -61,7 +61,7 @@
             await sem.WaitAsync();
             var httpClient = new HttpClient { BaseAddress = new Uri(hs) };
             httpClient.Timeout = TimeSpan.FromSeconds(5);
-            var rmu = mxcUrl.Replace("mxc://", $"{hs}/_matrix/media/r0/download/");
+            var rmu = mxcUrl.Replace("mxc://", $"{hs}/_matrix/media/v3/download/");
             try {
                 var res = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, rmu));
                 if (res.IsSuccessStatusCode) {
diff --git a/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor b/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor
index 76b4384..0840ebf 100644
--- a/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor
+++ b/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor
@@ -1,5 +1,4 @@
 @page "/PolicyListEditor/{RoomId}"
-@using MatrixRoomUtils.Core.Extensions
 @using MatrixRoomUtils.Core.StateEventTypes
 @using System.Text.Json
 @using MatrixRoomUtils.Core.Responses
@@ -210,7 +209,7 @@ else {
     private async Task LoadStatesAsync() {
     // using var client = new HttpClient();
     // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalStorageWrapper.AccessToken);
-    // var response = await client.GetAsync($"{LocalStorageWrapper.CurrentHomeserver}/_matrix/client/r0/rooms/{RoomId}/state");
+    // var response = await client.GetAsync($"{LocalStorageWrapper.CurrentHomeserver}/_matrix/client/v3/rooms/{RoomId}/state");
     // var Content = await response.Content.ReadAsStringAsync();
     // Console.WriteLine(JsonSerializer.Deserialize<object>(Content).ToJson());
     // var stateEvents = JsonSerializer.Deserialize<List<StateEventResponse>>(Content);
diff --git a/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListRoomList.razor b/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListRoomList.razor
index 20eab7a..8f711b5 100644
--- a/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListRoomList.razor
+++ b/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListRoomList.razor
@@ -1,5 +1,4 @@
 @page "/PolicyListEditor"
-@using MatrixRoomUtils.Core.Extensions
 @inject ILocalStorageService LocalStorage
 @inject NavigationManager NavigationManager
 <h3>Policy list editor - Room list</h3>
diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor
index 5cfda77..80d852a 100644
--- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerCreateRoom.razor
@@ -1,9 +1,8 @@
 @page "/RoomManagerCreateRoom"
-@using MatrixRoomUtils.Core.Extensions
 @using MatrixRoomUtils.Core.Responses
 @using System.Text.Json
-@using System.Text.Json.Serialization
 @using System.Reflection
+@using MatrixRoomUtils.Core.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
@@ -53,12 +52,12 @@
         <tr>
             <td style="padding-top: 16px;">History visibility:</td>
             <td style="padding-top: 16px;">
-                <InputSelect @bind-Value="@creationEvent.HistoryVisibility">
-                    <option value="invited">Invited</option>
-                    <option value="joined">Joined</option>
-                    <option value="shared">Shared</option>
-                    <option value="world_readable">World readable</option>
-                </InputSelect>
+                @* <InputSelect @bind-Value="@creationEvent.HistoryVisibility"> *@
+                @*     <option value="invited">Invited</option> *@
+                @*     <option value="joined">Joined</option> *@
+                @*     <option value="shared">Shared</option> *@
+                @*     <option value="world_readable">World readable</option> *@
+                @* </InputSelect> *@
             </td>
         </tr>
         <tr>
@@ -220,15 +219,15 @@
             OverwriteWrappedPropertiesFromEvent();
             creationEvent.PowerLevelContentOverride.Events = creationEvent.PowerLevelContentOverride.Events.OrderByDescending(x => x.Value).ThenBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);
             creationEvent.PowerLevelContentOverride.Users = creationEvent.PowerLevelContentOverride.Users.OrderByDescending(x => x.Value).ThenBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);
-            guestAccessEvent = creationEvent["m.room.guest_access"].As<GuestAccessContent>().Content;
+            guestAccessEvent = creationEvent["m.room.guest_access"].As<GuestAccessData>().Content;
 
             Console.WriteLine($"Creation event uncasted: {creationEvent["m.room.guest_access"].ToJson()}");
-            Console.WriteLine($"Creation event casted: {creationEvent["m.room.guest_access"].As<GuestAccessContent>().ToJson()}");
-            creationEvent["m.room.guest_access"].As<GuestAccessContent>().Content.IsGuestAccessEnabled = true;
+            Console.WriteLine($"Creation event casted: {creationEvent["m.room.guest_access"].As<GuestAccessData>().ToJson()}");
+            creationEvent["m.room.guest_access"].As<GuestAccessData>().Content.IsGuestAccessEnabled = true;
             Console.WriteLine("-- Created new guest access content --");
             Console.WriteLine($"Creation event uncasted: {creationEvent["m.room.guest_access"].ToJson()}");
-            Console.WriteLine($"Creation event casted: {creationEvent["m.room.guest_access"].As<GuestAccessContent>().ToJson()}");
-            Console.WriteLine($"Creation event casted back: {creationEvent["m.room.guest_access"].As<GuestAccessContent>().ToJson()}");
+            Console.WriteLine($"Creation event casted: {creationEvent["m.room.guest_access"].As<GuestAccessData>().ToJson()}");
+            Console.WriteLine($"Creation event casted back: {creationEvent["m.room.guest_access"].As<GuestAccessData>().ToJson()}");
             StateHasChanged();
         }
     }
@@ -236,7 +235,7 @@
     private Dictionary<string, string> creationEventValidationErrors { get; set; } = new();
 
     private CreateRoomRequest creationEvent { get; set; }
-    GuestAccessContent guestAccessEvent { get; set; }
+    GuestAccessData guestAccessEvent { get; set; }
 
     private Dictionary<string, CreateRoomRequest> Presets { get; set; } = new();
 
@@ -275,7 +274,7 @@
         Console.WriteLine("Overwriting wrapped properties");
         Console.WriteLine($"Allow: {ServerACLAllowRules.Count}: {string.Join(", ", ServerACLAllowRules)}");
         Console.WriteLine($"Deny: {ServerACLDenyRules.Count}: {string.Join(", ", ServerACLDenyRules)}");
-        creationEvent.ServerACLs = new ServerACL {
+        creationEvent.ServerACLs = new ServerACLData {
             Allow = ServerACLAllowRules,
             Deny = ServerACLDenyRules,
             AllowIpLiterals = creationEvent.ServerACLs.AllowIpLiterals
@@ -336,14 +335,5 @@
         _ => key
         };
 
-    public class GuestAccessContent {
-        [JsonPropertyName("guest_access")]
-        public string GuestAccess { get; set; }
-
-        public bool IsGuestAccessEnabled {
-            get => GuestAccess == "can_join";
-            set => GuestAccess = value ? "can_join" : "forbidden";
-        }
-    }
     }
 
diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
index ab650d1..a9c71c4 100644
--- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor
@@ -1,5 +1,4 @@
 @page "/RoomManager/Space/{RoomId}"
-@using MatrixRoomUtils.Core.Extensions
 @using System.Text.Json
 @using MatrixRoomUtils.Core.Responses
 <h3>Room manager - Viewing Space</h3>
diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
index fa5b6a8..296514c 100644
--- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor
@@ -63,7 +63,7 @@
         using var client = new HttpClient();
     //TODO: can this be improved?
         client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", RuntimeCache.CurrentHomeServer.AccessToken);
-        var response = await client.GetAsync($"{RuntimeCache.CurrentHomeServer.FullHomeServerDomain}/_matrix/client/r0/rooms/{RoomId}/state");
+        var response = await client.GetAsync($"{RuntimeCache.CurrentHomeServer.FullHomeServerDomain}/_matrix/client/v3/rooms/{RoomId}/state");
     // var response = await client.GetAsync($"http://localhost:5117/matrix-hq-state.json");
     //var _events = await response.Content.ReadFromJsonAsync<Queue<StateEventStruct>>();
         var _data = await response.Content.ReadAsStreamAsync();
diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor
index bfd4d10..ff1d9ac 100644
--- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor
+++ b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateViewerPage.razor
@@ -1,5 +1,4 @@
 @page "/RoomStateViewer/{RoomId}"
-@using MatrixRoomUtils.Core.Extensions
 @using System.Net.Http.Headers
 @using System.Text.Json
 @inject ILocalStorageService LocalStorage
@@ -88,7 +87,7 @@
     //TODO: can we improve this?
         using var client = new HttpClient();
         client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", RuntimeCache.CurrentHomeServer.AccessToken);
-        var response = await client.GetAsync($"{RuntimeCache.CurrentHomeServer.FullHomeServerDomain}/_matrix/client/r0/rooms/{RoomId}/state");
+        var response = await client.GetAsync($"{RuntimeCache.CurrentHomeServer.FullHomeServerDomain}/_matrix/client/v3/rooms/{RoomId}/state");
     // var response = await client.GetAsync($"http://localhost:5117/matrix-hq-state.json");
     //var _events = await response.Content.ReadFromJsonAsync<Queue<StateEventStruct>>();
         var _data = await response.Content.ReadAsStreamAsync();