diff options
author | Mark Haines <mark.haines@matrix.org> | 2016-08-25 18:34:46 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2016-08-25 18:34:46 +0100 |
commit | ab34fdecb777b057a0ec307328f309bb2bdee05c (patch) | |
tree | 541dc61435b893897e7a46d8f0a69443e18233d7 /synapse/rest | |
parent | Add some TODOs (diff) | |
parent | Merge pull request #1041 from matrix-org/paul/third-party-lookup (diff) | |
download | synapse-ab34fdecb777b057a0ec307328f309bb2bdee05c.tar.xz |
Merge branch 'develop' into markjh/direct_to_device
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/client/v2_alpha/register.py | 3 | ||||
-rw-r--r-- | synapse/rest/client/v2_alpha/thirdparty.py | 22 |
2 files changed, 21 insertions, 4 deletions
diff --git a/synapse/rest/client/v2_alpha/register.py b/synapse/rest/client/v2_alpha/register.py index 943f5676a3..2121bd75ea 100644 --- a/synapse/rest/client/v2_alpha/register.py +++ b/synapse/rest/client/v2_alpha/register.py @@ -403,10 +403,9 @@ class RegisterRestServlet(RestServlet): # register the user's device device_id = params.get("device_id") initial_display_name = params.get("initial_device_display_name") - device_id = self.device_handler.check_device_registered( + return self.device_handler.check_device_registered( user_id, device_id, initial_display_name ) - return device_id @defer.inlineCallbacks def _do_guest_registration(self): diff --git a/synapse/rest/client/v2_alpha/thirdparty.py b/synapse/rest/client/v2_alpha/thirdparty.py index 9abca3a8ad..bbc3e9b962 100644 --- a/synapse/rest/client/v2_alpha/thirdparty.py +++ b/synapse/rest/client/v2_alpha/thirdparty.py @@ -25,8 +25,25 @@ from ._base import client_v2_patterns logger = logging.getLogger(__name__) +class ThirdPartyProtocolsServlet(RestServlet): + PATTERNS = client_v2_patterns("/thirdparty/protocols", releases=()) + + def __init__(self, hs): + super(ThirdPartyProtocolsServlet, self).__init__() + + self.auth = hs.get_auth() + self.appservice_handler = hs.get_application_service_handler() + + @defer.inlineCallbacks + def on_GET(self, request): + yield self.auth.get_user_by_req(request) + + protocols = yield self.appservice_handler.get_3pe_protocols() + defer.returnValue((200, protocols)) + + class ThirdPartyUserServlet(RestServlet): - PATTERNS = client_v2_patterns("/3pu(/(?P<protocol>[^/]+))?$", + PATTERNS = client_v2_patterns("/thirdparty/user(/(?P<protocol>[^/]+))?$", releases=()) def __init__(self, hs): @@ -50,7 +67,7 @@ class ThirdPartyUserServlet(RestServlet): class ThirdPartyLocationServlet(RestServlet): - PATTERNS = client_v2_patterns("/3pl(/(?P<protocol>[^/]+))?$", + PATTERNS = client_v2_patterns("/thirdparty/location(/(?P<protocol>[^/]+))?$", releases=()) def __init__(self, hs): @@ -74,5 +91,6 @@ class ThirdPartyLocationServlet(RestServlet): def register_servlets(hs, http_server): + ThirdPartyProtocolsServlet(hs).register(http_server) ThirdPartyUserServlet(hs).register(http_server) ThirdPartyLocationServlet(hs).register(http_server) |