mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 02:34:50 -04:00
Backout changes for automatically calculating the public baseurl. (#9313)
This breaks some people's configurations (if their Client-Server API is not accessed via port 443).
This commit is contained in:
parent
afa18f1baa
commit
e40d88cff3
16 changed files with 97 additions and 41 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
import time
|
||||
import urllib.parse
|
||||
from typing import TYPE_CHECKING, Callable, Iterable, Union
|
||||
from typing import TYPE_CHECKING, Callable, Iterable, Optional, Union
|
||||
|
||||
import jinja2
|
||||
|
||||
|
@ -74,14 +74,23 @@ def build_jinja_env(
|
|||
return env
|
||||
|
||||
|
||||
def _create_mxc_to_http_filter(public_baseurl: str) -> Callable:
|
||||
def _create_mxc_to_http_filter(
|
||||
public_baseurl: Optional[str],
|
||||
) -> Callable[[str, int, int, str], str]:
|
||||
"""Create and return a jinja2 filter that converts MXC urls to HTTP
|
||||
|
||||
Args:
|
||||
public_baseurl: The public, accessible base URL of the homeserver
|
||||
"""
|
||||
|
||||
def mxc_to_http_filter(value, width, height, resize_method="crop"):
|
||||
def mxc_to_http_filter(
|
||||
value: str, width: int, height: int, resize_method: str = "crop"
|
||||
) -> str:
|
||||
if not public_baseurl:
|
||||
raise RuntimeError(
|
||||
"public_baseurl must be set in the homeserver config to convert MXC URLs to HTTP URLs."
|
||||
)
|
||||
|
||||
if value[0:6] != "mxc://":
|
||||
return ""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue