From 6769b0fd6f37cbc27646fa0ca8e458489c935039 Mon Sep 17 00:00:00 2001 From: Rory& Date: Tue, 9 Dec 2025 23:42:07 +0100 Subject: Commit various changes that never made it into git --- Benchmarks/Benchmarks.csproj | 2 +- LibMatrix | 2 +- MatrixUtils.Abstractions/RoomInfo.cs | 24 +-- MatrixUtils.Desktop/MatrixUtils.Desktop.csproj | 10 +- MatrixUtils.DmSpaced/MatrixUtils.DmSpaced.csproj | 2 +- MatrixUtils.DmSpaced/ModerationBot.cs | 21 ++- MatrixUtils.LibDMSpace/DMSpaceRoom.cs | 2 +- .../MatrixUtils.RoomUpgradeCLI.csproj | 2 +- .../MatrixUtils.Web.Server.csproj | 2 +- .../DefaultRoomCreationTemplate.cs | 2 +- MatrixUtils.Web/MatrixUtils.Web.csproj | 12 +- .../Pages/HSAdmin/Synapse/BlockMedia.razor | 4 +- .../SynapseRoomShutdownWindowContent.razor | 2 +- .../Synapse/SubTools/SynapseRoomStateResync.razor | 3 +- .../Client/ClientComponents/ClientSyncWrapper.cs | 10 +- MatrixUtils.Web/Pages/Rooms/Create.razor | 39 +++-- MatrixUtils.Web/Pages/Rooms/PolicyList.razor | 56 +++---- MatrixUtils.Web/Pages/Rooms/PolicyList.razor.cs | 8 +- MatrixUtils.Web/Pages/Rooms/PolicyList2.razor | 42 +++-- .../PolicyListEditorHeader.razor | 4 +- .../PolicyListRowComponent.razor | 12 +- MatrixUtils.Web/Pages/Rooms/PolicyLists.razor | 2 +- .../RoomCreateInitialStateOptions.razor | 8 +- MatrixUtils.Web/Pages/Rooms/Space.razor | 81 ++++----- MatrixUtils.Web/Pages/Rooms/StateEditor.razor | 16 +- MatrixUtils.Web/Pages/Rooms/StateViewer.razor | 53 +++--- MatrixUtils.Web/Pages/Rooms/Timeline.razor | 10 +- MatrixUtils.Web/Pages/StreamTest.razor | 6 +- .../Pages/Tools/Info/PolicyListActivity.razor | 8 +- .../Pages/Tools/Info/SessionCount.razor | 4 +- .../Pages/Tools/Moderation/FindUsersByRegex.razor | 2 +- .../Pages/Tools/Moderation/MembershipHistory.razor | 181 +++++++++++++-------- .../Pages/Tools/Moderation/RoomIntersections.razor | 8 +- .../Pages/Tools/Moderation/UserTrace.razor | 4 +- MatrixUtils.Web/Program.cs | 2 +- .../MassPolicyEditorModal.razor | 10 +- .../PolicyEditorComponents/PolicyEditorModal.razor | 10 +- .../TimelineComponents/BaseTimelineItem.razor | 12 +- MatrixUtils.Web/wwwroot/index.html | 23 +-- .../wwwroot/service-worker.published.js | 22 ++- MatrixUtils.Web/wwwroot/sw-registrator.js | 2 +- MatrixUtils.sln | 29 ++-- global.json | 7 - scripts/deploy.sh | 3 +- 44 files changed, 423 insertions(+), 341 deletions(-) delete mode 100644 global.json diff --git a/Benchmarks/Benchmarks.csproj b/Benchmarks/Benchmarks.csproj index a174f1f..06164d3 100644 --- a/Benchmarks/Benchmarks.csproj +++ b/Benchmarks/Benchmarks.csproj @@ -11,7 +11,7 @@ - + diff --git a/LibMatrix b/LibMatrix index 1db452c..74fa446 160000 --- a/LibMatrix +++ b/LibMatrix @@ -1 +1 @@ -Subproject commit 1db452c75de1e25a9a2a8fd4fe2a04a2e1047f2a +Subproject commit 74fa4463dfb4b0508a36d83a9e77c83e379aab2d diff --git a/MatrixUtils.Abstractions/RoomInfo.cs b/MatrixUtils.Abstractions/RoomInfo.cs index 4b2a53c..1efbd6f 100644 --- a/MatrixUtils.Abstractions/RoomInfo.cs +++ b/MatrixUtils.Abstractions/RoomInfo.cs @@ -16,22 +16,22 @@ public class RoomInfo : NotifyPropertyChanged { RegisterEventListener(); } - public RoomInfo(GenericRoom room, List? stateEvents) { + public RoomInfo(GenericRoom room, List? stateEvents) { Room = room; // _fallbackIcon = identiconGenerator.GenerateAsDataUri(room.RoomId); if (stateEvents is { Count: > 0 }) StateEvents = new(stateEvents!); RegisterEventListener(); ProcessNewItems(stateEvents!); } - + public readonly GenericRoom Room; - public ObservableCollection StateEvents { get; private set; } = new(); - public ObservableCollection Timeline { get; private set; } = new(); + public ObservableCollection StateEvents { get; private set; } = new(); + public ObservableCollection Timeline { get; private set; } = new(); private static ConcurrentBag homeserversWithoutEventFormatSupport = new(); // private static SvgIdenticonGenerator identiconGenerator = new(); - public async Task GetStateEvent(string type, string stateKey = "") { + public async Task GetStateEvent(string type, string stateKey = "") { if (homeserversWithoutEventFormatSupport.Contains(Room.Homeserver)) return await GetStateEventForged(type, stateKey); var @event = StateEvents.FirstOrDefault(x => x?.Type == type && x.StateKey == stateKey); if (@event is not null) return @event; @@ -54,8 +54,8 @@ public class RoomInfo : NotifyPropertyChanged { return @event; } - private async Task GetStateEventForged(string type, string stateKey = "") { - var @event = new StateEventResponse { + private async Task GetStateEventForged(string type, string stateKey = "") { + var @event = new MatrixEventResponse { RoomId = Room.RoomId, Type = type, StateKey = stateKey, @@ -148,16 +148,16 @@ public class RoomInfo : NotifyPropertyChanged { private void RegisterEventListener() { StateEvents.CollectionChanged += (_, args) => { if (args.NewItems is { Count: > 0 }) - ProcessNewItems(args.NewItems.OfType()); + ProcessNewItems(args.NewItems.OfType()); }; } - private void ProcessNewItems(IEnumerable newItems) { - foreach (StateEventResponse? newState in newItems) { + private void ProcessNewItems(IEnumerable newItems) { + foreach (MatrixEventResponse? newState in newItems) { if (newState is null) continue; // TODO: Benchmark switch statement - - if(newState.StateKey != "") continue; + + if (newState.StateKey != "") continue; if (newState.Type == RoomNameEventContent.EventId && newState.TypedContent is RoomNameEventContent roomNameContent) RoomName = roomNameContent.Name; else if (newState is { Type: RoomAvatarEventContent.EventId, TypedContent: RoomAvatarEventContent roomAvatarContent }) diff --git a/MatrixUtils.Desktop/MatrixUtils.Desktop.csproj b/MatrixUtils.Desktop/MatrixUtils.Desktop.csproj index 419ae88..70b64a8 100644 --- a/MatrixUtils.Desktop/MatrixUtils.Desktop.csproj +++ b/MatrixUtils.Desktop/MatrixUtils.Desktop.csproj @@ -20,10 +20,10 @@ - - - - + + + + @@ -31,7 +31,7 @@ - + diff --git a/MatrixUtils.DmSpaced/MatrixUtils.DmSpaced.csproj b/MatrixUtils.DmSpaced/MatrixUtils.DmSpaced.csproj index 96c3bff..b02650d 100644 --- a/MatrixUtils.DmSpaced/MatrixUtils.DmSpaced.csproj +++ b/MatrixUtils.DmSpaced/MatrixUtils.DmSpaced.csproj @@ -21,7 +21,7 @@ - + diff --git a/MatrixUtils.DmSpaced/ModerationBot.cs b/MatrixUtils.DmSpaced/ModerationBot.cs index 6e534fc..17a017b 100644 --- a/MatrixUtils.DmSpaced/ModerationBot.cs +++ b/MatrixUtils.DmSpaced/ModerationBot.cs @@ -57,9 +57,11 @@ public class ModerationBot(AuthenticatedHomeserverGeneric hs, ILogger admins = new(); @@ -85,7 +87,8 @@ public class ModerationBot(AuthenticatedHomeserverGeneric hs, ILogger {changeEvent.MappedType.Name}") { FormattedBody = $"Policy type: {changeEvent.Type} -> {changeEvent.MappedType.Name}" }); @@ -281,11 +286,12 @@ public class ModerationBot(AuthenticatedHomeserverGeneric hs, ILogger> GetAllActiveLayersAsync() { + public async Task> GetAllActiveLayersAsync() { var state = await GetFullStateAsListAsync(); return state.Where(x => x.Type == DMSpaceChildLayer.EventId && x.RawContent.ContainsKey("space_id")).ToList(); } diff --git a/MatrixUtils.RoomUpgradeCLI/MatrixUtils.RoomUpgradeCLI.csproj b/MatrixUtils.RoomUpgradeCLI/MatrixUtils.RoomUpgradeCLI.csproj index f349c81..edca2f5 100644 --- a/MatrixUtils.RoomUpgradeCLI/MatrixUtils.RoomUpgradeCLI.csproj +++ b/MatrixUtils.RoomUpgradeCLI/MatrixUtils.RoomUpgradeCLI.csproj @@ -8,7 +8,7 @@ - + diff --git a/MatrixUtils.Web.Server/MatrixUtils.Web.Server.csproj b/MatrixUtils.Web.Server/MatrixUtils.Web.Server.csproj index 880401a..925266b 100644 --- a/MatrixUtils.Web.Server/MatrixUtils.Web.Server.csproj +++ b/MatrixUtils.Web.Server/MatrixUtils.Web.Server.csproj @@ -8,7 +8,7 @@ - + diff --git a/MatrixUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs b/MatrixUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs index 215ad14..5c0fdab 100644 --- a/MatrixUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs +++ b/MatrixUtils.Web/Classes/RoomCreationTemplates/DefaultRoomCreationTemplate.cs @@ -12,7 +12,7 @@ public class DefaultRoomCreationTemplate : IRoomCreationTemplate { new() { Name = "My new room", RoomAliasName = "myroom", - InitialState = new List { + InitialState = new List { new() { Type = "m.room.history_visibility", TypedContent = new RoomHistoryVisibilityEventContent() { diff --git a/MatrixUtils.Web/MatrixUtils.Web.csproj b/MatrixUtils.Web/MatrixUtils.Web.csproj index f7ebb62..e800c92 100644 --- a/MatrixUtils.Web/MatrixUtils.Web.csproj +++ b/MatrixUtils.Web/MatrixUtils.Web.csproj @@ -41,12 +41,12 @@ - - - - - - + + + + + + diff --git a/MatrixUtils.Web/Pages/HSAdmin/Synapse/BlockMedia.razor b/MatrixUtils.Web/Pages/HSAdmin/Synapse/BlockMedia.razor index e9d0cd2..5ccaca9 100644 --- a/MatrixUtils.Web/Pages/HSAdmin/Synapse/BlockMedia.razor +++ b/MatrixUtils.Web/Pages/HSAdmin/Synapse/BlockMedia.razor @@ -96,7 +96,7 @@ } } - private StateEventResponse? Event { get; set; } + private MatrixEventResponse? Event { get; set; } private string? EventJson { get; @@ -140,7 +140,7 @@ private async Task ExpandEventJson() { Console.WriteLine("Expanding event JSON..."); if (!string.IsNullOrWhiteSpace(EventJson)) { - Event = JsonSerializer.Deserialize(EventJson); + Event = JsonSerializer.Deserialize(EventJson); MxcUrl = Event?.ContentAs()?.Url; Console.WriteLine($"MXC URL: {MxcUrl}"); diff --git a/MatrixUtils.Web/Pages/HSAdmin/Synapse/Components/SynapseRoomShutdownWindowContent.razor b/MatrixUtils.Web/Pages/HSAdmin/Synapse/Components/SynapseRoomShutdownWindowContent.razor index fc9f8e8..b0e6a89 100644 --- a/MatrixUtils.Web/Pages/HSAdmin/Synapse/Components/SynapseRoomShutdownWindowContent.razor +++ b/MatrixUtils.Web/Pages/HSAdmin/Synapse/Components/SynapseRoomShutdownWindowContent.razor @@ -233,7 +233,7 @@ else { } } - private async Task TryGetTombstoneAsync() { + private async Task TryGetTombstoneAsync() { if (EditorOnly) return null; try { return (await Homeserver.Admin.GetRoomStateAsync(Context.RoomId, RoomTombstoneEventContent.EventId)).Events.FirstOrDefault(x => x.StateKey == ""); diff --git a/MatrixUtils.Web/Pages/HSAdmin/Synapse/SubTools/SynapseRoomStateResync.razor b/MatrixUtils.Web/Pages/HSAdmin/Synapse/SubTools/SynapseRoomStateResync.razor index c2446a2..3cc5a6a 100644 --- a/MatrixUtils.Web/Pages/HSAdmin/Synapse/SubTools/SynapseRoomStateResync.razor +++ b/MatrixUtils.Web/Pages/HSAdmin/Synapse/SubTools/SynapseRoomStateResync.razor @@ -39,7 +39,6 @@ } @* stage 3 *@ - @if (Stage == 3) {

Rejoining room, please wait...

Members left to restore:

@@ -82,7 +81,7 @@ private Exception? Error { get; set; } // Stage 1 - private List? Members { get; set; } + private List? Members { get; set; } // Stage 2 private SynapseAdminRoomDeleteStatus? DeleteStatus { get; set; } diff --git a/MatrixUtils.Web/Pages/Labs/Client/ClientComponents/ClientSyncWrapper.cs b/MatrixUtils.Web/Pages/Labs/Client/ClientComponents/ClientSyncWrapper.cs index 16051b8..c58114e 100644 --- a/MatrixUtils.Web/Pages/Labs/Client/ClientComponents/ClientSyncWrapper.cs +++ b/MatrixUtils.Web/Pages/Labs/Client/ClientComponents/ClientSyncWrapper.cs @@ -13,9 +13,10 @@ public class ClientSyncWrapper(AuthenticatedHomeserverGeneric homeserver) : Noti MinimumDelay = TimeSpan.FromMilliseconds(2000), IsInitialSync = false }; + private string _status = "Loading..."; - public ObservableCollection AccountData { get; set; } = new(); + public ObservableCollection AccountData { get; set; } = new(); public ObservableCollection Rooms { get; set; } = new(); public string Status { @@ -29,13 +30,12 @@ public class ClientSyncWrapper(AuthenticatedHomeserverGeneric homeserver) : Noti Status = $"[{DateTime.Now:s}] Syncing..."; await foreach (var response in resp) { Task.Yield(); - Status = $"[{DateTime.Now:s}] {response.Rooms?.Join?.Count ?? 0 + response.Rooms?.Invite?.Count ?? 0 + response.Rooms?.Leave?.Count ?? 0} rooms, {response.AccountData?.Events?.Count ?? 0} account data, {response.ToDevice?.Events?.Count ?? 0} to-device, {response.DeviceLists?.Changed?.Count ?? 0} device lists, {response.Presence?.Events?.Count ?? 0} presence updates"; + Status = + $"[{DateTime.Now:s}] {response.Rooms?.Join?.Count ?? 0 + response.Rooms?.Invite?.Count ?? 0 + response.Rooms?.Leave?.Count ?? 0} rooms, {response.AccountData?.Events?.Count ?? 0} account data, {response.ToDevice?.Events?.Count ?? 0} to-device, {response.DeviceLists?.Changed?.Count ?? 0} device lists, {response.Presence?.Events?.Count ?? 0} presence updates"; await HandleSyncResponse(response); await Task.Yield(); } } - private async Task HandleSyncResponse(SyncResponse resp) { - - } + private async Task HandleSyncResponse(SyncResponse resp) { } } \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Rooms/Create.razor b/MatrixUtils.Web/Pages/Rooms/Create.razor index 021ad18..051d5af 100644 --- a/MatrixUtils.Web/Pages/Rooms/Create.razor +++ b/MatrixUtils.Web/Pages/Rooms/Create.razor @@ -12,10 +12,10 @@ @*
@JsonString
*@ + table.table-top-first-tr tr td:first-child { + vertical-align: top; + } + @@ -41,7 +41,10 @@ } else { -

(#:@Homeserver.WhoAmI.UserId.Split(':').Last())

+

(# + + :@Homeserver.WhoAmI.UserId.Split(':').Last()) +

} @@ -89,7 +92,8 @@ @@ -105,19 +109,27 @@ - : + + : } @foreach (var user in creationEvent.PowerLevelContentOverride.Users.Keys) { var _user = user; - + } @@ -266,6 +278,7 @@ var instance = (IRoomCreationTemplate)Activator.CreateInstance(x); Presets[instance.Name] = instance.CreateRoomRequest; } + Presets = Presets.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value); if (!Presets.ContainsKey("Default")) { @@ -299,7 +312,7 @@ private void InviteMember(string mxid) { if (!creationEvent.InitialState.Any(x => x.Type == "m.room.member" && x.StateKey == mxid) && Homeserver.UserId != mxid) - creationEvent.InitialState.Add(new StateEvent { + creationEvent.InitialState.Add(new MatrixEvent { Type = "m.room.member", StateKey = mxid, TypedContent = new RoomMemberEventContent { @@ -316,7 +329,7 @@ "m.room.server_acl" => "Server ACL", "m.room.avatar" => "Avatar", _ => key - }; + }; private string GetPermissionFriendlyName(string key) => key switch { "m.reaction" => "Send reaction", @@ -331,6 +344,6 @@ "m.room.pinned_events" => "Pin events", "m.room.server_acl" => "Change server ACLs", _ => key - }; + }; } diff --git a/MatrixUtils.Web/Pages/Rooms/PolicyList.razor b/MatrixUtils.Web/Pages/Rooms/PolicyList.razor index 92c6ca5..f2ab186 100644 --- a/MatrixUtils.Web/Pages/Rooms/PolicyList.razor +++ b/MatrixUtils.Web/Pages/Rooms/PolicyList.razor @@ -172,9 +172,9 @@ else { } } - private Dictionary> PolicyEventsByType { get; set; } = new(); + private Dictionary> PolicyEventsByType { get; set; } = new(); - public StateEventResponse? ServerPolicyToMakePermanent { + public MatrixEventResponse? ServerPolicyToMakePermanent { get; set { field = value; @@ -187,9 +187,9 @@ else { private RoomPowerLevelEventContent PowerLevels { get; set; } = null!; public bool CurrentUserIsDraupnir { get; set; } - public Dictionary ActiveKicks { get; set; } = []; + public Dictionary ActiveKicks { get; set; } = []; - private static FrozenSet KnownPolicyTypes = StateEvent.KnownStateEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))).ToFrozenSet(); + private static FrozenSet KnownPolicyTypes = MatrixEvent.KnownEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))).ToFrozenSet(); // event types, unnamed // private static Dictionary PolicyTypes = KnownPolicyTypes @@ -274,14 +274,14 @@ else { if (evt.RawContent is null or { Count: 0 } || string.IsNullOrWhiteSpace(evt.RawContent?["recommendation"]?.GetValue())) { collection.ActivePolicies.Remove(key); if (!collection.RemovedPolicies.TryAdd(key, policyInfo)) { - if (StateEvent.Equals(collection.RemovedPolicies[key].Policy, evt)) continue; + if (MatrixEvent.Equals(collection.RemovedPolicies[key].Policy, evt)) continue; collection.RemovedPolicies[key] = policyInfo; } } else { collection.RemovedPolicies.Remove(key); if (!collection.ActivePolicies.TryAdd(key, policyInfo)) { - if (StateEvent.Equals(collection.ActivePolicies[key].Policy, evt)) continue; + if (MatrixEvent.Equals(collection.ActivePolicies[key].Policy, evt)) continue; collection.ActivePolicies[key] = policyInfo; } } @@ -328,7 +328,7 @@ else { // foreach (var (policyInfo, policyContent) in allPolicies) { // foreach (var (otherPolicyInfo, otherPolicyContent) in allPolicies) { // if (policyInfo.Policy == otherPolicyInfo.Policy) continue; // same event - // if (StateEvent.TypeKeyPairMatches(policyInfo.Policy, otherPolicyInfo.Policy)) { + // if (MatrixEvent.TypeKeyPairMatches(policyInfo.Policy, otherPolicyInfo.Policy)) { // logger.LogWarning("Sanity check failed: Found same type and state key for two different policies: {Policy1} and {Policy2}", policyInfo.Policy.RawContent.ToJson(), otherPolicyInfo.Policy.RawContent.ToJson()); // continue; // same type and state key // } @@ -343,7 +343,7 @@ else { int scanningPolicyCount = 0; var aggregatedPolicies = PolicyCollections.Values - .Aggregate(new List(), (acc, val) => { + .Aggregate(new List(), (acc, val) => { acc.AddRange(val.ActivePolicies.Select(x => x.Value.Policy)); return acc; }); @@ -387,8 +387,8 @@ else { // Console.WriteLine($"Main: got {modifiedPolicyInfos.Count} modified policies from worker, time: {scanSw.Elapsed}"); foreach (var modifiedPolicyInfo in modifiedPolicyInfos) { var original = allPolicyInfos.First(p => p.Policy.EventId == modifiedPolicyInfo.Policy.EventId); - original.DuplicatedBy = aggregatedPolicies.Where(x => modifiedPolicyInfo.DuplicatedBy.Any(y => StateEvent.Equals(x, y))).ToList(); - original.MadeRedundantBy = aggregatedPolicies.Where(x => modifiedPolicyInfo.MadeRedundantBy.Any(y => StateEvent.Equals(x, y))).ToList(); + original.DuplicatedBy = aggregatedPolicies.Where(x => modifiedPolicyInfo.DuplicatedBy.Any(y => MatrixEvent.Equals(x, y))).ToList(); + original.MadeRedundantBy = aggregatedPolicies.Where(x => modifiedPolicyInfo.MadeRedundantBy.Any(y => MatrixEvent.Equals(x, y))).ToList(); modifiedPolicyInfo.DuplicatedBy = modifiedPolicyInfo.MadeRedundantBy = []; // Early dereference if (original.DuplicatedBy.Count > 0) { if (!DuplicateBans.Value.ActivePolicies.ContainsKey((original.Policy.Type, original.Policy.StateKey!))) @@ -476,24 +476,24 @@ else { [return: WorkerTransfer] private static async Task> CheckDuplicatePoliciesAsync(SpawnDev.BlazorJS.JSObjects.String policiesJson, int start, int end) { - var policies = JsonSerializer.Deserialize>(policiesJson.ValueOf()); + var policies = JsonSerializer.Deserialize>(policiesJson.ValueOf()); Console.WriteLine($"Got request to check duplicate policies in range {start} to {end} (length: {end - start}), {policiesJson.ValueOf().Length} bytes of JSON ({policies!.Count} policies)"); return await CheckDuplicatePoliciesAsync(policies!, start .. end); } [return: WorkerTransfer] private static async Task> CheckDuplicatePoliciesAsync(string policiesJson, int start, int end) { - var policies = JsonSerializer.Deserialize>(policiesJson); + var policies = JsonSerializer.Deserialize>(policiesJson); Console.WriteLine($"Got request to check duplicate policies in range {start} to {end} (length: {end - start}), {policiesJson.Length} bytes of JSON ({policies!.Count} policies)"); return await CheckDuplicatePoliciesAsync(policies!, start .. end); } [return: WorkerTransfer] - private static Task> CheckDuplicatePoliciesAsync(List policies, int start, int end) + private static Task> CheckDuplicatePoliciesAsync(List policies, int start, int end) => CheckDuplicatePoliciesAsync(policies, start .. end); [return: WorkerTransfer] - private static async Task> CheckDuplicatePoliciesAsync(List policies, Range range) { + private static async Task> CheckDuplicatePoliciesAsync(List policies, Range range) { var sw = Stopwatch.StartNew(); var jsConsole = App.Host.Services.GetService()!; Console.WriteLine($"Processing policies in range {range} ({range.GetOffsetAndLength(policies.Count).Length}) with {policies.Count} total policies"); @@ -504,12 +504,12 @@ else { var modifiedPolicies = new List(); foreach (var (policyEvent, policyContent) in toCheck) { - List duplicatedBy = []; - List madeRedundantBy = []; + List duplicatedBy = []; + List madeRedundantBy = []; foreach (var (otherPolicyEvent, otherPolicyContent) in allPolicies) { if (policyEvent == otherPolicyEvent) continue; // same event - if (StateEvent.TypeKeyPairMatches(policyEvent, otherPolicyEvent)) { + if (MatrixEvent.TypeKeyPairMatches(policyEvent, otherPolicyEvent)) { // logger.LogWarning("Sanity check failed: Found same type and state key for two different policies: {Policy1} and {Policy2}", policyInfo.Policy.RawContent.ToJson(), otherPolicyInfo.Policy.RawContent.ToJson()); Console.WriteLine($"Sanity check failed: Found same type and state key for two different policies: {policyEvent.RawContent.ToJson()} and {otherPolicyEvent.RawContent.ToJson()}"); continue; // same type and state key @@ -561,7 +561,7 @@ else { foreach (var type in KnownPolicyTypes) { if (!PolicyEventsByType.ContainsKey(type)) PolicyEventsByType.Add(type, new List - (16000)); + (16000)); } int count = 0; @@ -573,9 +573,9 @@ else { e1 = _spsw.Elapsed; var targetPolicies = PolicyEventsByType[state.MappedType]; e2 = _spsw.Elapsed; - if (!firstLoad && targetPolicies.FirstOrDefault(x => StateEvent.TypeKeyPairMatches(x, state)) is { } evt) { + if (!firstLoad && targetPolicies.FirstOrDefault(x => MatrixEvent.TypeKeyPairMatches(x, state)) is { } evt) { e3 = _spsw.Elapsed; - if (StateEvent.Equals(evt, state)) { + if (MatrixEvent.Equals(evt, state)) { if (count % 100 == 0) { await Task.Delay(10); await Task.Yield(); @@ -613,15 +613,15 @@ else { logger.LogInformation("LoadStatesAsync: yield finished in {SwElapsed}", sw.Elapsed); } - private List GetPolicyEventsByType(Type type) => PolicyEventsByType.ContainsKey(type) ? PolicyEventsByType[type] : []; + private List GetPolicyEventsByType(Type type) => PolicyEventsByType.ContainsKey(type) ? PolicyEventsByType[type] : []; - // private List GetValidPolicyEventsByType(Type type) => GetPolicyEventsByType(type) + // private List GetValidPolicyEventsByType(Type type) => GetPolicyEventsByType(type) // .Where(x => !string.IsNullOrWhiteSpace(x.RawContent?["recommendation"]?.GetValue())).ToList(); // - // private List GetInvalidPolicyEventsByType(Type type) => GetPolicyEventsByType(type) + // private List GetInvalidPolicyEventsByType(Type type) => GetPolicyEventsByType(type) // .Where(x => x.RawContent is { Count: > 0 } && string.IsNullOrWhiteSpace(x.RawContent?["recommendation"]?.GetValue())).ToList(); // - // private List GetRemovedPolicyEventsByType(Type type) => GetPolicyEventsByType(type) + // private List GetRemovedPolicyEventsByType(Type type) => GetPolicyEventsByType(type) // .Where(x => x.RawContent is null or { Count: 0 }).ToList(); private string? GetPolicyTypeNameOrNull(Type type) => type.GetFriendlyNamePluralOrNull() @@ -637,14 +637,14 @@ else { public required Dictionary<(string Type, string StateKey), PolicyInfo> ActivePolicies { get; set; } - // public Dictionary<(string Type, string StateKey), StateEventResponse> InvalidPolicies { get; set; } + // public Dictionary<(string Type, string StateKey), MatrixEventResponse> InvalidPolicies { get; set; } public required Dictionary<(string Type, string StateKey), PolicyInfo> RemovedPolicies { get; set; } public required FrozenDictionary PropertiesToDisplay { get; set; } public class PolicyInfo { - public required StateEventResponse Policy { get; init; } - public required List MadeRedundantBy { get; set; } - public required List DuplicatedBy { get; set; } + public required MatrixEventResponse Policy { get; init; } + public required List MadeRedundantBy { get; set; } + public required List DuplicatedBy { get; set; } } public enum SpecialViewType { diff --git a/MatrixUtils.Web/Pages/Rooms/PolicyList.razor.cs b/MatrixUtils.Web/Pages/Rooms/PolicyList.razor.cs index 0106c6e..6f45041 100644 --- a/MatrixUtils.Web/Pages/Rooms/PolicyList.razor.cs +++ b/MatrixUtils.Web/Pages/Rooms/PolicyList.razor.cs @@ -8,12 +8,11 @@ using SpawnDev.BlazorJS.WebWorkers; namespace MatrixUtils.Web.Pages.Rooms; public partial class PolicyList { - #region Draupnir interop private SemaphoreSlim ss = new(16, 16); - private async Task DraupnirKickMatching(StateEventResponse policy) { + private async Task DraupnirKickMatching(MatrixEventResponse policy) { try { var content = policy.TypedContent! as PolicyRuleEventContent; if (content is null) return; @@ -94,7 +93,7 @@ public partial class PolicyList { #region Nasty, nasty internals, please ignore! private static class NastyInternalsPleaseIgnore { - public static async Task ExecuteKickWithWasmWorkers(WebWorkerService workerService, AuthenticatedHomeserverGeneric hs, StateEventResponse evt, List roomIds) { + public static async Task ExecuteKickWithWasmWorkers(WebWorkerService workerService, AuthenticatedHomeserverGeneric hs, MatrixEventResponse evt, List roomIds) { try { // var tasks = roomIds.Select(roomId => workerService.TaskPool.Invoke(ExecuteKickInternal, hs.WellKnownUris.Client, hs.AccessToken, roomId, content.Entity)).ToList(); var tasks = roomIds.Select(roomId => workerService.TaskPool.Invoke(ExecuteKickInternal2, hs.WellKnownUris, hs.AccessToken, roomId, evt)).ToList(); @@ -131,7 +130,7 @@ public partial class PolicyList { } } - private async static Task ExecuteKickInternal2(HomeserverResolverService.WellKnownUris wellKnownUris, string accessToken, string roomId, StateEventResponse policy) { + private async static Task ExecuteKickInternal2(HomeserverResolverService.WellKnownUris wellKnownUris, string accessToken, string roomId, MatrixEventResponse policy) { Console.WriteLine($"Checking {roomId}..."); Console.WriteLine(policy.EventId); } @@ -140,5 +139,4 @@ public partial class PolicyList { #endregion #endregion - } \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Rooms/PolicyList2.razor b/MatrixUtils.Web/Pages/Rooms/PolicyList2.razor index 5d5bb5d..ac918a8 100644 --- a/MatrixUtils.Web/Pages/Rooms/PolicyList2.razor +++ b/MatrixUtils.Web/Pages/Rooms/PolicyList2.razor @@ -15,7 +15,11 @@

Policy list editor - Editing @RoomId


@* *@ -Create new policy +Create new policy + @if (Loading) {

Loading...

@@ -71,14 +75,22 @@ else { }
@if (PowerLevels.UserHasStatePermission(Homeserver.WhoAmI.UserId, policy.Type)) { - Edit + Edit + Remove @if (policy.IsLegacyType) { Update policy type } @if (PolicyTypeIds[typeof(ServerPolicyRuleEventContent)].Contains(policy.EventId)) { - Make permanent (wildcard) + Make permanent (wildcard) + @if (CurrentUserIsDraupnir) { Kick matching users } @@ -144,12 +156,12 @@ else { public string RoomId { get; set; } private bool _enableAvatars; - private StateEventResponse? _currentlyEditingEvent; - private StateEventResponse? _serverPolicyToMakePermanent; + private MatrixEventResponse? _currentlyEditingEvent; + private MatrixEventResponse? _serverPolicyToMakePermanent; - private Dictionary> PolicyEventsByType { get; set; } = new(); + private Dictionary> PolicyEventsByType { get; set; } = new(); - private StateEventResponse? CurrentlyEditingEvent { + private MatrixEventResponse? CurrentlyEditingEvent { get => _currentlyEditingEvent; set { _currentlyEditingEvent = value; @@ -157,7 +169,7 @@ else { } } - private StateEventResponse? ServerPolicyToMakePermanent { + private MatrixEventResponse? ServerPolicyToMakePermanent { get => _serverPolicyToMakePermanent; set { _serverPolicyToMakePermanent = value; @@ -197,12 +209,12 @@ else { StateHasChanged(); } - private List GetPolicyEventsByType(Type type) => PolicyEventsByType.ContainsKey(type) ? PolicyEventsByType[type] : []; + private List GetPolicyEventsByType(Type type) => PolicyEventsByType.ContainsKey(type) ? PolicyEventsByType[type] : []; - private List GetValidPolicyEventsByType(Type type) => GetPolicyEventsByType(type) + private List GetValidPolicyEventsByType(Type type) => GetPolicyEventsByType(type) .Where(x => !string.IsNullOrWhiteSpace(x.RawContent?["recommendation"]?.GetValue())).ToList(); - private List GetInvalidPolicyEventsByType(Type type) => GetPolicyEventsByType(type) + private List GetInvalidPolicyEventsByType(Type type) => GetPolicyEventsByType(type) .Where(x => string.IsNullOrWhiteSpace(x.RawContent?["recommendation"]?.GetValue())).ToList(); private string? GetPolicyTypeNameOrNull(Type type) => type.GetFriendlyNamePluralOrNull() @@ -211,24 +223,24 @@ else { private string GetPolicyTypeName(Type type) => GetPolicyTypeNameOrNull(type) ?? type.Name; - private async Task RemovePolicyAsync(StateEventResponse policyEvent) { + private async Task RemovePolicyAsync(MatrixEventResponse policyEvent) { await Room.SendStateEventAsync(policyEvent.Type, policyEvent.StateKey.UrlEncode(), new { }); PolicyEventsByType[policyEvent.MappedType].Remove(policyEvent); await LoadStatesAsync(); } - private async Task UpdatePolicyAsync(StateEventResponse policyEvent) { + private async Task UpdatePolicyAsync(MatrixEventResponse policyEvent) { await Room.SendStateEventAsync(policyEvent.Type, policyEvent.StateKey.UrlEncode(), policyEvent.RawContent); CurrentlyEditingEvent = null; await LoadStatesAsync(); } - private async Task UpgradePolicyAsync(StateEventResponse policyEvent) { + private async Task UpgradePolicyAsync(MatrixEventResponse policyEvent) { policyEvent.RawContent["upgraded_from_type"] = policyEvent.Type; await LoadStatesAsync(); } - private static FrozenSet KnownPolicyTypes = StateEvent.KnownStateEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))).ToFrozenSet(); + private static FrozenSet KnownPolicyTypes = MatrixEvent.KnownEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))).ToFrozenSet(); // event types, unnamed private static Dictionary PolicyTypes = KnownPolicyTypes diff --git a/MatrixUtils.Web/Pages/Rooms/PolicyListComponents/PolicyListEditorHeader.razor b/MatrixUtils.Web/Pages/Rooms/PolicyListComponents/PolicyListEditorHeader.razor index 8585561..b57beae 100644 --- a/MatrixUtils.Web/Pages/Rooms/PolicyListComponents/PolicyListEditorHeader.razor +++ b/MatrixUtils.Web/Pages/Rooms/PolicyListComponents/PolicyListEditorHeader.razor @@ -55,7 +55,7 @@ private string? RoomAlias { get; set; } private string? DraupnirShortcode { get; set; } - private StateEventResponse? CurrentlyEditingEvent { + private MatrixEventResponse? CurrentlyEditingEvent { get; set { field = value; @@ -81,7 +81,7 @@ StateHasChanged(); } - private async Task UpdatePolicyAsync(StateEventResponse evt) { + private async Task UpdatePolicyAsync(MatrixEventResponse evt) { Console.WriteLine("UpdatePolicyAsync in PolicyListEditorHeader not yet implemented!"); } diff --git a/MatrixUtils.Web/Pages/Rooms/PolicyListComponents/PolicyListRowComponent.razor b/MatrixUtils.Web/Pages/Rooms/PolicyListComponents/PolicyListRowComponent.razor index cd432c9..3ded78f 100644 --- a/MatrixUtils.Web/Pages/Rooms/PolicyListComponents/PolicyListRowComponent.razor +++ b/MatrixUtils.Web/Pages/Rooms/PolicyListComponents/PolicyListRowComponent.razor @@ -99,7 +99,7 @@ [Parameter] public required Action PolicyCollectionStateHasChanged { get; set; } - private StateEventResponse Policy => PolicyInfo.Policy; + private MatrixEventResponse Policy => PolicyInfo.Policy; private bool IsEditing { get; @@ -152,8 +152,8 @@ if (PolicyInfo.DuplicatedBy.Count > 0) { foreach (var evt in PolicyInfo.DuplicatedBy) { var matchingEntry = PolicyCollection.ActivePolicies - .FirstOrDefault(x => StateEvent.Equals(x.Value.Policy, evt)).Value; - var removals = matchingEntry.DuplicatedBy.RemoveAll(x => StateEvent.Equals(x, Policy)); + .FirstOrDefault(x => MatrixEvent.Equals(x.Value.Policy, evt)).Value; + var removals = matchingEntry.DuplicatedBy.RemoveAll(x => MatrixEvent.Equals(x, Policy)); Console.WriteLine($"Removed {removals} duplicates from {evt.EventId}, matching entry: {matchingEntry.ToJson()}"); if (PolicyCollection.ViewType == PolicyList.PolicyCollection.SpecialViewType.Duplicates && matchingEntry.DuplicatedBy.Count == 0) { PolicyCollection.ActivePolicies.Remove((matchingEntry.Policy.Type, matchingEntry.Policy.StateKey)); @@ -169,8 +169,8 @@ if (PolicyInfo.MadeRedundantBy.Count > 0) { foreach (var evt in PolicyInfo.MadeRedundantBy) { var matchingEntry = PolicyCollection.ActivePolicies - .FirstOrDefault(x => StateEvent.Equals(x.Value.Policy, evt)).Value; - var removals = matchingEntry.MadeRedundantBy.RemoveAll(x => StateEvent.Equals(x, Policy)); + .FirstOrDefault(x => MatrixEvent.Equals(x.Value.Policy, evt)).Value; + var removals = matchingEntry.MadeRedundantBy.RemoveAll(x => MatrixEvent.Equals(x, Policy)); Console.WriteLine($"Removed {removals} redundants from {evt.EventId}, matching entry: {matchingEntry.ToJson()}"); } @@ -186,7 +186,7 @@ // await LoadStatesAsync(); } - private async Task UpdatePolicyAsync(StateEventResponse evt) { + private async Task UpdatePolicyAsync(MatrixEventResponse evt) { await Room.SendStateEventAsync(Policy.Type, Policy.StateKey, Policy.RawContent); // CurrentlyEditingEvent = null; // await LoadStatesAsync(); diff --git a/MatrixUtils.Web/Pages/Rooms/PolicyLists.razor b/MatrixUtils.Web/Pages/Rooms/PolicyLists.razor index 52c5f30..a84ef8c 100644 --- a/MatrixUtils.Web/Pages/Rooms/PolicyLists.razor +++ b/MatrixUtils.Web/Pages/Rooms/PolicyLists.razor @@ -188,7 +188,7 @@ Server } - public static async Task FromRoom(GenericRoom room, List? state = null, bool legacy = false) { + public static async Task FromRoom(GenericRoom room, List? state = null, bool legacy = false) { state ??= await room.GetFullStateAsListAsync(); return new RoomInfo() { Room = room, diff --git a/MatrixUtils.Web/Pages/Rooms/RoomCreateComponents/RoomCreateInitialStateOptions.razor b/MatrixUtils.Web/Pages/Rooms/RoomCreateComponents/RoomCreateInitialStateOptions.razor index 99facbf..2b1d90a 100644 --- a/MatrixUtils.Web/Pages/Rooms/RoomCreateComponents/RoomCreateInitialStateOptions.razor +++ b/MatrixUtils.Web/Pages/Rooms/RoomCreateComponents/RoomCreateInitialStateOptions.razor @@ -5,7 +5,7 @@
- + } else {
Preset:
@* *@
-
+ +
- +
: - + + : + +
Initial room state: - @foreach (var (displayName, events) in new Dictionary>() { + @foreach (var (displayName, events) in new Dictionary>() { { "Important room state (before final access rules)", roomBuilder.ImportantState }, { "Additional room state (after final access rules)", roomBuilder.InitialState }, }) { @@ -47,10 +47,10 @@ @* if (string.IsNullOrWhiteSpace(json)) *@ @* events.Remove(initialState); *@ @* else *@ - @* events.Replace(initialState, JsonSerializer.Deserialize(json)); *@ + @* events.Replace(initialState, JsonSerializer.Deserialize(json)); *@ @* StateHasChanged(); *@ @* })"> *@ - +
} @@ -71,7 +71,7 @@ [Parameter] public AuthenticatedHomeserverGeneric Homeserver { get; set; } - private RenderFragment GetRemoveButton(List events, StateEvent initialState) { + private RenderFragment GetRemoveButton(List events, MatrixEvent initialState) { return @ ()!; - // - // foreach (var stateEvent in States) { - // if (stateEvent.Type == "m.space.child") { - // // if (stateEvent.Content.ToJson().Length < 5) return; - // var roomId = stateEvent.StateKey; - // var room = hs.GetRoom(roomId); - // if (room is not null) { - // Rooms.Add(room); - // } - // } - // else if (stateEvent.Type == "m.room.member") { - // var serverName = stateEvent.StateKey.Split(':').Last(); - // if (!ServersInSpace.Contains(serverName)) { - // ServersInSpace.Add(serverName); - // } - // } - // } - - // if(state.Value.TryGetProperty("Type", out var Type)) - // { - // } - // else - // { - // //this is fine, apprently... - // //Console.WriteLine($"Room {room.RoomId} has no Content.Type in m.room.create!"); - // } - - // await base.OnInitializedAsync(); + // var state = await Room.GetStateAsync(""); + // if (state is not null) { + // // Console.WriteLine(state.Value.ToJson()); + // States = state.Value.Deserialize()!; + // + // foreach (var stateEvent in States) { + // if (stateEvent.Type == "m.space.child") { + // // if (stateEvent.Content.ToJson().Length < 5) return; + // var roomId = stateEvent.StateKey; + // var room = hs.GetRoom(roomId); + // if (room is not null) { + // Rooms.Add(room); + // } + // } + // else if (stateEvent.Type == "m.room.member") { + // var serverName = stateEvent.StateKey.Split(':').Last(); + // if (!ServersInSpace.Contains(serverName)) { + // ServersInSpace.Add(serverName); + // } + // } + // } + + // if(state.Value.TryGetProperty("Type", out var Type)) + // { + // } + // else + // { + // //this is fine, apprently... + // //Console.WriteLine($"Room {room.RoomId} has no Content.Type in m.room.create!"); + // } + + // await base.OnInitializedAsync(); } private async Task JoinAllRooms() { @@ -124,13 +127,14 @@ var joined = false; while (!joined) { var ce = await room.GetCreateEventAsync(); - if(ce is null) continue; + if (ce is null) continue; if (ce.Type == "m.space") { - var children = room.AsSpace().GetChildrenAsync(false); - await foreach (var child in children) { - JoinRecursive(child.RoomId); - } + var children = room.AsSpace().GetChildrenAsync(false); + await foreach (var child in children) { + JoinRecursive(child.RoomId); + } } + joined = true; await Task.Delay(1000); } @@ -138,7 +142,6 @@ catch (Exception e) { Console.WriteLine(e); } - } private async Task AddNewRoom() { diff --git a/MatrixUtils.Web/Pages/Rooms/StateEditor.razor b/MatrixUtils.Web/Pages/Rooms/StateEditor.razor index 51cb265..47146bc 100644 --- a/MatrixUtils.Web/Pages/Rooms/StateEditor.razor +++ b/MatrixUtils.Web/Pages/Rooms/StateEditor.razor @@ -37,8 +37,8 @@ [Parameter] public string? RoomId { get; set; } - public List FilteredEvents { get; set; } = new(); - public List Events { get; set; } = new(); + public List FilteredEvents { get; set; } = new(); + public List Events { get; set; } = new(); public string status = ""; protected override async Task OnInitializedAsync() { @@ -58,7 +58,7 @@ var StateLoaded = 0; var response = (hs.GetRoom(RoomId)).GetFullStateAsync(); await foreach (var _ev in response) { - // var e = new StateEventResponse { + // var e = new MatrixEventResponse { // Type = _ev.Type, // StateKey = _ev.StateKey, // OriginServerTs = _ev.OriginServerTs, @@ -68,6 +68,7 @@ if (string.IsNullOrEmpty(_ev.StateKey)) { FilteredEvents.Add(_ev); } + StateLoaded++; if (!((DateTime.Now - _lastUpdate).TotalMilliseconds > 100)) continue; @@ -103,11 +104,12 @@ public string content { get; set; } public long origin_server_ts { get; set; } public string state_key { get; set; } + public string type { get; set; } - // public string Sender { get; set; } - // public string EventId { get; set; } - // public string UserId { get; set; } - // public string ReplacesState { get; set; } + // public string Sender { get; set; } + // public string EventId { get; set; } + // public string UserId { get; set; } + // public string ReplacesState { get; set; } } public bool ShowMembershipEvents { diff --git a/MatrixUtils.Web/Pages/Rooms/StateViewer.razor b/MatrixUtils.Web/Pages/Rooms/StateViewer.razor index c8b87d3..16b1d3d 100644 --- a/MatrixUtils.Web/Pages/Rooms/StateViewer.razor +++ b/MatrixUtils.Web/Pages/Rooms/StateViewer.razor @@ -12,20 +12,20 @@ - - - - - - - @foreach (var stateEvent in FilteredEvents.Where(x => x.StateKey == "").OrderBy(x => x.OriginServerTs)) { - - + + - } + + + @foreach (var stateEvent in FilteredEvents.Where(x => x.StateKey == "").OrderBy(x => x.OriginServerTs)) { + + + + + }
TypeContent
@stateEvent.Type -
@stateEvent.RawContent.ToJson()
-
TypeContent
@stateEvent.Type +
@stateEvent.RawContent.ToJson()
+
@@ -34,20 +34,20 @@ @group.Key - - - - - - - @foreach (var stateEvent in group.OrderBy(x => x.OriginServerTs)) { - - + + - } + + + @foreach (var stateEvent in group.OrderBy(x => x.OriginServerTs)) { + + + + + }
TypeContent
@stateEvent.Type -
@stateEvent.RawContent.ToJson()
-
TypeContent
@stateEvent.Type +
@stateEvent.RawContent.ToJson()
+
@@ -64,8 +64,8 @@ [Parameter] public string? RoomId { get; set; } - public List FilteredEvents { get; set; } = new(); - public List Events { get; set; } = new(); + public List FilteredEvents { get; set; } = new(); + public List Events { get; set; } = new(); public string status = ""; protected override async Task OnInitializedAsync() { @@ -88,6 +88,7 @@ if (string.IsNullOrEmpty(_ev.StateKey)) { FilteredEvents.Add(_ev); } + StateLoaded++; if (!((DateTime.Now - _lastUpdate).TotalMilliseconds > 100)) continue; diff --git a/MatrixUtils.Web/Pages/Rooms/Timeline.razor b/MatrixUtils.Web/Pages/Rooms/Timeline.razor index 2af819b..f9137b0 100644 --- a/MatrixUtils.Web/Pages/Rooms/Timeline.razor +++ b/MatrixUtils.Web/Pages/Rooms/Timeline.razor @@ -22,7 +22,7 @@ public string RoomId { get; set; } private List Events { get; } = new(); - private List RawEvents { get; } = new(); + private List RawEvents { get; } = new(); private AuthenticatedHomeserverGeneric? Homeserver { get; set; } @@ -44,9 +44,9 @@ await base.OnInitializedAsync(); } - // private StateEventResponse GetProfileEventBefore(StateEventResponse Event) => Events.TakeWhile(x => x != Event).Last(e => e.Type == RoomMemberEventContent.EventId && e.StateKey == Event.Sender); + // private MatrixEventResponse GetProfileEventBefore(MatrixEventResponse Event) => Events.TakeWhile(x => x != Event).Last(e => e.Type == RoomMemberEventContent.EventId && e.StateKey == Event.Sender); - private Type ComponentType(StateEvent Event) => Event.Type switch { + private Type ComponentType(MatrixEvent Event) => Event.Type switch { RoomCanonicalAliasEventContent.EventId => typeof(TimelineCanonicalAliasItem), RoomHistoryVisibilityEventContent.EventId => typeof(TimelineHistoryVisibilityItem), RoomTopicEventContent.EventId => typeof(TimelineRoomTopicItem), @@ -57,9 +57,9 @@ // RoomMessageReactionEventContent.EventId => typeof(ComponentBase), _ => typeof(TimelineUnknownItem) }; - + private class TimelineEventItem : ComponentBase { - public StateEventResponse Event { get; set; } + public MatrixEventResponse Event { get; set; } public Type Type { get; set; } } diff --git a/MatrixUtils.Web/Pages/StreamTest.razor b/MatrixUtils.Web/Pages/StreamTest.razor index 7740596..949bddc 100644 --- a/MatrixUtils.Web/Pages/StreamTest.razor +++ b/MatrixUtils.Web/Pages/StreamTest.razor @@ -48,9 +48,9 @@ var members = roomState.Where(x => x.Type == RoomMemberEventContent.EventId).ToList(); Console.WriteLine($"Got {members.Count()} members"); var ss = new SemaphoreSlim(1, 1); - foreach (var stateEventResponse in members) { - // Console.WriteLine(stateEventResponse.ToJson()); - var mc = stateEventResponse.TypedContent as RoomMemberEventContent; + foreach (var MatrixEventResponse in members) { + // Console.WriteLine(MatrixEventResponse.ToJson()); + var mc = MatrixEventResponse.TypedContent as RoomMemberEventContent; if (!string.IsNullOrWhiteSpace(mc?.AvatarUrl)) { var uri = mc.AvatarUrl[6..].Split('/'); var url = $"/_matrix/media/v3/download/{uri[0]}/{uri[1]}"; diff --git a/MatrixUtils.Web/Pages/Tools/Info/PolicyListActivity.razor b/MatrixUtils.Web/Pages/Tools/Info/PolicyListActivity.razor index bfd5fd3..ba8036c 100644 --- a/MatrixUtils.Web/Pages/Tools/Info/PolicyListActivity.razor +++ b/MatrixUtils.Web/Pages/Tools/Info/PolicyListActivity.razor @@ -74,7 +74,7 @@ else } //use timeline - var types = StateEventResponse.KnownStateEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))); + var types = MatrixEvent.KnownEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))); var filter = new SyncFilter.EventFilter(types: types.SelectMany(x => x.GetCustomAttributes().Select(y => y.EventName)).ToList()); var timeline = room.GetManyMessagesAsync(limit: int.MaxValue, chunkSize: 2500, filter: filter.ToJson(indent: false, ignoreNull: true)); await foreach (var response in timeline) { @@ -119,10 +119,10 @@ else private readonly struct StateEventEntry { public required DateTime Timestamp { get; init; } public required StateEventTransition State { get; init; } - public required StateEventResponse Event { get; init; } - public required StateEventResponse? Previous { get; init; } + public required MatrixEventResponse Event { get; init; } + public required MatrixEventResponse? Previous { get; init; } - public void Deconstruct(out StateEventTransition transition, out StateEventResponse evt, out StateEventResponse? prev) { + public void Deconstruct(out StateEventTransition transition, out MatrixEventResponse evt, out MatrixEventResponse? prev) { transition = State; evt = Event; prev = Previous; diff --git a/MatrixUtils.Web/Pages/Tools/Info/SessionCount.razor b/MatrixUtils.Web/Pages/Tools/Info/SessionCount.razor index dc5333b..76ff629 100644 --- a/MatrixUtils.Web/Pages/Tools/Info/SessionCount.razor +++ b/MatrixUtils.Web/Pages/Tools/Info/SessionCount.razor @@ -60,7 +60,7 @@ private ObservableCollection log { get; set; } = new(); List hss { get; set; } = new(); ObservableCollection rooms { get; set; } = new(); - Dictionary> roomMembers { get; set; } = new(); + Dictionary> roomMembers { get; set; } = new(); Dictionary> matches = new(); private string UserIdString { @@ -147,7 +147,7 @@ private class Matches { public GenericRoom Room; - public StateEventResponse Event; + public MatrixEventResponse Event; // public } diff --git a/MatrixUtils.Web/Pages/Tools/Moderation/FindUsersByRegex.razor b/MatrixUtils.Web/Pages/Tools/Moderation/FindUsersByRegex.razor index 5ad9de4..9139561 100644 --- a/MatrixUtils.Web/Pages/Tools/Moderation/FindUsersByRegex.razor +++ b/MatrixUtils.Web/Pages/Tools/Moderation/FindUsersByRegex.razor @@ -145,7 +145,7 @@ private class Match { public GenericRoom Room; - public StateEventResponse Event; + public MatrixEventResponse Event; public string RoomName { get; set; } } diff --git a/MatrixUtils.Web/Pages/Tools/Moderation/MembershipHistory.razor b/MatrixUtils.Web/Pages/Tools/Moderation/MembershipHistory.razor index 11c4a80..ec1d190 100644 --- a/MatrixUtils.Web/Pages/Tools/Moderation/MembershipHistory.razor +++ b/MatrixUtils.Web/Pages/Tools/Moderation/MembershipHistory.razor @@ -31,23 +31,23 @@

Hide all + ShowJoins = ShowLeaves = ShowKnocks = ShowInvites = ShowBans = false; + StateHasChanged(); + })">Hide all Show all + ShowJoins = ShowLeaves = ShowKnocks = ShowInvites = ShowBans = true; + StateHasChanged(); + })">Show all Toggle all + ShowJoins ^= true; + ShowLeaves ^= true; + ShowKnocks ^= true; + ShowInvites ^= true; + ShowBans ^= true; + StateHasChanged(); + })">Toggle all

@@ -56,25 +56,25 @@ kicks unbans profile updates -

- - - invite actions - - accepted - rejected - retracted -
-
- - - knock actions - - accepted - rejected - retracted -
- } +
+ + + invite actions + + accepted + rejected + retracted +
+
+ + + knock actions + + accepted + rejected + retracted +
+}

@if (DoDisambiguate) {

@@ -130,29 +130,29 @@

Un-disambiguate all + DoDisambiguate = DisambiguateProfileUpdates = DisambiguateKicks = DisambiguateUnbans = DisambiguateInviteAccepted = DisambiguateInviteRejected = DisambiguateInviteRetracted = DisambiguateKnockAccepted = DisambiguateKnockRejected = DisambiguateKnockRetracted = DisambiguateKnockActions = DisambiguateInviteActions = false; + StateHasChanged(); + })">Un-disambiguate all Disambiguate all + DoDisambiguate = DisambiguateProfileUpdates = DisambiguateKicks = DisambiguateUnbans = DisambiguateInviteAccepted = DisambiguateInviteRejected = DisambiguateInviteRetracted = DisambiguateKnockAccepted = DisambiguateKnockRejected = DisambiguateKnockRetracted = DisambiguateKnockActions = DisambiguateInviteActions = true; + StateHasChanged(); + })">Disambiguate all Toggle all + DisambiguateProfileUpdates ^= true; + DisambiguateKicks ^= true; + DisambiguateUnbans ^= true; + DisambiguateInviteAccepted ^= true; + DisambiguateInviteRejected ^= true; + DisambiguateInviteRetracted ^= true; + DisambiguateKnockAccepted ^= true; + DisambiguateKnockRejected ^= true; + DisambiguateKnockRetracted ^= true; + DisambiguateKnockActions ^= true; + DisambiguateInviteActions ^= true; + StateHasChanged(); + })">Toggle all

} @@ -306,18 +306,61 @@ private bool ShowBans { get; set; } = true; private bool DoDisambiguate { get; set; } = true; - private bool DisambiguateProfileUpdates { get => field && DoDisambiguate; set; } = true; - private bool DisambiguateKicks { get => field && DoDisambiguate; set; } = true; - private bool DisambiguateUnbans { get => field && DoDisambiguate; set; } = true; - private bool DisambiguateInviteAccepted { get => field && DoDisambiguate && DisambiguateInviteActions; set; } = true; - private bool DisambiguateInviteRejected { get => field && DoDisambiguate && DisambiguateInviteActions; set; } = true; - private bool DisambiguateInviteRetracted { get => field && DoDisambiguate && DisambiguateInviteActions; set; } = true; - private bool DisambiguateKnockAccepted { get => field && DoDisambiguate && DisambiguateKnockActions; set; } = true; - private bool DisambiguateKnockRejected { get => field && DoDisambiguate && DisambiguateKnockActions; set; } = true; - private bool DisambiguateKnockRetracted { get => field && DoDisambiguate && DisambiguateKnockActions; set; } = true; - - private bool DisambiguateKnockActions { get => field && DoDisambiguate; set; } = true; - private bool DisambiguateInviteActions { get => field && DoDisambiguate; set; } = true; + + private bool DisambiguateProfileUpdates { + get => field && DoDisambiguate; + set; + } = true; + + private bool DisambiguateKicks { + get => field && DoDisambiguate; + set; + } = true; + + private bool DisambiguateUnbans { + get => field && DoDisambiguate; + set; + } = true; + + private bool DisambiguateInviteAccepted { + get => field && DoDisambiguate && DisambiguateInviteActions; + set; + } = true; + + private bool DisambiguateInviteRejected { + get => field && DoDisambiguate && DisambiguateInviteActions; + set; + } = true; + + private bool DisambiguateInviteRetracted { + get => field && DoDisambiguate && DisambiguateInviteActions; + set; + } = true; + + private bool DisambiguateKnockAccepted { + get => field && DoDisambiguate && DisambiguateKnockActions; + set; + } = true; + + private bool DisambiguateKnockRejected { + get => field && DoDisambiguate && DisambiguateKnockActions; + set; + } = true; + + private bool DisambiguateKnockRetracted { + get => field && DoDisambiguate && DisambiguateKnockActions; + set; + } = true; + + private bool DisambiguateKnockActions { + get => field && DoDisambiguate; + set; + } = true; + + private bool DisambiguateInviteActions { + get => field && DoDisambiguate; + set; + } = true; private bool ShowProfileUpdates { get => field && DisambiguateProfileUpdates; @@ -399,7 +442,7 @@ #endregion private ObservableCollection Log { get; set; } = new(); - private List Memberships { get; set; } = []; + private List Memberships { get; set; } = []; private AuthenticatedHomeserverGeneric Homeserver { get; set; } [Parameter, SupplyParameterFromQuery(Name = "room")] @@ -444,10 +487,10 @@ private readonly struct MembershipEntry { public required MembershipTransition State { get; init; } - public required StateEventResponse Event { get; init; } - public required StateEventResponse? Previous { get; init; } + public required MatrixEventResponse Event { get; init; } + public required MatrixEventResponse? Previous { get; init; } - public void Deconstruct(out MembershipTransition transition, out StateEventResponse evt, out StateEventResponse? prev) { + public void Deconstruct(out MembershipTransition transition, out MatrixEventResponse evt, out MatrixEventResponse? prev) { transition = State; evt = Event; prev = Previous; @@ -474,7 +517,7 @@ KnockRetracted } - private static IEnumerable GetTransitions(List evts) { + private static IEnumerable GetTransitions(List evts) { Dictionary transitions = new(); foreach (var evt in evts.OrderBy(x => x.OriginServerTs)) { var content = evt.TypedContent as RoomMemberEventContent ?? throw new InvalidOperationException("Event is not a RoomMemberEventContent!"); @@ -528,7 +571,7 @@ { MembershipTransition.KnockRejected, MembershipTransition.Leave }, { MembershipTransition.KnockRetracted, MembershipTransition.Leave } }.ToFrozenDictionary(); - + foreach (var entry in entries) { if (!DoDisambiguate) { yield return entry; diff --git a/MatrixUtils.Web/Pages/Tools/Moderation/RoomIntersections.razor b/MatrixUtils.Web/Pages/Tools/Moderation/RoomIntersections.razor index ee77532..a8ae603 100644 --- a/MatrixUtils.Web/Pages/Tools/Moderation/RoomIntersections.razor +++ b/MatrixUtils.Web/Pages/Tools/Moderation/RoomIntersections.razor @@ -55,7 +55,7 @@
@sets.Item2[0].Room.RoomId @((sets.Item2[i].Member.TypedContent as RoomMemberEventContent).Membership) @(roomNames.ContainsKey(sets.Item2[i].Room) ? roomNames[sets.Item2[i].Room] : "")@(roomAliasses.ContainsKey(sets.Item2[i].Room) ? roomAliasses[sets.Item2[i].Room] : "")@(roomAliasses.ContainsKey(sets.Item2[i].Room) ? roomAliasses[sets.Item2[i].Room] : "") @@ -88,7 +88,7 @@ [Parameter, SupplyParameterFromQuery(Name = "b")] public string ImportSetBSpaceId { get; set; } = ""; - Dictionary> roomMembers { get; set; } = new(); + Dictionary> roomMembers { get; set; } = new(); Dictionary, List)> matches { get; set; } = new(); @@ -127,7 +127,7 @@ var setBusers = new Dictionary>(); await Task.WhenAll(GetMembers(RoomsA, setAusers), GetMembers(RoomsB, setBusers)); - + Log.Add($"Got {setAusers.Count} users in set A"); Log.Add($"Got {setBusers.Count} users in set B"); Log.Add("Calculating intersections..."); @@ -191,7 +191,7 @@ public class Match { public GenericRoom Room { get; set; } - public StateEventResponse Member { get; set; } + public MatrixEventResponse Member { get; set; } } } \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Tools/Moderation/UserTrace.razor b/MatrixUtils.Web/Pages/Tools/Moderation/UserTrace.razor index 2261cb8..d160922 100644 --- a/MatrixUtils.Web/Pages/Tools/Moderation/UserTrace.razor +++ b/MatrixUtils.Web/Pages/Tools/Moderation/UserTrace.razor @@ -139,7 +139,7 @@ private class Match { public GenericRoom Room; - public StateEventResponse Event; + public MatrixEventResponse Event; public string RoomName { get; set; } } @@ -169,7 +169,7 @@ } } - public string SummarizeMembership(StateEventResponse state) { + public string SummarizeMembership(MatrixEventResponse state) { var membership = state.ContentAs(); var time = DateTimeOffset.FromUnixTimeMilliseconds(state.OriginServerTs!.Value); return membership switch { diff --git a/MatrixUtils.Web/Program.cs b/MatrixUtils.Web/Program.cs index e48782f..58b66c1 100644 --- a/MatrixUtils.Web/Program.cs +++ b/MatrixUtils.Web/Program.cs @@ -29,7 +29,7 @@ builder.Services.AddWebWorkerService(webWorkerService => { webWorkerService.TaskPool.MaxPoolSize = -1; // Below is telling the WebWorkerService TaskPool to set the initial size to 2 if running in a Window scope and 0 otherwise // This starts up 2 WebWorkers to handle TaskPool tasks as needed - webWorkerService.TaskPool.PoolSize = webWorkerService.GlobalScope == GlobalScope.Window ? 0 : 0; + // webWorkerService.TaskPool.PoolSize = webWorkerService.GlobalScope == GlobalScope.Window ? 0 : 0; }); try { diff --git a/MatrixUtils.Web/Shared/PolicyEditorComponents/MassPolicyEditorModal.razor b/MatrixUtils.Web/Shared/PolicyEditorComponents/MassPolicyEditorModal.razor index bb4b672..b49358d 100644 --- a/MatrixUtils.Web/Shared/PolicyEditorComponents/MassPolicyEditorModal.razor +++ b/MatrixUtils.Web/Shared/PolicyEditorComponents/MassPolicyEditorModal.razor @@ -96,7 +96,7 @@ private bool VerifyIntent { get; set; } - private static FrozenSet KnownPolicyTypes = StateEvent.KnownStateEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))).ToFrozenSet(); + private static FrozenSet KnownPolicyTypes = MatrixEvent.KnownEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))).ToFrozenSet(); private static Dictionary PolicyTypes = KnownPolicyTypes .ToDictionary(x => x.GetCustomAttributes().First(y => !string.IsNullOrWhiteSpace(y.EventName)).EventName, x => x); @@ -177,20 +177,20 @@ // var tasks = entities.Select(x => ExecuteBan(Room, x)).ToList(); // await Task.WhenAll(tasks); - + var events = entities.Select(entity => { var content = Activator.CreateInstance(PolicyTypes[MappedType!]) as PolicyRuleEventContent ?? throw new InvalidOperationException("Failed to create event content"); content.Recommendation = Recommendation; content.Reason = Reason; content.Entity = entity; - return new StateEvent() { + return new MatrixEvent() { Type = MappedType, TypedContent = content, StateKey = content.GetDraupnir2StateKey() }; }); - - foreach(var chunk in events.Chunk(50)) + + foreach (var chunk in events.Chunk(50)) await Room.BulkSendEventsAsync(chunk); OnSaved.Invoke(); diff --git a/MatrixUtils.Web/Shared/PolicyEditorComponents/PolicyEditorModal.razor b/MatrixUtils.Web/Shared/PolicyEditorComponents/PolicyEditorModal.razor index 0205e16..501ca99 100644 --- a/MatrixUtils.Web/Shared/PolicyEditorComponents/PolicyEditorModal.razor +++ b/MatrixUtils.Web/Shared/PolicyEditorComponents/PolicyEditorModal.razor @@ -113,7 +113,7 @@ @code { [Parameter] - public StateEventResponse? PolicyEvent { + public MatrixEventResponse? PolicyEvent { get => _policyEvent; set { if (value is not null && value != _policyEvent) @@ -139,10 +139,10 @@ } [Parameter] - public Action? OnSave { get; set; } + public Action? OnSave { get; set; } [Parameter] - public Func? OnSaveAsync { get; set; } + public Func? OnSaveAsync { get; set; } private async Task InvokeOnSave() { if (OnSave is not null) @@ -154,12 +154,12 @@ public PolicyRuleEventContent? PolicyData { get; set; } - private static FrozenSet KnownPolicyTypes = StateEvent.KnownStateEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))).ToFrozenSet(); + private static FrozenSet KnownPolicyTypes = MatrixEvent.KnownEventTypes.Where(x => x.IsAssignableTo(typeof(PolicyRuleEventContent))).ToFrozenSet(); private static Dictionary PolicyTypes = KnownPolicyTypes .ToDictionary(x => x.GetCustomAttributes().First(y => !string.IsNullOrWhiteSpace(y.EventName)).EventName, x => x); - private StateEventResponse? _policyEvent; + private MatrixEventResponse? _policyEvent; private string? MappedType { get => _policyEvent?.Type; diff --git a/MatrixUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor b/MatrixUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor index f107eb3..80c69f2 100644 --- a/MatrixUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor +++ b/MatrixUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor @@ -6,19 +6,19 @@ @code { [Parameter] - public StateEventResponse Event { get; set; } + public MatrixEventResponse Event { get; set; } [Parameter] - public List Events { get; set; } + public List Events { get; set; } [Parameter] public AuthenticatedHomeserverGeneric Homeserver { get; set; } - public IEnumerable EventsBefore => Events.TakeWhile(e => e.EventId != Event.EventId); + public IEnumerable EventsBefore => Events.TakeWhile(e => e.EventId != Event.EventId); - public IEnumerable MatchingEventsBefore => EventsBefore.Where(x => x.Type == Event.Type && x.StateKey == Event.StateKey); + public IEnumerable MatchingEventsBefore => EventsBefore.Where(x => x.Type == Event.Type && x.StateKey == Event.StateKey); - public StateEventResponse? PreviousState => MatchingEventsBefore.LastOrDefault(); + public MatrixEventResponse? PreviousState => MatchingEventsBefore.LastOrDefault(); public RoomMemberEventContent? CurrentSenderMemberEventContent => EventsBefore.LastOrDefault(x => x.Type == "m.room.member" && x.StateKey == Event.Sender)? .TypedContent as RoomMemberEventContent; @@ -27,6 +27,4 @@ public bool HasPreviousMessage => EventsBefore.Last() is { Type: "m.room.message" } response && response.Sender == Event.Sender; - - } \ No newline at end of file diff --git a/MatrixUtils.Web/wwwroot/index.html b/MatrixUtils.Web/wwwroot/index.html index 0a80cff..3334426 100644 --- a/MatrixUtils.Web/wwwroot/index.html +++ b/MatrixUtils.Web/wwwroot/index.html @@ -3,31 +3,32 @@ - + MatrixUtils.Web - - + + + + + - - - +
- - + +
An unhandled error has occurred. - Reload - 🗙 + Reload + 🗙
- + diff --git a/MatrixUtils.Web/wwwroot/service-worker.published.js b/MatrixUtils.Web/wwwroot/service-worker.published.js index 9219755..aafb48c 100644 --- a/MatrixUtils.Web/wwwroot/service-worker.published.js +++ b/MatrixUtils.Web/wwwroot/service-worker.published.js @@ -9,7 +9,7 @@ self.addEventListener('fetch', event => event.respondWith(onFetch(event))); const cacheNamePrefix = 'offline-cache-'; const cacheName = `${cacheNamePrefix}${self.assetsManifest.version}`; const offlineAssetsInclude = [// Standard resources - /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/, /* Extra known-static paths */ + /\.dll$/, /\.pdb$/, /\.wasm/, /\.html/, /\.js$/, /\.json$/, /\.css$/, /\.woff$/, /\.png$/, /\.jpe?g$/, /\.gif$/, /\.ico$/, /\.blat$/, /\.dat$/, /\.webmanifest$/, /* Extra known-static paths */ /\/_matrix\/media\/.{2}\/download\//, /api\.dicebear\.com\/6\.x\/identicon\/svg/]; const offlineAssetsExclude = [/^service-worker\.js$/]; @@ -28,7 +28,7 @@ async function onInstall(event) { const assetsRequests = self.assetsManifest.assets .filter(asset => offlineAssetsInclude.some(pattern => pattern.test(asset.url))) .filter(asset => !offlineAssetsExclude.some(pattern => pattern.test(asset.url))) - .map(asset => new Request(asset.url, {integrity: asset.hash, cache: 'no-cache'})); + .map(asset => new Request(asset.url, {cache: 'no-cache'})); /* integrity: asset.hash */ await caches.open(cacheName).then(cache => cache.addAll(assetsRequests)); } @@ -48,12 +48,26 @@ async function onFetch(event) { // For all navigation requests, try to serve index.html from cache, // unless that request is for an offline resource. // If you need some URLs to be server-rendered, edit the following check to exclude those URLs - const shouldServeIndexHtml = event.request.mode === 'navigate' && !manifestUrlList.some(url => url === event.request.url); + const shouldServeIndexHtml = event.request.mode === 'navigate' + && !manifestUrlList.some(url => url === event.request.url); const request = shouldServeIndexHtml ? 'index.html' : event.request; const shouldCache = offlineAssetsInclude.some(pattern => pattern.test(request.url)); const cache = await caches.open(cacheName); + + if (request !== 'index.html' && request.url.endsWith("_framework/dotnet.js")) { + // return `_framework/dotnet..js` from cache to avoid integrity errors + const dotnetJsUrl = manifestUrlList.find(url => /_framework\/dotnet\.[a-z0-9]+\.js$/.test(url)); + if (dotnetJsUrl) { + cachedResponse = await cache.match(dotnetJsUrl); + if (cachedResponse) { + console.log("Service worker caching: serving dotnet.js from cache: ", dotnetJsUrl); + return cachedResponse; + } + } else console.warn("Service worker caching: could not find dotnet.hash.js in manifest", {request, manifestUrlList}); + } + cachedResponse = await cache.match(request); let exception; let fetched; @@ -72,7 +86,7 @@ async function onFetch(event) { fetched, shouldCache, request, exception, cachedResponse, url: request.url, } Object.keys(consoleLog).forEach(key => consoleLog[key] == null && delete consoleLog[key]) - if(consoleLog.exception) + if (consoleLog.exception) console.log("Service worker caching: ", consoleLog) } diff --git a/MatrixUtils.Web/wwwroot/sw-registrator.js b/MatrixUtils.Web/wwwroot/sw-registrator.js index 67aa5cb..b57d26a 100644 --- a/MatrixUtils.Web/wwwroot/sw-registrator.js +++ b/MatrixUtils.Web/wwwroot/sw-registrator.js @@ -15,7 +15,7 @@ window.updateAvailable = new Promise((resolve, reject) => { // detect updates every minute setInterval(() => { registration.update(); - }, 5 * 1000); // 60000ms -> check each minute + }, 30 * 1000); // 60000ms -> check each minute registration.onupdatefound = () => { const installingServiceWorker = registration.installing; diff --git a/MatrixUtils.sln b/MatrixUtils.sln index 032c49b..35840d0 100644 --- a/MatrixUtils.sln +++ b/MatrixUtils.sln @@ -42,8 +42,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibMatrix.DebugDataValidationApi", "LibMatrix\Utilities\LibMatrix.DebugDataValidationApi\LibMatrix.DebugDataValidationApi.csproj", "{FA6A9923-419A-40E1-8A32-30DD906E5025}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibMatrix.DevTestBot", "LibMatrix\Utilities\LibMatrix.DevTestBot\LibMatrix.DevTestBot.csproj", "{43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibMatrix.E2eeTestKit", "LibMatrix\Utilities\LibMatrix.E2eeTestKit\LibMatrix.E2eeTestKit.csproj", "{CC87DFFB-EE19-4147-9212-4FAF16D79AD5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibMatrix.HomeserverEmulator", "LibMatrix\Utilities\LibMatrix.HomeserverEmulator\LibMatrix.HomeserverEmulator.csproj", "{DBCE6260-052E-46F9-ACCD-059AA51B8A48}" @@ -72,6 +70,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibMatrix.FederationTest", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MatrixUtils.RoomUpgradeCLI", "MatrixUtils.RoomUpgradeCLI\MatrixUtils.RoomUpgradeCLI.csproj", "{F0F10F51-4883-4C70-80D2-24D3AA8C0096}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tmp", "tmp\tmp.csproj", "{EC817938-3A2B-44AD-B144-0C439A69433E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -286,18 +286,6 @@ Global {FA6A9923-419A-40E1-8A32-30DD906E5025}.Release|x64.Build.0 = Release|Any CPU {FA6A9923-419A-40E1-8A32-30DD906E5025}.Release|x86.ActiveCfg = Release|Any CPU {FA6A9923-419A-40E1-8A32-30DD906E5025}.Release|x86.Build.0 = Release|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Debug|x64.ActiveCfg = Debug|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Debug|x64.Build.0 = Debug|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Debug|x86.ActiveCfg = Debug|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Debug|x86.Build.0 = Debug|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Release|Any CPU.Build.0 = Release|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Release|x64.ActiveCfg = Release|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Release|x64.Build.0 = Release|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Release|x86.ActiveCfg = Release|Any CPU - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0}.Release|x86.Build.0 = Release|Any CPU {CC87DFFB-EE19-4147-9212-4FAF16D79AD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CC87DFFB-EE19-4147-9212-4FAF16D79AD5}.Debug|Any CPU.Build.0 = Debug|Any CPU {CC87DFFB-EE19-4147-9212-4FAF16D79AD5}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -454,6 +442,18 @@ Global {F0F10F51-4883-4C70-80D2-24D3AA8C0096}.Release|x64.Build.0 = Release|Any CPU {F0F10F51-4883-4C70-80D2-24D3AA8C0096}.Release|x86.ActiveCfg = Release|Any CPU {F0F10F51-4883-4C70-80D2-24D3AA8C0096}.Release|x86.Build.0 = Release|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Debug|x64.ActiveCfg = Debug|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Debug|x64.Build.0 = Debug|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Debug|x86.ActiveCfg = Debug|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Debug|x86.Build.0 = Debug|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Release|Any CPU.Build.0 = Release|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Release|x64.ActiveCfg = Release|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Release|x64.Build.0 = Release|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Release|x86.ActiveCfg = Release|Any CPU + {EC817938-3A2B-44AD-B144-0C439A69433E}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -474,7 +474,6 @@ Global {D293AFEC-8322-4FEC-8425-143B5FE10D0F} = {B37F87A8-B5E2-4724-800C-F5D9A91F35C7} {80828C75-9C5B-442F-86A4-8CE9D85E811C} = {933DC8A6-8B1F-46BF-9046-4B636AA46469} {FA6A9923-419A-40E1-8A32-30DD906E5025} = {80828C75-9C5B-442F-86A4-8CE9D85E811C} - {43ECF2DB-CBA6-4A31-BD6A-B059CEA03CA0} = {80828C75-9C5B-442F-86A4-8CE9D85E811C} {CC87DFFB-EE19-4147-9212-4FAF16D79AD5} = {80828C75-9C5B-442F-86A4-8CE9D85E811C} {DBCE6260-052E-46F9-ACCD-059AA51B8A48} = {80828C75-9C5B-442F-86A4-8CE9D85E811C} {7AA3CDF9-D1F6-4A12-BA47-EB721F353701} = {80828C75-9C5B-442F-86A4-8CE9D85E811C} diff --git a/global.json b/global.json deleted file mode 100644 index 6d77f62..0000000 --- a/global.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sdk": { - "version": "9.0.0", - "rollForward": "latestMajor", - "allowPrerelease": true - } -} diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 7c5086f..44b8a75 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -12,4 +12,5 @@ rm -rf **/bin/Release cd MatrixUtils.Web dotnet publish -c Release dotnet restore # restore debug deps -rsync --delete -raP bin/Release/net9.0/publish/wwwroot/ rory.gay:/data/nginx/html_mru/ +cp bin/Release/net10.0/publish/wwwroot/_framework/dotnet.??????????.js bin/Release/net10.0/publish/wwwroot/_framework/dotnet.js +rsync --delete -raP bin/Release/net10.0/publish/wwwroot/ rory.gay:/data/nginx/html_mru/ -- cgit 1.5.1