app/matrix: use paths extracted directly from synapse docs for easier upgrades

Change-Id: Ife95ca0b6572074e225a0ba24a3e11d23b2d78a9
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1505
Reviewed-by: q3k <q3k@hackerspace.pl>
changes/05/1505/2
informatic 2023-03-28 23:44:14 +02:00 committed by q3k
parent b51cdcee68
commit 6bd5d20073
1 changed files with 90 additions and 63 deletions

View File

@ -274,70 +274,97 @@ local kube = import "../../../kube/kube.libsonnet";
# Following paths can be handled by generic workers.
# See: https://github.com/matrix-org/synapse/blob/master/docs/workers.md
paths:: [
"/_matrix/client/(r0|v3)/sync",
"/_matrix/client/(api/v1|r0|v3)/events",
"/_matrix/client/(api/v1|r0|v3)/initialSync",
"/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync",
"/_matrix/federation/v1/event/",
"/_matrix/federation/v1/state/",
"/_matrix/federation/v1/state_ids/",
"/_matrix/federation/v1/backfill/",
"/_matrix/federation/v1/get_missing_events/",
"/_matrix/federation/v1/publicRooms",
"/_matrix/federation/v1/query/",
"/_matrix/federation/v1/make_join/",
"/_matrix/federation/v1/make_leave/",
"/_matrix/federation/(v1|v2)/send_join/",
"/_matrix/federation/(v1|v2)/send_leave/",
"/_matrix/federation/(v1|v2)/invite/",
"/_matrix/federation/v1/event_auth/",
"/_matrix/federation/v1/exchange_third_party_invite/",
"/_matrix/federation/v1/user/devices/",
"/_matrix/federation/v1/get_groups_publicised",
"/_matrix/key/v2/query",
"/_matrix/federation/(v1|unstable/org.matrix.msc2946)/hierarchy/",
"/_matrix/federation/v1/send/",
"/_matrix/client/(api/v1|r0|v3|unstable)/createRoom",
"/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state",
"/_matrix/client/(v1|unstable/org.matrix.msc2946)/rooms/.*/hierarchy",
"/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary",
"/_matrix/client/(r0|v3|unstable)/account/3pid",
"/_matrix/client/(r0|v3|unstable)/devices",
"/_matrix/client/versions",
"/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer",
"/_matrix/client/(r0|v3|unstable)/joined_groups",
"/_matrix/client/(r0|v3|unstable)/publicised_groups",
"/_matrix/client/(r0|v3|unstable)/publicised_groups/",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/",
"/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms",
"/_matrix/client/(api/v1|r0|v3|unstable)/search",
"/_matrix/client/(r0|v3|unstable)/keys/query",
"/_matrix/client/(r0|v3|unstable)/keys/changes",
"/_matrix/client/(r0|v3|unstable)/keys/claim",
"/_matrix/client/(r0|v3|unstable)/room_keys/",
"/_matrix/client/(api/v1|r0|v3|unstable)/login",
"/_matrix/client/(r0|v3|unstable)/register",
"/_matrix/client/v1/register/m.login.registration_token/validity",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/",
"/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)",
"/_matrix/client/(api/v1|r0|v3|unstable)/join/",
"/_matrix/client/(api/v1|r0|v3|unstable)/profile/"
pathsList:: |||
# Sync requests
^/_matrix/client/(r0|v3)/sync$
^/_matrix/client/(api/v1|r0|v3)/events$
^/_matrix/client/(api/v1|r0|v3)/initialSync$
^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$
# These need to be handled by stream writers, not supported yet
# "/_matrix/client/(r0|v3|unstable)/sendToDevice/",
# "/_matrix/client/(r0|v3|unstable)/.*/tags",
# "/_matrix/client/(r0|v3|unstable)/.*/account_data",
# "/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt",
# "/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers",
# "/_matrix/client/(api/v1|r0|v3|unstable)/presence/",
],
# Federation requests
^/_matrix/federation/v1/event/
^/_matrix/federation/v1/state/
^/_matrix/federation/v1/state_ids/
^/_matrix/federation/v1/backfill/
^/_matrix/federation/v1/get_missing_events/
^/_matrix/federation/v1/publicRooms
^/_matrix/federation/v1/query/
^/_matrix/federation/v1/make_join/
^/_matrix/federation/v1/make_leave/
^/_matrix/federation/(v1|v2)/send_join/
^/_matrix/federation/(v1|v2)/send_leave/
^/_matrix/federation/(v1|v2)/invite/
^/_matrix/federation/v1/event_auth/
^/_matrix/federation/v1/exchange_third_party_invite/
^/_matrix/federation/v1/user/devices/
^/_matrix/federation/v1/get_groups_publicised$
^/_matrix/key/v2/query
^/_matrix/federation/(v1|unstable/org.matrix.msc2946)/hierarchy/
# Inbound federation transaction request
^/_matrix/federation/v1/send/
# Client API requests
^/_matrix/client/(api/v1|r0|v3|unstable)/createRoom$
^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$
^/_matrix/client/(v1|unstable/org.matrix.msc2946)/rooms/.*/hierarchy$
^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$
^/_matrix/client/(r0|v3|unstable)/account/3pid$
^/_matrix/client/(r0|v3|unstable)/devices$
^/_matrix/client/versions$
^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$
^/_matrix/client/(r0|v3|unstable)/joined_groups$
^/_matrix/client/(r0|v3|unstable)/publicised_groups$
^/_matrix/client/(r0|v3|unstable)/publicised_groups/
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
^/_matrix/client/(api/v1|r0|v3|unstable)/search$
# Encryption requests
^/_matrix/client/(r0|v3|unstable)/keys/query$
^/_matrix/client/(r0|v3|unstable)/keys/changes$
^/_matrix/client/(r0|v3|unstable)/keys/claim$
^/_matrix/client/(r0|v3|unstable)/room_keys/
# Registration/login requests
^/_matrix/client/(api/v1|r0|v3|unstable)/login$
^/_matrix/client/(r0|v3|unstable)/register$
^/_matrix/client/v1/register/m.login.registration_token/validity$
# Event sending requests
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$
^/_matrix/client/(api/v1|r0|v3|unstable)/join/
^/_matrix/client/(api/v1|r0|v3|unstable)/profile/
# Device requests
#^/_matrix/client/(r0|v3|unstable)/sendToDevice/
# Account data requests
#^/_matrix/client/(r0|v3|unstable)/.*/tags
#^/_matrix/client/(r0|v3|unstable)/.*/account_data
# Receipts requests
#^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt
#^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers
# Presence requests
#^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
|||,
paths:: std.filterMap(
# Ignore comments and empty lines
function(v) !std.startsWith(v, '#') && std.length(v) > 1,
# Strip leading ^
function(v) std.substr(v, 1, std.length(v) - 1),
std.split(self.pathsList, "\n")
),
},
# Synapse media worker. This handles access to uploads and media stored in app.dataVolume