experimental.py 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Copyright 2021 The Matrix.org Foundation C.I.C.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from typing import Any
  15. from synapse.config._base import Config
  16. from synapse.types import JsonDict
  17. class ExperimentalConfig(Config):
  18. """Config section for enabling experimental features"""
  19. section = "experimental"
  20. def read_config(self, config: JsonDict, **kwargs: Any) -> None:
  21. experimental = config.get("experimental_features") or {}
  22. # MSC3026 (busy presence state)
  23. self.msc3026_enabled: bool = experimental.get("msc3026_enabled", False)
  24. # MSC2716 (importing historical messages)
  25. self.msc2716_enabled: bool = experimental.get("msc2716_enabled", False)
  26. # MSC3244 (room version capabilities)
  27. self.msc3244_enabled: bool = experimental.get("msc3244_enabled", True)
  28. # MSC3266 (room summary api)
  29. self.msc3266_enabled: bool = experimental.get("msc3266_enabled", False)
  30. # MSC3030 (Jump to date API endpoint)
  31. self.msc3030_enabled: bool = experimental.get("msc3030_enabled", False)
  32. # MSC2409 (this setting only relates to optionally sending to-device messages).
  33. # Presence, typing and read receipt EDUs are already sent to application services that
  34. # have opted in to receive them. If enabled, this adds to-device messages to that list.
  35. self.msc2409_to_device_messages_enabled: bool = experimental.get(
  36. "msc2409_to_device_messages_enabled", False
  37. )
  38. # The portion of MSC3202 which is related to device masquerading.
  39. self.msc3202_device_masquerading_enabled: bool = experimental.get(
  40. "msc3202_device_masquerading", False
  41. )
  42. # The portion of MSC3202 related to transaction extensions:
  43. # sending device list changes, one-time key counts and fallback key
  44. # usage to application services.
  45. self.msc3202_transaction_extensions: bool = experimental.get(
  46. "msc3202_transaction_extensions", False
  47. )
  48. # MSC3706 (server-side support for partial state in /send_join responses)
  49. self.msc3706_enabled: bool = experimental.get("msc3706_enabled", False)
  50. # experimental support for faster joins over federation (msc2775, msc3706)
  51. # requires a target server with msc3706_enabled enabled.
  52. self.faster_joins_enabled: bool = experimental.get("faster_joins", False)
  53. # MSC3720 (Account status endpoint)
  54. self.msc3720_enabled: bool = experimental.get("msc3720_enabled", False)
  55. # MSC2654: Unread counts
  56. self.msc2654_enabled: bool = experimental.get("msc2654_enabled", False)
  57. # MSC2815 (allow room moderators to view redacted event content)
  58. self.msc2815_enabled: bool = experimental.get("msc2815_enabled", False)
  59. # MSC3786 (Add a default push rule to ignore m.room.server_acl events)
  60. self.msc3786_enabled: bool = experimental.get("msc3786_enabled", False)
  61. # MSC3772: A push rule for mutual relations.
  62. self.msc3772_enabled: bool = experimental.get("msc3772_enabled", False)
  63. # MSC3715: dir param on /relations.
  64. self.msc3715_enabled: bool = experimental.get("msc3715_enabled", False)
  65. # MSC3848: Introduce errcodes for specific event sending failures
  66. self.msc3848_enabled: bool = experimental.get("msc3848_enabled", False)
  67. # MSC3852: Expose last seen user agent field on /_matrix/client/v3/devices.
  68. self.msc3852_enabled: bool = experimental.get("msc3852_enabled", False)