mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Stabilise MSC4156: server_name
-> via
(#17650)
This commit is contained in:
parent
6b770d8bfc
commit
de3363ef58
1
changelog.d/17650.removal
Normal file
1
changelog.d/17650.removal
Normal file
@ -0,0 +1 @@
|
|||||||
|
Stabilise [MSC4156](https://github.com/matrix-org/matrix-spec-proposals/pull/4156) by removing the `msc4156_enabled` config setting and defaulting it to `true`.
|
@ -447,6 +447,3 @@ class ExperimentalConfig(Config):
|
|||||||
|
|
||||||
# MSC4151: Report room API (Client-Server API)
|
# MSC4151: Report room API (Client-Server API)
|
||||||
self.msc4151_enabled: bool = experimental.get("msc4151_enabled", False)
|
self.msc4151_enabled: bool = experimental.get("msc4151_enabled", False)
|
||||||
|
|
||||||
# MSC4156: Migrate server_name to via
|
|
||||||
self.msc4156_enabled: bool = experimental.get("msc4156_enabled", False)
|
|
||||||
|
@ -53,7 +53,6 @@ class KnockRoomAliasServlet(RestServlet):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.room_member_handler = hs.get_room_member_handler()
|
self.room_member_handler = hs.get_room_member_handler()
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self._support_via = hs.config.experimental.msc4156_enabled
|
|
||||||
|
|
||||||
async def on_POST(
|
async def on_POST(
|
||||||
self,
|
self,
|
||||||
@ -72,16 +71,12 @@ class KnockRoomAliasServlet(RestServlet):
|
|||||||
|
|
||||||
# twisted.web.server.Request.args is incorrectly defined as Optional[Any]
|
# twisted.web.server.Request.args is incorrectly defined as Optional[Any]
|
||||||
args: Dict[bytes, List[bytes]] = request.args # type: ignore
|
args: Dict[bytes, List[bytes]] = request.args # type: ignore
|
||||||
|
# Prefer via over server_name (deprecated with MSC4156)
|
||||||
|
remote_room_hosts = parse_strings_from_args(args, "via", required=False)
|
||||||
|
if remote_room_hosts is None:
|
||||||
remote_room_hosts = parse_strings_from_args(
|
remote_room_hosts = parse_strings_from_args(
|
||||||
args, "server_name", required=False
|
args, "server_name", required=False
|
||||||
)
|
)
|
||||||
if self._support_via:
|
|
||||||
remote_room_hosts = parse_strings_from_args(
|
|
||||||
args,
|
|
||||||
"org.matrix.msc4156.via",
|
|
||||||
default=remote_room_hosts,
|
|
||||||
required=False,
|
|
||||||
)
|
|
||||||
elif RoomAlias.is_valid(room_identifier):
|
elif RoomAlias.is_valid(room_identifier):
|
||||||
handler = self.room_member_handler
|
handler = self.room_member_handler
|
||||||
room_alias = RoomAlias.from_string(room_identifier)
|
room_alias = RoomAlias.from_string(room_identifier)
|
||||||
|
@ -419,7 +419,6 @@ class JoinRoomAliasServlet(ResolveRoomIdMixin, TransactionRestServlet):
|
|||||||
super().__init__(hs)
|
super().__init__(hs)
|
||||||
super(ResolveRoomIdMixin, self).__init__(hs) # ensure the Mixin is set up
|
super(ResolveRoomIdMixin, self).__init__(hs) # ensure the Mixin is set up
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self._support_via = hs.config.experimental.msc4156_enabled
|
|
||||||
|
|
||||||
def register(self, http_server: HttpServer) -> None:
|
def register(self, http_server: HttpServer) -> None:
|
||||||
# /join/$room_identifier[/$txn_id]
|
# /join/$room_identifier[/$txn_id]
|
||||||
@ -437,13 +436,11 @@ class JoinRoomAliasServlet(ResolveRoomIdMixin, TransactionRestServlet):
|
|||||||
|
|
||||||
# twisted.web.server.Request.args is incorrectly defined as Optional[Any]
|
# twisted.web.server.Request.args is incorrectly defined as Optional[Any]
|
||||||
args: Dict[bytes, List[bytes]] = request.args # type: ignore
|
args: Dict[bytes, List[bytes]] = request.args # type: ignore
|
||||||
remote_room_hosts = parse_strings_from_args(args, "server_name", required=False)
|
# Prefer via over server_name (deprecated with MSC4156)
|
||||||
if self._support_via:
|
remote_room_hosts = parse_strings_from_args(args, "via", required=False)
|
||||||
|
if remote_room_hosts is None:
|
||||||
remote_room_hosts = parse_strings_from_args(
|
remote_room_hosts = parse_strings_from_args(
|
||||||
args,
|
args, "server_name", required=False
|
||||||
"org.matrix.msc4156.via",
|
|
||||||
default=remote_room_hosts,
|
|
||||||
required=False,
|
|
||||||
)
|
)
|
||||||
room_id, remote_room_hosts = await self.resolve_room_id(
|
room_id, remote_room_hosts = await self.resolve_room_id(
|
||||||
room_identifier,
|
room_identifier,
|
||||||
|
Loading…
Reference in New Issue
Block a user