From 257019113200d714d86d22ccab6c18b37cd28283 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 3 Jul 2023 00:43:34 +0200 Subject: Local changes --- MatrixRoomUtils.Web/Classes/Constants/RoomConstants.cs | 7 +++++++ MatrixRoomUtils.Web/Classes/RoomInfo.cs | 2 +- .../Classes/SessionStorageProviderService.cs | 18 ++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 MatrixRoomUtils.Web/Classes/Constants/RoomConstants.cs (limited to 'MatrixRoomUtils.Web/Classes') diff --git a/MatrixRoomUtils.Web/Classes/Constants/RoomConstants.cs b/MatrixRoomUtils.Web/Classes/Constants/RoomConstants.cs new file mode 100644 index 0000000..da6bf0d --- /dev/null +++ b/MatrixRoomUtils.Web/Classes/Constants/RoomConstants.cs @@ -0,0 +1,7 @@ +namespace MatrixRoomUtils.Web.Classes.Constants; + +public class RoomConstants { + + public static readonly string[] DangerousRoomVersions = { "1", "8" }; + public const string RecommendedRoomVersion = "10"; +} \ No newline at end of file diff --git a/MatrixRoomUtils.Web/Classes/RoomInfo.cs b/MatrixRoomUtils.Web/Classes/RoomInfo.cs index 711bf55..5ecc431 100644 --- a/MatrixRoomUtils.Web/Classes/RoomInfo.cs +++ b/MatrixRoomUtils.Web/Classes/RoomInfo.cs @@ -6,7 +6,7 @@ namespace MatrixRoomUtils.Web.Classes; public class RoomInfo { public GenericRoom Room { get; set; } - public List StateEvents { get; } = new(); + public List StateEvents { get; init; } = new(); public async Task GetStateEvent(string type, string stateKey = "") { var @event = StateEvents.FirstOrDefault(x => x.Type == type && x.StateKey == stateKey); diff --git a/MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs b/MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs index 58466c7..e497ee3 100644 --- a/MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs +++ b/MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs @@ -4,9 +4,23 @@ using MatrixRoomUtils.Core.Interfaces.Services; namespace MatrixRoomUtils.Web.Classes; public class SessionStorageProviderService : IStorageProvider { - private readonly ISessionStorageService _sessionStorage; + private readonly ISessionStorageService _sessionStorageService; public SessionStorageProviderService(ISessionStorageService sessionStorage) { - _sessionStorage = sessionStorage; + _sessionStorageService = sessionStorage; } + + async Task IStorageProvider.SaveAllChildrenAsync(string key, T value) => throw new NotImplementedException(); + + async Task IStorageProvider.LoadAllChildrenAsync(string key) where T : default => throw new NotImplementedException(); + + async Task IStorageProvider.SaveObjectAsync(string key, T value) => await _sessionStorageService.SetItemAsync(key, value); + + async Task IStorageProvider.LoadObjectAsync(string key) where T : default => await _sessionStorageService.GetItemAsync(key); + + async Task IStorageProvider.ObjectExistsAsync(string key) => await _sessionStorageService.ContainKeyAsync(key); + + async Task> IStorageProvider.GetAllKeysAsync() => (await _sessionStorageService.KeysAsync()).ToList(); + + async Task IStorageProvider.DeleteObjectAsync(string key) => await _sessionStorageService.RemoveItemAsync(key); } \ No newline at end of file -- cgit 1.5.1