Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 462e681

Browse files
committed
Merge tag 'v1.21.0rc2' into develop
Synapse 1.21.0rc2 (2020-10-02) ============================== Features -------- - Convert additional templates from inline HTML to Jinja2 templates. ([\#8444](#8444)) Bugfixes -------- - Fix a regression in v1.21.0rc1 which broke thumbnails of remote media. ([\#8438](#8438)) - Do not expose the experimental `uk.half-shot.msc2778.login.application_service` flow in the login API, which caused a compatibility problem with Element iOS. ([\#8440](#8440)) - Fix malformed log line in new federation "catch up" logic. ([\#8442](#8442)) - Fix DB query on startup for negative streams which caused long start up times. Introduced in [\#8374](#8374). ([\#8447](#8447))
2 parents 3bd2a2c + 9de6e9e commit 462e681

File tree

14 files changed

+163
-141
lines changed

14 files changed

+163
-141
lines changed

CHANGES.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
Synapse 1.21.0rc2 (2020-10-02)
2+
==============================
3+
4+
Features
5+
--------
6+
7+
- Convert additional templates from inline HTML to Jinja2 templates. ([\#8444](https://github.com/matrix-org/synapse/issues/8444))
8+
9+
Bugfixes
10+
--------
11+
12+
- Fix a regression in v1.21.0rc1 which broke thumbnails of remote media. ([\#8438](https://github.com/matrix-org/synapse/issues/8438))
13+
- Do not expose the experimental `uk.half-shot.msc2778.login.application_service` flow in the login API, which caused a compatibility problem with Element iOS. ([\#8440](https://github.com/matrix-org/synapse/issues/8440))
14+
- Fix malformed log line in new federation "catch up" logic. ([\#8442](https://github.com/matrix-org/synapse/issues/8442))
15+
- Fix DB query on startup for negative streams which caused long start up times. Introduced in [\#8374](https://github.com/matrix-org/synapse/issues/8374). ([\#8447](https://github.com/matrix-org/synapse/issues/8447))
16+
17+
118
Synapse 1.21.0rc1 (2020-10-01)
219
==============================
320

synapse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
except ImportError:
4949
pass
5050

51-
__version__ = "1.21.0rc1"
51+
__version__ = "1.21.0rc2"
5252

5353
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
5454
# We import here so that we don't have to install a bunch of deps when

synapse/config/_base.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,11 @@ def read_templates(
242242
env = jinja2.Environment(loader=loader, autoescape=autoescape)
243243

244244
# Update the environment with our custom filters
245-
env.filters.update(
246-
{
247-
"format_ts": _format_ts_filter,
248-
"mxc_to_http": _create_mxc_to_http_filter(self.public_baseurl),
249-
}
250-
)
245+
env.filters.update({"format_ts": _format_ts_filter})
246+
if self.public_baseurl:
247+
env.filters.update(
248+
{"mxc_to_http": _create_mxc_to_http_filter(self.public_baseurl)}
249+
)
251250

252251
for filename in filenames:
253252
# Load the template

synapse/config/captcha.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def read_config(self, config, **kwargs):
2828
"recaptcha_siteverify_api",
2929
"https://www.recaptcha.net/recaptcha/api/siteverify",
3030
)
31+
self.recaptcha_template = self.read_templates(
32+
["recaptcha.html"], autoescape=True
33+
)[0]
3134

3235
def generate_config_section(self, **kwargs):
3336
return """\

synapse/config/consent_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ def __init__(self, *args):
8989

9090
def read_config(self, config, **kwargs):
9191
consent_config = config.get("user_consent")
92+
self.terms_template = self.read_templates(["terms.html"], autoescape=True)[0]
93+
9294
if consent_config is None:
9395
return
9496
self.user_consent_version = str(consent_config["version"])

synapse/config/registration.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ def read_config(self, config, **kwargs):
187187
session_lifetime = self.parse_duration(session_lifetime)
188188
self.session_lifetime = session_lifetime
189189

190+
# The success template used during fallback auth.
191+
self.fallback_success_template = self.read_templates(
192+
["auth_success.html"], autoescape=True
193+
)[0]
194+
190195
def generate_config_section(self, generate_secrets=False, **kwargs):
191196
if generate_secrets:
192197
registration_shared_secret = 'registration_shared_secret: "%s"' % (

synapse/federation/sender/per_destination_queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ async def _catch_up_transmission_loop(self) -> None:
490490
)
491491

492492
if logger.isEnabledFor(logging.INFO):
493-
rooms = (p.room_id for p in catchup_pdus)
493+
rooms = [p.room_id for p in catchup_pdus]
494494
logger.info("Catching up rooms to %s: %r", self._destination, rooms)
495495

496496
success = await self._transaction_manager.send_new_transaction(
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<html>
2+
<head>
3+
<title>Success!</title>
4+
<meta name='viewport' content='width=device-width, initial-scale=1,
5+
user-scalable=no, minimum-scale=1.0, maximum-scale=1.0'>
6+
<link rel="stylesheet" href="/_matrix/static/client/register/style.css">
7+
<script>
8+
if (window.onAuthDone) {
9+
window.onAuthDone();
10+
} else if (window.opener && window.opener.postMessage) {
11+
window.opener.postMessage("authDone", "*");
12+
}
13+
</script>
14+
</head>
15+
<body>
16+
<div>
17+
<p>Thank you</p>
18+
<p>You may now close this window and return to the application</p>
19+
</div>
20+
</body>
21+
</html>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<html>
2+
<head>
3+
<title>Authentication</title>
4+
<meta name='viewport' content='width=device-width, initial-scale=1,
5+
user-scalable=no, minimum-scale=1.0, maximum-scale=1.0'>
6+
<script src="https://www.recaptcha.net/recaptcha/api.js"
7+
async defer></script>
8+
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
9+
<link rel="stylesheet" href="/_matrix/static/client/register/style.css">
10+
<script>
11+
function captchaDone() {
12+
$('#registrationForm').submit();
13+
}
14+
</script>
15+
</head>
16+
<body>
17+
<form id="registrationForm" method="post" action="{{ myurl }}">
18+
<div>
19+
<p>
20+
Hello! We need to prevent computer programs and other automated
21+
things from creating accounts on this server.
22+
</p>
23+
<p>
24+
Please verify that you're not a robot.
25+
</p>
26+
<input type="hidden" name="session" value="{{ session }}" />
27+
<div class="g-recaptcha"
28+
data-sitekey="{{ sitekey }}"
29+
data-callback="captchaDone">
30+
</div>
31+
<noscript>
32+
<input type="submit" value="All Done" />
33+
</noscript>
34+
</div>
35+
</div>
36+
</form>
37+
</body>
38+
</html>

synapse/res/templates/terms.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<html>
2+
<head>
3+
<title>Authentication</title>
4+
<meta name='viewport' content='width=device-width, initial-scale=1,
5+
user-scalable=no, minimum-scale=1.0, maximum-scale=1.0'>
6+
<link rel="stylesheet" href="/_matrix/static/client/register/style.css">
7+
</head>
8+
<body>
9+
<form id="registrationForm" method="post" action="{{ myurl }}">
10+
<div>
11+
<p>
12+
Please click the button below if you agree to the
13+
<a href="{{ terms_url }}">privacy policy of this homeserver.</a>
14+
</p>
15+
<input type="hidden" name="session" value="{{ session }}" />
16+
<input type="submit" value="Agree" />
17+
</div>
18+
</form>
19+
</body>
20+
</html>

0 commit comments

Comments
 (0)