From 75a9978316722e2d11fe9161fb421e01595987d7 Mon Sep 17 00:00:00 2001 From: Rory& Date: Wed, 23 Jul 2025 09:02:16 +0200 Subject: Make server ACLs expose matching regexes (need to be checked and tested, still) --- .../Spec/State/RoomInfo/RoomServerACLEventContent.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'LibMatrix.EventTypes') diff --git a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs index c492250..c7ad491 100644 --- a/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs +++ b/LibMatrix.EventTypes/Spec/State/RoomInfo/RoomServerACLEventContent.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using System.Text.RegularExpressions; namespace LibMatrix.EventTypes.Spec.State.RoomInfo; @@ -14,4 +15,10 @@ public class RoomServerAclEventContent : EventContent { [JsonPropertyName("allow_ip_literals")] public bool AllowIpLiterals { get; set; } // = false; + + [JsonIgnore] + public List? AllowRegexes => Allow?.ConvertAll(pattern => new Regex(pattern.Replace(".", "\\.").Replace("*", ".*").Replace("?", "."), RegexOptions.Compiled)) ?? []; + + [JsonIgnore] + public List? DenyRegexes => Deny?.ConvertAll(pattern => new Regex(pattern.Replace(".", "\\.").Replace("*", ".*").Replace("?", "."), RegexOptions.Compiled)) ?? []; } \ No newline at end of file -- cgit 1.5.1