diff options
23 files changed, 121 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore index 340c3ab..47d212e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ MatrixRoomUtils.Web/wwwroot/MRU.tar.xz /src/ *.tar.xz matrix-sync.json +/patches/ diff --git a/MatrixRoomUtils.Bot/MatrixRoomUtils.Bot.csproj b/MatrixRoomUtils.Bot/MatrixRoomUtils.Bot.csproj new file mode 100644 index 0000000..8ff14c4 --- /dev/null +++ b/MatrixRoomUtils.Bot/MatrixRoomUtils.Bot.csproj @@ -0,0 +1,27 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net8.0</TargetFramework> + <LangVersion>preview</LangVersion> + <ImplicitUsings>enable</ImplicitUsings> + <Nullable>enable</Nullable> + <PublishAot>true</PublishAot> + <InvariantGlobalization>true</InvariantGlobalization> + <PublishTrimmed>true</PublishTrimmed> + <PublishReadyToRun>true</PublishReadyToRun> + <PublishSingleFile>true</PublishSingleFile> + <PublishReadyToRunShowWarnings>true</PublishReadyToRunShowWarnings> + <PublishTrimmedShowLinkerSizeComparison>true</PublishTrimmedShowLinkerSizeComparison> + <PublishTrimmedShowLinkerSizeComparisonWarnings>true</PublishTrimmedShowLinkerSizeComparisonWarnings> + </PropertyGroup> + + <ItemGroup> + <ProjectReference Include="..\MatrixRoomUtils.Core\MatrixRoomUtils.Core.csproj" /> + </ItemGroup> + + <ItemGroup> + <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> + </ItemGroup> + +</Project> diff --git a/MatrixRoomUtils.Bot/Program.cs b/MatrixRoomUtils.Bot/Program.cs new file mode 100644 index 0000000..83fa4f4 --- /dev/null +++ b/MatrixRoomUtils.Bot/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/MatrixRoomUtils.Core/Attributes/TraceAttribute.cs b/MatrixRoomUtils.Core/Attributes/TraceAttribute.cs new file mode 100644 index 0000000..34a0b67 --- /dev/null +++ b/MatrixRoomUtils.Core/Attributes/TraceAttribute.cs @@ -0,0 +1,10 @@ +using System.Runtime.CompilerServices; + +namespace MatrixRoomUtils.Core.Attributes; + +[AttributeUsage(AttributeTargets.All)] +public class TraceAttribute : Attribute { + public TraceAttribute([CallerMemberName] string callerName = "") { + Console.WriteLine($"{callerName} called!"); + } +} \ No newline at end of file diff --git a/MatrixRoomUtils.Core/Interfaces/IStorageProvider.cs b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs index e1a066e..2540ad7 100644 --- a/MatrixRoomUtils.Core/Interfaces/IStorageProvider.cs +++ b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs @@ -1,3 +1,5 @@ +namespace MatrixRoomUtils.Core.Interfaces.Services; + public interface IStorageProvider { // save public async Task SaveAll() { diff --git a/MatrixRoomUtils.Core/Responses/StateEventResponse.cs b/MatrixRoomUtils.Core/Responses/StateEventResponse.cs index 36f0a36..7b138e0 100644 --- a/MatrixRoomUtils.Core/Responses/StateEventResponse.cs +++ b/MatrixRoomUtils.Core/Responses/StateEventResponse.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace MatrixRoomUtils.Core; +namespace MatrixRoomUtils.Core.Responses; public class StateEventResponse : StateEvent { [JsonPropertyName("origin_server_ts")] diff --git a/MatrixRoomUtils.Core/Room.cs b/MatrixRoomUtils.Core/Room.cs index 2d6dc46..4f6bbca 100644 --- a/MatrixRoomUtils.Core/Room.cs +++ b/MatrixRoomUtils.Core/Room.cs @@ -3,6 +3,7 @@ using System.Text.Json; using System.Text.Json.Serialization; using System.Web; using MatrixRoomUtils.Core.Extensions; +using MatrixRoomUtils.Core.Responses; using MatrixRoomUtils.Core.RoomTypes; namespace MatrixRoomUtils.Core; diff --git a/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs b/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs index e8d4823..7f634dc 100644 --- a/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs +++ b/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs @@ -1,5 +1,6 @@ using System.Text.Json; using MatrixRoomUtils.Core.Extensions; +using MatrixRoomUtils.Core.Responses; namespace MatrixRoomUtils.Core.RoomTypes; diff --git a/MatrixRoomUtils.Core/Services/HomeserverService.cs b/MatrixRoomUtils.Core/Services/HomeserverService.cs new file mode 100644 index 0000000..ba48e6c --- /dev/null +++ b/MatrixRoomUtils.Core/Services/HomeserverService.cs @@ -0,0 +1,8 @@ +using MatrixRoomUtils.Core.Attributes; + +namespace MatrixRoomUtils.Core.Services; + +[Trace] +public class HomeserverService { + +} \ No newline at end of file diff --git a/MatrixRoomUtils.Core/Services/TieredStorageService.cs b/MatrixRoomUtils.Core/Services/TieredStorageService.cs new file mode 100644 index 0000000..f6beddd --- /dev/null +++ b/MatrixRoomUtils.Core/Services/TieredStorageService.cs @@ -0,0 +1,9 @@ +using MatrixRoomUtils.Core.Interfaces.Services; + +namespace MatrixRoomUtils.Core.Services; + +public class TieredStorageService { + public TieredStorageService(IStorageProvider cacheStorageProvider, IStorageProvider dataStorageProvider) { + + } +} \ No newline at end of file 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> diff --git a/MatrixRoomUtils.sln b/MatrixRoomUtils.sln index e658c6d..a29cf89 100644 --- a/MatrixRoomUtils.sln +++ b/MatrixRoomUtils.sln @@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatrixRoomUtils.Core", "Mat EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatrixRoomUtils.Web.Server", "MatrixRoomUtils.Web.Server\MatrixRoomUtils.Web.Server.csproj", "{F997F26F-2EC1-4D18-B3DD-C46FB2AD65C0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatrixRoomUtils.Bot", "MatrixRoomUtils.Bot\MatrixRoomUtils.Bot.csproj", "{B397700A-4ABB-4CAF-8DB8-06E01F44514B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -30,5 +32,9 @@ Global {F997F26F-2EC1-4D18-B3DD-C46FB2AD65C0}.Debug|Any CPU.Build.0 = Debug|Any CPU {F997F26F-2EC1-4D18-B3DD-C46FB2AD65C0}.Release|Any CPU.ActiveCfg = Release|Any CPU {F997F26F-2EC1-4D18-B3DD-C46FB2AD65C0}.Release|Any CPU.Build.0 = Release|Any CPU + {B397700A-4ABB-4CAF-8DB8-06E01F44514B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B397700A-4ABB-4CAF-8DB8-06E01F44514B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B397700A-4ABB-4CAF-8DB8-06E01F44514B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B397700A-4ABB-4CAF-8DB8-06E01F44514B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/MatrixRoomUtils.sln.DotSettings.user b/MatrixRoomUtils.sln.DotSettings.user index 07d0701..dcd4e3e 100644 --- a/MatrixRoomUtils.sln.DotSettings.user +++ b/MatrixRoomUtils.sln.DotSettings.user @@ -3,4 +3,8 @@ + + + + </wpf:ResourceDictionary> \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..7bf6942 --- /dev/null +++ b/README.MD @@ -0,0 +1,13 @@ +# Project Name + +# Installation + +# Contributing + +```sh +# Prepare patch set +mkdir patches +git format-patch --output-directory "./patches" @{u}.. + +# Send patches +``` |