mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 19:44:51 -04:00
Use admin_patterns for all admin APIs. (#8331)
This reduces duplication of the admin prefix in regular expressions.
This commit is contained in:
parent
53284c425e
commit
c3c9732c53
7 changed files with 20 additions and 26 deletions
|
@ -44,7 +44,7 @@ def historical_admin_path_patterns(path_regex):
|
|||
]
|
||||
|
||||
|
||||
def admin_patterns(path_regex: str):
|
||||
def admin_patterns(path_regex: str, version: str = "v1"):
|
||||
"""Returns the list of patterns for an admin endpoint
|
||||
|
||||
Args:
|
||||
|
@ -54,7 +54,7 @@ def admin_patterns(path_regex: str):
|
|||
Returns:
|
||||
A list of regex patterns.
|
||||
"""
|
||||
admin_prefix = "^/_synapse/admin/v1"
|
||||
admin_prefix = "^/_synapse/admin/" + version
|
||||
patterns = [re.compile(admin_prefix + path_regex)]
|
||||
return patterns
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue