mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-25 09:39:31 -05:00
Add deprecation warnings for webclient
listener and non-HTTP(S) web_client_location
. (#11774)
This changes the behaviour of the root endpoint to redirect directly to the configuration of `web_client_location` if it is given an HTTP(S) URL.
This commit is contained in:
parent
f160fe18e3
commit
91221b6961
1
changelog.d/11774.misc
Normal file
1
changelog.d/11774.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Deprecate support for `webclient` listeners and non-HTTP(S) `web_client_location` configuration.
|
@ -74,13 +74,7 @@ server_name: "SERVERNAME"
|
|||||||
#
|
#
|
||||||
pid_file: DATADIR/homeserver.pid
|
pid_file: DATADIR/homeserver.pid
|
||||||
|
|
||||||
# The absolute URL to the web client which /_matrix/client will redirect
|
# The absolute URL to the web client which / will redirect to.
|
||||||
# to if 'webclient' is configured under the 'listeners' configuration.
|
|
||||||
#
|
|
||||||
# This option can be also set to the filesystem path to the web client
|
|
||||||
# which will be served at /_matrix/client/ if 'webclient' is configured
|
|
||||||
# under the 'listeners' configuration, however this is a security risk:
|
|
||||||
# https://github.com/matrix-org/synapse#security-note
|
|
||||||
#
|
#
|
||||||
#web_client_location: https://riot.example.com/
|
#web_client_location: https://riot.example.com/
|
||||||
|
|
||||||
@ -310,8 +304,6 @@ presence:
|
|||||||
# static: static resources under synapse/static (/_matrix/static). (Mostly
|
# static: static resources under synapse/static (/_matrix/static). (Mostly
|
||||||
# useful for 'fallback authentication'.)
|
# useful for 'fallback authentication'.)
|
||||||
#
|
#
|
||||||
# webclient: A web client. Requires web_client_location to be set.
|
|
||||||
#
|
|
||||||
listeners:
|
listeners:
|
||||||
# TLS-enabled listener: for when matrix traffic is sent directly to synapse.
|
# TLS-enabled listener: for when matrix traffic is sent directly to synapse.
|
||||||
#
|
#
|
||||||
|
@ -85,6 +85,17 @@ process, for example:
|
|||||||
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
|
dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Upgrading to v1.51.0
|
||||||
|
|
||||||
|
## Deprecation of `webclient` listeners and non-HTTP(S) `web_client_location`
|
||||||
|
|
||||||
|
Listeners of type `webclient` are deprecated and scheduled to be removed in
|
||||||
|
Synapse v1.53.0.
|
||||||
|
|
||||||
|
Similarly, a non-HTTP(S) `web_client_location` configuration is deprecated and
|
||||||
|
will become a configuration error in Synapse v1.53.0.
|
||||||
|
|
||||||
|
|
||||||
# Upgrading to v1.50.0
|
# Upgrading to v1.50.0
|
||||||
|
|
||||||
## Dropping support for old Python and Postgres versions
|
## Dropping support for old Python and Postgres versions
|
||||||
|
@ -132,8 +132,10 @@ class SynapseHomeServer(HomeServer):
|
|||||||
self._module_web_resources_consumed = True
|
self._module_web_resources_consumed = True
|
||||||
|
|
||||||
# try to find something useful to redirect '/' to
|
# try to find something useful to redirect '/' to
|
||||||
if WEB_CLIENT_PREFIX in resources:
|
if self.config.server.web_client_location_is_redirect:
|
||||||
root_resource: Resource = RootOptionsRedirectResource(WEB_CLIENT_PREFIX)
|
root_resource: Resource = RootOptionsRedirectResource(
|
||||||
|
self.config.server.web_client_location
|
||||||
|
)
|
||||||
elif STATIC_PREFIX in resources:
|
elif STATIC_PREFIX in resources:
|
||||||
root_resource = RootOptionsRedirectResource(STATIC_PREFIX)
|
root_resource = RootOptionsRedirectResource(STATIC_PREFIX)
|
||||||
else:
|
else:
|
||||||
@ -262,15 +264,15 @@ class SynapseHomeServer(HomeServer):
|
|||||||
resources[SERVER_KEY_V2_PREFIX] = KeyApiV2Resource(self)
|
resources[SERVER_KEY_V2_PREFIX] = KeyApiV2Resource(self)
|
||||||
|
|
||||||
if name == "webclient":
|
if name == "webclient":
|
||||||
|
# webclient listeners are deprecated as of Synapse v1.51.0, remove it
|
||||||
|
# in > v1.53.0.
|
||||||
webclient_loc = self.config.server.web_client_location
|
webclient_loc = self.config.server.web_client_location
|
||||||
|
|
||||||
if webclient_loc is None:
|
if webclient_loc is None:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Not enabling webclient resource, as web_client_location is unset."
|
"Not enabling webclient resource, as web_client_location is unset."
|
||||||
)
|
)
|
||||||
elif webclient_loc.startswith("http://") or webclient_loc.startswith(
|
elif self.config.server.web_client_location_is_redirect:
|
||||||
"https://"
|
|
||||||
):
|
|
||||||
resources[WEB_CLIENT_PREFIX] = RootRedirect(webclient_loc)
|
resources[WEB_CLIENT_PREFIX] = RootRedirect(webclient_loc)
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
|
@ -259,7 +259,6 @@ class ServerConfig(Config):
|
|||||||
raise ConfigError(str(e))
|
raise ConfigError(str(e))
|
||||||
|
|
||||||
self.pid_file = self.abspath(config.get("pid_file"))
|
self.pid_file = self.abspath(config.get("pid_file"))
|
||||||
self.web_client_location = config.get("web_client_location", None)
|
|
||||||
self.soft_file_limit = config.get("soft_file_limit", 0)
|
self.soft_file_limit = config.get("soft_file_limit", 0)
|
||||||
self.daemonize = config.get("daemonize")
|
self.daemonize = config.get("daemonize")
|
||||||
self.print_pidfile = config.get("print_pidfile")
|
self.print_pidfile = config.get("print_pidfile")
|
||||||
@ -506,8 +505,17 @@ class ServerConfig(Config):
|
|||||||
l2.append(listener)
|
l2.append(listener)
|
||||||
self.listeners = l2
|
self.listeners = l2
|
||||||
|
|
||||||
if not self.web_client_location:
|
self.web_client_location = config.get("web_client_location", None)
|
||||||
_warn_if_webclient_configured(self.listeners)
|
self.web_client_location_is_redirect = self.web_client_location and (
|
||||||
|
self.web_client_location.startswith("http://")
|
||||||
|
or self.web_client_location.startswith("https://")
|
||||||
|
)
|
||||||
|
# A non-HTTP(S) web client location is deprecated.
|
||||||
|
if self.web_client_location and not self.web_client_location_is_redirect:
|
||||||
|
logger.warning(NO_MORE_NONE_HTTP_WEB_CLIENT_LOCATION_WARNING)
|
||||||
|
|
||||||
|
# Warn if webclient is configured for a worker.
|
||||||
|
_warn_if_webclient_configured(self.listeners)
|
||||||
|
|
||||||
self.gc_thresholds = read_gc_thresholds(config.get("gc_thresholds", None))
|
self.gc_thresholds = read_gc_thresholds(config.get("gc_thresholds", None))
|
||||||
self.gc_seconds = self.read_gc_intervals(config.get("gc_min_interval", None))
|
self.gc_seconds = self.read_gc_intervals(config.get("gc_min_interval", None))
|
||||||
@ -793,13 +801,7 @@ class ServerConfig(Config):
|
|||||||
#
|
#
|
||||||
pid_file: %(pid_file)s
|
pid_file: %(pid_file)s
|
||||||
|
|
||||||
# The absolute URL to the web client which /_matrix/client will redirect
|
# The absolute URL to the web client which / will redirect to.
|
||||||
# to if 'webclient' is configured under the 'listeners' configuration.
|
|
||||||
#
|
|
||||||
# This option can be also set to the filesystem path to the web client
|
|
||||||
# which will be served at /_matrix/client/ if 'webclient' is configured
|
|
||||||
# under the 'listeners' configuration, however this is a security risk:
|
|
||||||
# https://github.com/matrix-org/synapse#security-note
|
|
||||||
#
|
#
|
||||||
#web_client_location: https://riot.example.com/
|
#web_client_location: https://riot.example.com/
|
||||||
|
|
||||||
@ -1011,8 +1013,6 @@ class ServerConfig(Config):
|
|||||||
# static: static resources under synapse/static (/_matrix/static). (Mostly
|
# static: static resources under synapse/static (/_matrix/static). (Mostly
|
||||||
# useful for 'fallback authentication'.)
|
# useful for 'fallback authentication'.)
|
||||||
#
|
#
|
||||||
# webclient: A web client. Requires web_client_location to be set.
|
|
||||||
#
|
|
||||||
listeners:
|
listeners:
|
||||||
# TLS-enabled listener: for when matrix traffic is sent directly to synapse.
|
# TLS-enabled listener: for when matrix traffic is sent directly to synapse.
|
||||||
#
|
#
|
||||||
@ -1349,9 +1349,15 @@ def parse_listener_def(listener: Any) -> ListenerConfig:
|
|||||||
return ListenerConfig(port, bind_addresses, listener_type, tls, http_config)
|
return ListenerConfig(port, bind_addresses, listener_type, tls, http_config)
|
||||||
|
|
||||||
|
|
||||||
|
NO_MORE_NONE_HTTP_WEB_CLIENT_LOCATION_WARNING = """
|
||||||
|
Synapse no longer supports serving a web client. To remove this warning,
|
||||||
|
configure 'web_client_location' with an HTTP(S) URL.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
NO_MORE_WEB_CLIENT_WARNING = """
|
NO_MORE_WEB_CLIENT_WARNING = """
|
||||||
Synapse no longer includes a web client. To enable a web client, configure
|
Synapse no longer includes a web client. To redirect the root resource to a web client, configure
|
||||||
web_client_location. To remove this warning, remove 'webclient' from the 'listeners'
|
'web_client_location'. To remove this warning, remove 'webclient' from the 'listeners'
|
||||||
configuration.
|
configuration.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user