diff options
Diffstat (limited to 'MatrixRoomUtils.Web')
10 files changed, 36 insertions, 4 deletions
diff --git a/MatrixRoomUtils.Web/Classes/LocalStorageProviderService.cs b/MatrixRoomUtils.Web/Classes/LocalStorageProviderService.cs index 0c3deec..2a9082d 100644 --- a/MatrixRoomUtils.Web/Classes/LocalStorageProviderService.cs +++ b/MatrixRoomUtils.Web/Classes/LocalStorageProviderService.cs @@ -1,5 +1,10 @@ +using Blazored.LocalStorage; +using MatrixRoomUtils.Core.Interfaces.Services; + namespace MatrixRoomUtils.Web.Classes; public class LocalStorageProviderService : IStorageProvider { - + public LocalStorageProviderService(ILocalStorageService localStorageService) { + + } } \ No newline at end of file diff --git a/MatrixRoomUtils.Web/MatrixRoomUtils.Web.csproj b/MatrixRoomUtils.Web/MatrixRoomUtils.Web.csproj index e1511c4..33fb062 100644 --- a/MatrixRoomUtils.Web/MatrixRoomUtils.Web.csproj +++ b/MatrixRoomUtils.Web/MatrixRoomUtils.Web.csproj @@ -8,6 +8,7 @@ <ItemGroup> <PackageReference Include="Blazored.LocalStorage" Version="4.3.0" /> + <PackageReference Include="Blazored.SessionStorage" Version="2.3.0" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.3" PrivateAssets="all" /> </ItemGroup> diff --git a/MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor b/MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor index 92a8445..8031146 100644 --- a/MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor +++ b/MatrixRoomUtils.Web/Pages/KnownHomeserverList.razor @@ -2,6 +2,7 @@ @using System.Text.Json @using MatrixRoomUtils.Core.Extensions @using System.Diagnostics +@using MatrixRoomUtils.Core.Responses <h3>Known Homeserver List</h3> <hr/> diff --git a/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor b/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor index b15928a..76b4384 100644 --- a/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor +++ b/MatrixRoomUtils.Web/Pages/PolicyList/PolicyListEditorPage.razor @@ -2,6 +2,7 @@ @using MatrixRoomUtils.Core.Extensions @using MatrixRoomUtils.Core.StateEventTypes @using System.Text.Json +@using MatrixRoomUtils.Core.Responses @inject ILocalStorageService LocalStorage @inject NavigationManager NavigationManager <h3>Policy list editor - Editing @RoomId</h3> diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor index c5e1569..ab650d1 100644 --- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor +++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerSpace.razor @@ -1,6 +1,7 @@ @page "/RoomManager/Space/{RoomId}" @using MatrixRoomUtils.Core.Extensions @using System.Text.Json +@using MatrixRoomUtils.Core.Responses <h3>Room manager - Viewing Space</h3> <button onclick="@JoinAllRooms">Join all rooms</button> diff --git a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerTimeline.razor b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerTimeline.razor index b90cc09..9513a8a 100644 --- a/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerTimeline.razor +++ b/MatrixRoomUtils.Web/Pages/RoomManager/RoomManagerTimeline.razor @@ -1,5 +1,6 @@ @page "/Rooms/{RoomId}/Timeline" @using MatrixRoomUtils.Web.Shared.TimelineComponents +@using MatrixRoomUtils.Core.Responses <h3>RoomManagerTimeline</h3> <hr/> <p>Loaded @Events.Count events...</p> diff --git a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor index 74f4f92..fa5b6a8 100644 --- a/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor +++ b/MatrixRoomUtils.Web/Pages/RoomState/RoomStateEditorPage.razor @@ -1,6 +1,7 @@ @page "/RoomStateViewer/{RoomId}/Edit" @using System.Net.Http.Headers @using System.Text.Json +@using MatrixRoomUtils.Core.Responses @inject ILocalStorageService LocalStorage @inject NavigationManager NavigationManager <h3>Room state editor - Editing @RoomId</h3> diff --git a/MatrixRoomUtils.Web/Program.cs b/MatrixRoomUtils.Web/Program.cs index 8ea8742..11e7f19 100644 --- a/MatrixRoomUtils.Web/Program.cs +++ b/MatrixRoomUtils.Web/Program.cs @@ -1,6 +1,8 @@ using System.Text.Json; using System.Text.Json.Serialization; using Blazored.LocalStorage; +using Blazored.SessionStorage; +using MatrixRoomUtils.Core.Services; using MatrixRoomUtils.Web; using MatrixRoomUtils.Web.Classes; using Microsoft.AspNetCore.Components.Web; @@ -20,9 +22,23 @@ builder.Services.AddBlazoredLocalStorage(config => { config.JsonSerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip; config.JsonSerializerOptions.WriteIndented = false; }); +builder.Services.AddBlazoredSessionStorage(config => { + config.JsonSerializerOptions.DictionaryKeyPolicy = JsonNamingPolicy.CamelCase; + config.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull; + config.JsonSerializerOptions.IgnoreReadOnlyProperties = true; + config.JsonSerializerOptions.PropertyNameCaseInsensitive = true; + config.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; + config.JsonSerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip; + config.JsonSerializerOptions.WriteIndented = false; +}); -builder.Services.AddSingleton<LocalStorageProviderService>(); +builder.Services.AddScoped<LocalStorageProviderService>(); builder.Services.AddSingleton<SessionStorageProviderService>(); -builder.Services.AddSingleton<TieredStorage<LocalStorageProviderService, SessionStorageProviderService>>(); +builder.Services.AddSingleton<TieredStorageService>(x => + new( + x.GetRequiredService<SessionStorageProviderService>(), + x.GetRequiredService<LocalStorageProviderService>() + ) +); await builder.Build().RunAsync(); \ No newline at end of file diff --git a/MatrixRoomUtils.Web/SessionStorageProviderService.cs b/MatrixRoomUtils.Web/SessionStorageProviderService.cs index 82372ff..d6bffe6 100644 --- a/MatrixRoomUtils.Web/SessionStorageProviderService.cs +++ b/MatrixRoomUtils.Web/SessionStorageProviderService.cs @@ -1 +1,5 @@ -public class SessionStorageProviderService { } \ No newline at end of file +using MatrixRoomUtils.Core.Interfaces.Services; + +namespace MatrixRoomUtils.Web; + +public class SessionStorageProviderService : IStorageProvider { } \ No newline at end of file diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor index 8d688ea..80a432b 100644 --- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor +++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor @@ -1,4 +1,5 @@ @using MatrixRoomUtils.Core.Extensions +@using MatrixRoomUtils.Core.Responses <pre> @ObjectExtensions.ToJson(Event.Content, indent: false) </pre> |