versions.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 OpenMarket Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. import logging
  16. import re
  17. from synapse.http.servlet import RestServlet
  18. logger = logging.getLogger(__name__)
  19. class VersionsRestServlet(RestServlet):
  20. PATTERNS = [re.compile("^/_matrix/client/versions$")]
  21. def on_GET(self, request):
  22. return (
  23. 200,
  24. {
  25. "versions": [
  26. # XXX: at some point we need to decide whether we need to include
  27. # the previous version numbers, given we've defined r0.3.0 to be
  28. # backwards compatible with r0.2.0. But need to check how
  29. # conscientious we've been in compatibility, and decide whether the
  30. # middle number is the major revision when at 0.X.Y (as opposed to
  31. # X.Y.Z). And we need to decide whether it's fair to make clients
  32. # parse the version string to figure out what's going on.
  33. "r0.0.1",
  34. "r0.1.0",
  35. "r0.2.0",
  36. "r0.3.0",
  37. "r0.4.0",
  38. "r0.5.0",
  39. ],
  40. # as per MSC1497:
  41. "unstable_features": {"m.lazy_load_members": True},
  42. },
  43. )
  44. def register_servlets(http_server):
  45. VersionsRestServlet().register(http_server)