about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web')
-rw-r--r--MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs12
-rw-r--r--MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs2
-rw-r--r--MatrixRoomUtils.Web/FileUploadTest.razor18
-rw-r--r--MatrixRoomUtils.Web/Program.cs2
-rw-r--r--MatrixRoomUtils.Web/Shared/InlineUserItem.razor1
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor2
-rw-r--r--MatrixRoomUtils.Web/Shared/UserListItem.razor1
7 files changed, 13 insertions, 25 deletions
diff --git a/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs b/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs
index 59ec4db..59c1ab6 100644
--- a/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs
+++ b/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs
@@ -4,11 +4,11 @@ using MatrixRoomUtils.Core;
 namespace MatrixRoomUtils.Web.Classes;
 
 public class LocalStorageWrapper {
-    private static readonly SemaphoreSlim _semaphoreSlim = new(1);
-    public static Settings Settings { get; set; } = new();
+    private readonly SemaphoreSlim _semaphoreSlim = new(1);
+    public Settings Settings { get; set; } = new();
 
     //some basic logic
-    public static async Task InitialiseRuntimeVariables(ILocalStorageService localStorage) {
+    public async Task InitialiseRuntimeVariables(ILocalStorageService localStorage) {
         //RuntimeCache stuff
         // async Task Save() => await SaveToLocalStorage(localStorage);
         // async Task SaveObject(string key, object obj) => await localStorage.SetItemAsync(key, obj);
@@ -26,7 +26,7 @@ public class LocalStorageWrapper {
         }
     }
 
-    public static async Task LoadFromLocalStorage(ILocalStorageService localStorage) {
+    public async Task LoadFromLocalStorage(ILocalStorageService localStorage) {
         await _semaphoreSlim.WaitAsync();
         if (RuntimeCache.WasLoaded) {
             _semaphoreSlim.Release();
@@ -53,14 +53,14 @@ public class LocalStorageWrapper {
         _semaphoreSlim.Release();
     }
 
-    public static async Task SaveToLocalStorage(ILocalStorageService localStorage) {
+    public async Task SaveToLocalStorage(ILocalStorageService localStorage) {
         Console.WriteLine("Saving to local storage...");
         await localStorage.SetItemAsync("rory.matrixroomutils.settings", Settings);
         if (RuntimeCache.LoginSessions != null) await localStorage.SetItemAsync("rory.matrixroomutils.login_sessions", RuntimeCache.LoginSessions);
         if (RuntimeCache.LastUsedToken != null) await localStorage.SetItemAsync("rory.matrixroomutils.last_used_token", RuntimeCache.LastUsedToken);
     }
 
-    public static async Task SaveCacheToLocalStorage(ILocalStorageService localStorage, bool awaitSave = true, bool saveGenericCache = true) {
+    public async Task SaveCacheToLocalStorage(ILocalStorageService localStorage, bool awaitSave = true, bool saveGenericCache = true) {
         await localStorage.SetItemAsync("rory.matrixroomutils.homeserver_resolution_cache",
             RuntimeCache.HomeserverResolutionCache.DistinctBy(x => x.Key)
                 .ToDictionary(x => x.Key, x => x.Value));
diff --git a/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs b/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs
index 47844e3..4a31928 100644
--- a/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs
+++ b/MatrixRoomUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs
@@ -55,7 +55,7 @@ public class DefaultRoomCreationTemplate : IRoomCreationTemplate {
                 Redact = 50,
                 Kick = 50,
                 Ban = 50,
-                NotificationsPl = new NotificationsPL {
+                NotificationsPl = new PowerLevelEvent.NotificationsPL {
                     Room = 50
                 },
                 Events = new Dictionary<string, int> {
diff --git a/MatrixRoomUtils.Web/FileUploadTest.razor b/MatrixRoomUtils.Web/FileUploadTest.razor
deleted file mode 100644
index cbdb5ce..0000000
--- a/MatrixRoomUtils.Web/FileUploadTest.razor
+++ /dev/null
@@ -1,18 +0,0 @@
-@page "/FileUploadTest"
-<h3>FileUploadTest</h3>
-
-<InputFile OnChange="FilePicked" multiple="false"></InputFile>
-
-
-@code {
-
-    private async Task FilePicked(InputFileChangeEventArgs obj) {
-        Console.WriteLine("FilePicked");
-        Console.WriteLine(obj.File.Name);
-        Console.WriteLine(obj.File.Size);
-        Console.WriteLine(obj.File.ContentType);
-        var res = await RuntimeCache.CurrentHomeServer.UploadFile(obj.File.Name, obj.File.OpenReadStream(), obj.File.ContentType);
-        Console.WriteLine(res);
-    }
-
-}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Program.cs b/MatrixRoomUtils.Web/Program.cs
index b106543..4ff10b4 100644
--- a/MatrixRoomUtils.Web/Program.cs
+++ b/MatrixRoomUtils.Web/Program.cs
@@ -39,4 +39,6 @@ builder.Services.AddScoped<TieredStorageService>(x =>
     )
 );
 
+builder.Services.AddRoryLibMatrixServices();
+
 await builder.Build().RunAsync();
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Shared/InlineUserItem.razor b/MatrixRoomUtils.Web/Shared/InlineUserItem.razor
index 0a58b4d..44f3b0a 100644
--- a/MatrixRoomUtils.Web/Shared/InlineUserItem.razor
+++ b/MatrixRoomUtils.Web/Shared/InlineUserItem.razor
@@ -1,4 +1,5 @@
 @using MatrixRoomUtils.Core.Responses
+@using MatrixRoomUtils.Core.StateEventTypes
 <div style="background-color: #ffffff11; border-radius: 0.5em; height: 1em; display: inline-block; vertical-align: middle;" alt="@UserId">
     <img style="@(ChildContent != null ? "vertical-align: baseline;" : "vertical-align: top;") width: 1em; height: 1em; border-radius: 50%;" src="@ProfileAvatar"/>
     <span style="position: relative; top: -5px;">@ProfileName</span>
diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
index f89dc44..598ae7e 100644
--- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
+++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
@@ -1,3 +1,5 @@
+@using MatrixRoomUtils.Core
+@using Microsoft.AspNetCore.Components
 @if (Event.membership"]!.GetValue<string>() == "ban") {
     <i>@Event.StateKey was banned</i>
 }
diff --git a/MatrixRoomUtils.Web/Shared/UserListItem.razor b/MatrixRoomUtils.Web/Shared/UserListItem.razor
index 52f398a..9b3cff1 100644
--- a/MatrixRoomUtils.Web/Shared/UserListItem.razor
+++ b/MatrixRoomUtils.Web/Shared/UserListItem.razor
@@ -1,4 +1,5 @@
 @using MatrixRoomUtils.Core.Responses
+@using MatrixRoomUtils.Core.StateEventTypes
 <div style="background-color: #ffffff11; border-radius: 25px; margin: 8px; width: fit-Content;">
     <img style="@(ChildContent != null ? "vertical-align: baseline;" : "") width: 32px; height:  32px; border-radius: 50%;" src="@profileAvatar"/>
     <span style="vertical-align: middle; margin-right: 8px; border-radius: 75px;">@profileName</span>