diff options
Diffstat (limited to 'synapse/federation/transport/server/federation.py')
-rw-r--r-- | synapse/federation/transport/server/federation.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/synapse/federation/transport/server/federation.py b/synapse/federation/transport/server/federation.py index d16375aecb..ee201c5c30 100644 --- a/synapse/federation/transport/server/federation.py +++ b/synapse/federation/transport/server/federation.py @@ -436,6 +436,23 @@ class FederationV2SendLeaveServlet(BaseFederationServerServlet): return 200, result +class FederationUnstableSendLeaveServlet(BaseFederationServerServlet): + PREFIX = FEDERATION_UNSTABLE_PREFIX + "/org.matrix.i-d.ralston-mimi-linearized-matrix.02" + PATH = "/send_leave/(?P<txn_id>[^/]*)" + CATEGORY = "Federation requests" + + async def on_POST( + self, + origin: str, + content: JsonDict, + query: Dict[bytes, List[bytes]], + txn_id: str, + ) -> Tuple[int, JsonDict]: + # TODO Use the txn_id for idempotency. + result = await self.handler.on_send_leave_request(origin, content) + return 200, result + + class FederationMakeKnockServlet(BaseFederationServerServlet): PATH = "/make_knock/(?P<room_id>[^/]*)/(?P<user_id>[^/]*)" CATEGORY = "Federation requests" @@ -475,6 +492,23 @@ class FederationV1SendKnockServlet(BaseFederationServerServlet): return 200, result +class FederationUnstableSendKnockServlet(BaseFederationServerServlet): + PREFIX = FEDERATION_UNSTABLE_PREFIX + "/org.matrix.i-d.ralston-mimi-linearized-matrix.02" + PATH = "/send_knock/(?P<txn_id>[^/]*)" + CATEGORY = "Federation requests" + + async def on_POST( + self, + origin: str, + content: JsonDict, + query: Dict[bytes, List[bytes]], + txn_id: str, + ) -> Tuple[int, JsonDict]: + # TODO Use the txn_id for idempotency. + result = await self.handler.on_send_knock_request(origin, content) + return 200, {"stripped_state": result["knock_room_state"]} + + class FederationEventAuthServlet(BaseFederationServerServlet): PATH = "/event_auth/(?P<room_id>[^/]*)/(?P<event_id>[^/]*)" CATEGORY = "Federation requests" @@ -533,6 +567,28 @@ class FederationV2SendJoinServlet(BaseFederationServerServlet): return 200, result +class FederationUnstableSendJoinServlet(BaseFederationServerServlet): + PREFIX = FEDERATION_UNSTABLE_PREFIX + "/org.matrix.i-d.ralston-mimi-linearized-matrix.02" + PATH = "/send_join/(?P<txn_id>[^/]*)" + CATEGORY = "Federation requests" + + async def on_POST( + self, + origin: str, + content: JsonDict, + query: Dict[bytes, List[bytes]], + txn_id: str, + ) -> Tuple[int, JsonDict]: + # TODO Use the txn_id for idempotency. + + result = await self.handler.on_send_join_request(origin, content) + return 200, { + "event": result["event"], + "state": result["state"], + "auth_chain": result["auth_chain}"], + } + + class FederationV1InviteServlet(BaseFederationServerServlet): PATH = "/invite/(?P<room_id>[^/]*)/(?P<event_id>[^/]*)" CATEGORY = "Federation requests" @@ -896,4 +952,7 @@ FEDERATION_SERVLET_CLASSES: Tuple[Type[BaseFederationServlet], ...] = ( # TODO(LM) Linearized Matrix additions. FederationUnstableEventServlet, FederationUnstableBackfillServlet, + FederationUnstableSendJoinServlet, + FederationUnstableSendLeaveServlet, + FederationUnstableSendKnockServlet, ) |