about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Classes
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Classes')
-rw-r--r--MatrixRoomUtils.Web/Classes/Constants/RoomConstants.cs7
-rw-r--r--MatrixRoomUtils.Web/Classes/RoomInfo.cs2
-rw-r--r--MatrixRoomUtils.Web/Classes/SessionStorageProviderService.cs18
3 files changed, 24 insertions, 3 deletions
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<StateEventResponse?> StateEvents { get; } = new(); + public List<StateEventResponse?> StateEvents { get; init; } = new(); public async Task<StateEventResponse?> 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<T>(string key, T value) => throw new NotImplementedException(); + + async Task<T?> IStorageProvider.LoadAllChildrenAsync<T>(string key) where T : default => throw new NotImplementedException(); + + async Task IStorageProvider.SaveObjectAsync<T>(string key, T value) => await _sessionStorageService.SetItemAsync(key, value); + + async Task<T?> IStorageProvider.LoadObjectAsync<T>(string key) where T : default => await _sessionStorageService.GetItemAsync<T>(key); + + async Task<bool> IStorageProvider.ObjectExistsAsync(string key) => await _sessionStorageService.ContainKeyAsync(key); + + async Task<List<string>> IStorageProvider.GetAllKeysAsync() => (await _sessionStorageService.KeysAsync()).ToList(); + + async Task IStorageProvider.DeleteObjectAsync(string key) => await _sessionStorageService.RemoveItemAsync(key); } \ No newline at end of file