Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add flag in /versions for whether clients should send id_server params #5868

Merged
merged 5 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5868.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `m.require_identity_server` key to `/versions`'s `unstable_features` section.
2 changes: 1 addition & 1 deletion synapse/app/client_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _listen_http(self, listener_config):
KeyChangesServlet(self).register(resource)
VoipRestServlet(self).register(resource)
PushRuleRestServlet(self).register(resource)
VersionsRestServlet().register(resource)
VersionsRestServlet(self).register(resource)

resources.update({"/_matrix/client": resource})

Expand Down
2 changes: 1 addition & 1 deletion synapse/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, hs):

@staticmethod
def register_servlets(client_resource, hs):
versions.register_servlets(client_resource)
versions.register_servlets(hs, client_resource)

# Deprecated in r0
initial_sync.register_servlets(hs, client_resource)
Expand Down
24 changes: 21 additions & 3 deletions synapse/rest/client/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
class VersionsRestServlet(RestServlet):
PATTERNS = [re.compile("^/_matrix/client/versions$")]

def __init__(self, hs):
super(VersionsRestServlet, self).__init__()
self.config = hs.config

def on_GET(self, request):
return (
200,
Expand All @@ -44,10 +48,24 @@ def on_GET(self, request):
"r0.5.0",
],
# as per MSC1497:
"unstable_features": {"m.lazy_load_members": True},
"unstable_features": {
"m.lazy_load_members": True,
# Advertise to clients whether they need not include an `id_server`
# parameter during registration or password reset, as Synapse now decides
# itself which identity server to use (or none at all).
#
# This is also used by a client when they wish to bind a 3PID to their
# account, but not bind it to an identity server, the endpoint for which
# also requires `id_server`. If the homeserver is handling 3PID
# verification itself, there is no need to ask the user for `id_server` to
# be supplied.
"m.require_identity_server": (
richvdh marked this conversation as resolved.
Show resolved Hide resolved
self.config.account_threepid_delegate is None
),
},
},
)


def register_servlets(http_server):
VersionsRestServlet().register(http_server)
def register_servlets(hs, http_server):
VersionsRestServlet(hs).register(http_server)