Skip to content

Commit caac421

Browse files
committed
t stash apply
Merge branch 'master' of gitlab.com:nova/synapse into seandon/synapse-users-query * 'master' of gitlab.com:nova/synapse: (97 commits) Changelog changes 1.19.0 More changelog tweaks More changelog tweaks Remove unwanted changelog line 1.19.0rc1 Convert the roommember database to async/await. (matrix-org#8070) Convert devices database to async/await. (matrix-org#8069) Add type hints to handlers.message and events.builder (matrix-org#8067) Convert account data, device inbox, and censor events databases to async/await (matrix-org#8063) Convert appservice, group server, profile and more databases to async (matrix-org#8066) Fix typing for notifier (matrix-org#8064) Convert tags and metrics databases to async/await (matrix-org#8062) Converts event_federation and registration databases to async/await (matrix-org#8061) Add comment explaining cast Update changelog.d/8051.misc Add typing info to Notifier (matrix-org#8058) Handle optional dependencies for Oidc and Saml Newsfile Move setting of Filter into code. ...
2 parents 295a24e + 3234d5c commit caac421

File tree

493 files changed

+6022
-4782
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

493 files changed

+6022
-4782
lines changed

.github/ISSUE_TEMPLATE/BUG_REPORT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ about: Create a report to help us improve
44

55
---
66

7+
<!--
8+
79
**THIS IS NOT A SUPPORT CHANNEL!**
810
**IF YOU HAVE SUPPORT QUESTIONS ABOUT RUNNING OR CONFIGURING YOUR OWN HOME SERVER**,
911
please ask in **#synapse:matrix.org** (using a matrix.org account if necessary)
1012
11-
<!--
12-
1313
If you want to report a security issue, please see https://matrix.org/security-disclosure-policy/
1414
1515
This is a bug report template. By following the instructions below and

CHANGES.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,77 @@
1+
Synapse 1.19.0 (2020-08-17)
2+
===========================
3+
4+
No significant changes since 1.19.0rc1.
5+
6+
Removal warning
7+
---------------
8+
9+
As outlined in the [previous release](https://github.com/matrix-org/synapse/releases/tag/v1.18.0), we are no longer publishing Docker images with the `-py3` tag suffix. On top of that, we have also removed the `latest-py3` tag. Please see [the announcement in the upgrade notes for 1.18.0](https://github.com/matrix-org/synapse/blob/develop/UPGRADE.rst#upgrading-to-v1180).
10+
11+
12+
Synapse 1.19.0rc1 (2020-08-13)
13+
==============================
14+
15+
Features
16+
--------
17+
18+
- Add option to allow server admins to join rooms which fail complexity checks. Contributed by @lugino-emeritus. ([\#7902](https://github.com/matrix-org/synapse/issues/7902))
19+
- Add an option to purge room or not with delete room admin endpoint (`POST /_synapse/admin/v1/rooms/<room_id>/delete`). Contributed by @dklimpel. ([\#7964](https://github.com/matrix-org/synapse/issues/7964))
20+
- Add rate limiting to users joining rooms. ([\#8008](https://github.com/matrix-org/synapse/issues/8008))
21+
- Add a `/health` endpoint to every configured HTTP listener that can be used as a health check endpoint by load balancers. ([\#8048](https://github.com/matrix-org/synapse/issues/8048))
22+
- Allow login to be blocked based on the values of SAML attributes. ([\#8052](https://github.com/matrix-org/synapse/issues/8052))
23+
- Allow guest access to the `GET /_matrix/client/r0/rooms/{room_id}/members` endpoint, according to MSC2689. Contributed by Awesome Technologies Innovationslabor GmbH. ([\#7314](https://github.com/matrix-org/synapse/issues/7314))
24+
25+
26+
Bugfixes
27+
--------
28+
29+
- Fix a bug introduced in Synapse v1.7.2 which caused inaccurate membership counts in the room directory. ([\#7977](https://github.com/matrix-org/synapse/issues/7977))
30+
- Fix a long standing bug: 'Duplicate key value violates unique constraint "event_relations_id"' when message retention is configured. ([\#7978](https://github.com/matrix-org/synapse/issues/7978))
31+
- Fix "no create event in auth events" when trying to reject invitation after inviter leaves. Bug introduced in Synapse v1.10.0. ([\#7980](https://github.com/matrix-org/synapse/issues/7980))
32+
- Fix various comments and minor discrepencies in server notices code. ([\#7996](https://github.com/matrix-org/synapse/issues/7996))
33+
- Fix a long standing bug where HTTP HEAD requests resulted in a 400 error. ([\#7999](https://github.com/matrix-org/synapse/issues/7999))
34+
- Fix a long-standing bug which caused two copies of some log lines to be written when synctl was used along with a MemoryHandler logger. ([\#8011](https://github.com/matrix-org/synapse/issues/8011), [\#8012](https://github.com/matrix-org/synapse/issues/8012))
35+
36+
37+
Updates to the Docker image
38+
---------------------------
39+
40+
- We no longer publish Docker images with the `-py3` tag suffix, as [announced in the upgrade notes](https://github.com/matrix-org/synapse/blob/develop/UPGRADE.rst#upgrading-to-v1180). ([\#8056](https://github.com/matrix-org/synapse/issues/8056))
41+
42+
43+
Improved Documentation
44+
----------------------
45+
46+
- Document how to set up a client .well-known file and fix several pieces of outdated documentation. ([\#7899](https://github.com/matrix-org/synapse/issues/7899))
47+
- Improve workers docs. ([\#7990](https://github.com/matrix-org/synapse/issues/7990), [\#8000](https://github.com/matrix-org/synapse/issues/8000))
48+
- Fix typo in `docs/workers.md`. ([\#7992](https://github.com/matrix-org/synapse/issues/7992))
49+
- Add documentation for how to undo a room shutdown. ([\#7998](https://github.com/matrix-org/synapse/issues/7998), [\#8010](https://github.com/matrix-org/synapse/issues/8010))
50+
51+
52+
Internal Changes
53+
----------------
54+
55+
- Reduce the amount of whitespace in JSON stored and sent in responses. Contributed by David Vo. ([\#7372](https://github.com/matrix-org/synapse/issues/7372))
56+
- Switch to the JSON implementation from the standard library and bump the minimum version of the canonicaljson library to 1.2.0. ([\#7936](https://github.com/matrix-org/synapse/issues/7936), [\#7979](https://github.com/matrix-org/synapse/issues/7979))
57+
- Convert various parts of the codebase to async/await. ([\#7947](https://github.com/matrix-org/synapse/issues/7947), [\#7948](https://github.com/matrix-org/synapse/issues/7948), [\#7949](https://github.com/matrix-org/synapse/issues/7949), [\#7951](https://github.com/matrix-org/synapse/issues/7951), [\#7963](https://github.com/matrix-org/synapse/issues/7963), [\#7973](https://github.com/matrix-org/synapse/issues/7973), [\#7975](https://github.com/matrix-org/synapse/issues/7975), [\#7976](https://github.com/matrix-org/synapse/issues/7976), [\#7981](https://github.com/matrix-org/synapse/issues/7981), [\#7987](https://github.com/matrix-org/synapse/issues/7987), [\#7989](https://github.com/matrix-org/synapse/issues/7989), [\#8003](https://github.com/matrix-org/synapse/issues/8003), [\#8014](https://github.com/matrix-org/synapse/issues/8014), [\#8016](https://github.com/matrix-org/synapse/issues/8016), [\#8027](https://github.com/matrix-org/synapse/issues/8027), [\#8031](https://github.com/matrix-org/synapse/issues/8031), [\#8032](https://github.com/matrix-org/synapse/issues/8032), [\#8035](https://github.com/matrix-org/synapse/issues/8035), [\#8042](https://github.com/matrix-org/synapse/issues/8042), [\#8044](https://github.com/matrix-org/synapse/issues/8044), [\#8045](https://github.com/matrix-org/synapse/issues/8045), [\#8061](https://github.com/matrix-org/synapse/issues/8061), [\#8062](https://github.com/matrix-org/synapse/issues/8062), [\#8063](https://github.com/matrix-org/synapse/issues/8063), [\#8066](https://github.com/matrix-org/synapse/issues/8066), [\#8069](https://github.com/matrix-org/synapse/issues/8069), [\#8070](https://github.com/matrix-org/synapse/issues/8070))
58+
- Move some database-related log lines from the default logger to the database/transaction loggers. ([\#7952](https://github.com/matrix-org/synapse/issues/7952))
59+
- Add a script to detect source code files using non-unix line terminators. ([\#7965](https://github.com/matrix-org/synapse/issues/7965), [\#7970](https://github.com/matrix-org/synapse/issues/7970))
60+
- Log the SAML session ID during creation. ([\#7971](https://github.com/matrix-org/synapse/issues/7971))
61+
- Implement new experimental push rules for some users. ([\#7997](https://github.com/matrix-org/synapse/issues/7997))
62+
- Remove redundant and unreliable signature check for v1 Identity Service lookup responses. ([\#8001](https://github.com/matrix-org/synapse/issues/8001))
63+
- Improve the performance of the register endpoint. ([\#8009](https://github.com/matrix-org/synapse/issues/8009))
64+
- Reduce less useful output in the newsfragment CI step. Add a link to the changelog section of the contributing guide on error. ([\#8024](https://github.com/matrix-org/synapse/issues/8024))
65+
- Rename storage layer objects to be more sensible. ([\#8033](https://github.com/matrix-org/synapse/issues/8033))
66+
- Change the default log config to reduce disk I/O and storage for new servers. ([\#8040](https://github.com/matrix-org/synapse/issues/8040))
67+
- Add an assertion on `prev_events` in `create_new_client_event`. ([\#8041](https://github.com/matrix-org/synapse/issues/8041))
68+
- Add a comment to `ServerContextFactory` about the use of `SSLv23_METHOD`. ([\#8043](https://github.com/matrix-org/synapse/issues/8043))
69+
- Log `OPTIONS` requests at `DEBUG` rather than `INFO` level to reduce amount logged at `INFO`. ([\#8049](https://github.com/matrix-org/synapse/issues/8049))
70+
- Reduce amount of outbound request logging at `INFO` level. ([\#8050](https://github.com/matrix-org/synapse/issues/8050))
71+
- It is no longer necessary to explicitly define `filters` in the logging configuration. (Continuing to do so is redundant but harmless.) ([\#8051](https://github.com/matrix-org/synapse/issues/8051))
72+
- Add and improve type hints. ([\#8058](https://github.com/matrix-org/synapse/issues/8058), [\#8064](https://github.com/matrix-org/synapse/issues/8064), [\#8060](https://github.com/matrix-org/synapse/issues/8060), [\#8067](https://github.com/matrix-org/synapse/issues/8067))
73+
74+
175
Synapse 1.18.0 (2020-07-30)
276
===========================
377

INSTALL.md

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
- [Choosing your server name](#choosing-your-server-name)
2+
- [Picking a database engine](#picking-a-database-engine)
23
- [Installing Synapse](#installing-synapse)
34
- [Installing from source](#installing-from-source)
45
- [Platform-Specific Instructions](#platform-specific-instructions)
56
- [Prebuilt packages](#prebuilt-packages)
67
- [Setting up Synapse](#setting-up-synapse)
78
- [TLS certificates](#tls-certificates)
9+
- [Client Well-Known URI](#client-well-known-uri)
810
- [Email](#email)
911
- [Registering a user](#registering-a-user)
1012
- [Setting up a TURN server](#setting-up-a-turn-server)
@@ -27,6 +29,25 @@ that your email address is probably `[email protected]` rather than
2729
`[email protected]`) - but doing so may require more advanced setup: see
2830
[Setting up Federation](docs/federate.md).
2931

32+
# Picking a database engine
33+
34+
Synapse offers two database engines:
35+
* [PostgreSQL](https://www.postgresql.org)
36+
* [SQLite](https://sqlite.org/)
37+
38+
Almost all installations should opt to use PostgreSQL. Advantages include:
39+
40+
* significant performance improvements due to the superior threading and
41+
caching model, smarter query optimiser
42+
* allowing the DB to be run on separate hardware
43+
44+
For information on how to install and use PostgreSQL, please see
45+
[docs/postgres.md](docs/postgres.md)
46+
47+
By default Synapse uses SQLite and in doing so trades performance for convenience.
48+
SQLite is only recommended in Synapse for testing purposes or for servers with
49+
light workloads.
50+
3051
# Installing Synapse
3152

3253
## Installing from source
@@ -234,17 +255,18 @@ for a number of platforms.
234255

235256
There is an offical synapse image available at
236257
https://hub.docker.com/r/matrixdotorg/synapse which can be used with
237-
the docker-compose file available at [contrib/docker](contrib/docker). Further information on
238-
this including configuration options is available in the README on
239-
hub.docker.com.
258+
the docker-compose file available at [contrib/docker](contrib/docker). Further
259+
information on this including configuration options is available in the README
260+
on hub.docker.com.
240261

241262
Alternatively, Andreas Peters (previously Silvio Fricke) has contributed a
242263
Dockerfile to automate a synapse server in a single Docker image, at
243264
https://hub.docker.com/r/avhost/docker-matrix/tags/
244265

245266
Slavi Pantaleev has created an Ansible playbook,
246267
which installs the offical Docker image of Matrix Synapse
247-
along with many other Matrix-related services (Postgres database, riot-web, coturn, mxisd, SSL support, etc.).
268+
along with many other Matrix-related services (Postgres database, Element, coturn,
269+
ma1sd, SSL support, etc.).
248270
For more details, see
249271
https://github.com/spantaleev/matrix-docker-ansible-deploy
250272

@@ -277,22 +299,27 @@ The fingerprint of the repository signing key (as shown by `gpg
277299
/usr/share/keyrings/matrix-org-archive-keyring.gpg`) is
278300
`AAF9AE843A7584B5A3E4CD2BCF45A512DE2DA058`.
279301

280-
#### Downstream Debian/Ubuntu packages
302+
#### Downstream Debian packages
281303

282-
For `buster` and `sid`, Synapse is available in the Debian repositories and
283-
it should be possible to install it with simply:
304+
We do not recommend using the packages from the default Debian `buster`
305+
repository at this time, as they are old and suffer from known security
306+
vulnerabilities. You can install the latest version of Synapse from
307+
[our repository](#matrixorg-packages) or from `buster-backports`. Please
308+
see the [Debian documentation](https://backports.debian.org/Instructions/)
309+
for information on how to use backports.
310+
311+
If you are using Debian `sid` or testing, Synapse is available in the default
312+
repositories and it should be possible to install it simply with:
284313

285314
```
286315
sudo apt install matrix-synapse
287316
```
288317

289-
There is also a version of `matrix-synapse` in `stretch-backports`. Please see
290-
the [Debian documentation on
291-
backports](https://backports.debian.org/Instructions/) for information on how
292-
to use them.
318+
#### Downstream Ubuntu packages
293319

294-
We do not recommend using the packages in downstream Ubuntu at this time, as
295-
they are old and suffer from known security vulnerabilities.
320+
We do not recommend using the packages in the default Ubuntu repository
321+
at this time, as they are old and suffer from known security vulnerabilities.
322+
The latest version of Synapse can be installed from [our repository](#matrixorg-packages).
296323

297324
### Fedora
298325

@@ -419,6 +446,60 @@ so, you will need to edit `homeserver.yaml`, as follows:
419446
For a more detailed guide to configuring your server for federation, see
420447
[federate.md](docs/federate.md).
421448

449+
## Client Well-Known URI
450+
451+
Setting up the client Well-Known URI is optional but if you set it up, it will
452+
allow users to enter their full username (e.g. `@user:<server_name>`) into clients
453+
which support well-known lookup to automatically configure the homeserver and
454+
identity server URLs. This is useful so that users don't have to memorize or think
455+
about the actual homeserver URL you are using.
456+
457+
The URL `https://<server_name>/.well-known/matrix/client` should return JSON in
458+
the following format.
459+
460+
```
461+
{
462+
"m.homeserver": {
463+
"base_url": "https://<matrix.example.com>"
464+
}
465+
}
466+
```
467+
468+
It can optionally contain identity server information as well.
469+
470+
```
471+
{
472+
"m.homeserver": {
473+
"base_url": "https://<matrix.example.com>"
474+
},
475+
"m.identity_server": {
476+
"base_url": "https://<identity.example.com>"
477+
}
478+
}
479+
```
480+
481+
To work in browser based clients, the file must be served with the appropriate
482+
Cross-Origin Resource Sharing (CORS) headers. A recommended value would be
483+
`Access-Control-Allow-Origin: *` which would allow all browser based clients to
484+
view it.
485+
486+
In nginx this would be something like:
487+
```
488+
location /.well-known/matrix/client {
489+
return 200 '{"m.homeserver": {"base_url": "https://<matrix.example.com>"}}';
490+
add_header Content-Type application/json;
491+
add_header Access-Control-Allow-Origin *;
492+
}
493+
```
494+
495+
You should also ensure the `public_baseurl` option in `homeserver.yaml` is set
496+
correctly. `public_baseurl` should be set to the URL that clients will use to
497+
connect to your server. This is the same URL you put for the `m.homeserver`
498+
`base_url` above.
499+
500+
```
501+
public_baseurl: "https://<matrix.example.com>"
502+
```
422503

423504
## Email
424505

@@ -437,7 +518,7 @@ email will be disabled.
437518

438519
## Registering a user
439520

440-
The easiest way to create a new user is to do so from a client like [Riot](https://riot.im).
521+
The easiest way to create a new user is to do so from a client like [Element](https://element.io/).
441522

442523
Alternatively you can do so from the command line if you have installed via pip.
443524

README.rst

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ which handle:
4545
- Eventually-consistent cryptographically secure synchronisation of room
4646
state across a global open network of federated servers and services
4747
- Sending and receiving extensible messages in a room with (optional)
48-
end-to-end encryption[1]
48+
end-to-end encryption
4949
- Inviting, joining, leaving, kicking, banning room members
5050
- Managing user accounts (registration, login, logout)
5151
- Using 3rd Party IDs (3PIDs) such as email addresses, phone numbers,
@@ -82,9 +82,6 @@ at the `Matrix spec <https://matrix.org/docs/spec>`_, and experiment with the
8282

8383
Thanks for using Matrix!
8484

85-
[1] End-to-end encryption is currently in beta: `blog post <https://matrix.org/blog/2016/11/21/matrixs-olm-end-to-end-encryption-security-assessment-released-and-implemented-cross-platform-on-riot-at-last>`_.
86-
87-
8885
Support
8986
=======
9087

@@ -115,12 +112,11 @@ Unless you are running a test instance of Synapse on your local machine, in
115112
general, you will need to enable TLS support before you can successfully
116113
connect from a client: see `<INSTALL.md#tls-certificates>`_.
117114

118-
An easy way to get started is to login or register via Riot at
119-
https://riot.im/app/#/login or https://riot.im/app/#/register respectively.
115+
An easy way to get started is to login or register via Element at
116+
https://app.element.io/#/login or https://app.element.io/#/register respectively.
120117
You will need to change the server you are logging into from ``matrix.org``
121118
and instead specify a Homeserver URL of ``https://<server_name>:8448``
122119
(or just ``https://<server_name>`` if you are using a reverse proxy).
123-
(Leave the identity server as the default - see `Identity servers`_.)
124120
If you prefer to use another client, refer to our
125121
`client breakdown <https://matrix.org/docs/projects/clients-matrix>`_.
126122

@@ -137,7 +133,7 @@ it, specify ``enable_registration: true`` in ``homeserver.yaml``. (It is then
137133
recommended to also set up CAPTCHA - see `<docs/CAPTCHA_SETUP.md>`_.)
138134

139135
Once ``enable_registration`` is set to ``true``, it is possible to register a
140-
user via `riot.im <https://riot.im/app/#/register>`_ or other Matrix clients.
136+
user via a Matrix client.
141137

142138
Your new user name will be formed partly from the ``server_name``, and partly
143139
from a localpart you specify when you create the account. Your name will take
@@ -183,30 +179,6 @@ versions of synapse.
183179

184180
.. _UPGRADE.rst: UPGRADE.rst
185181

186-
187-
Using PostgreSQL
188-
================
189-
190-
Synapse offers two database engines:
191-
* `PostgreSQL <https://www.postgresql.org>`_
192-
* `SQLite <https://sqlite.org/>`_
193-
194-
Almost all installations should opt to use PostgreSQL. Advantages include:
195-
196-
* significant performance improvements due to the superior threading and
197-
caching model, smarter query optimiser
198-
* allowing the DB to be run on separate hardware
199-
* allowing basic active/backup high-availability with a "hot spare" synapse
200-
pointing at the same DB master, as well as enabling DB replication in
201-
synapse itself.
202-
203-
For information on how to install and use PostgreSQL, please see
204-
`docs/postgres.md <docs/postgres.md>`_.
205-
206-
By default Synapse uses SQLite and in doing so trades performance for convenience.
207-
SQLite is only recommended in Synapse for testing purposes or for servers with
208-
light workloads.
209-
210182
.. _reverse-proxy:
211183

212184
Using a reverse proxy with Synapse
@@ -255,10 +227,9 @@ email address.
255227
Password reset
256228
==============
257229

258-
If a user has registered an email address to their account using an identity
259-
server, they can request a password-reset token via clients such as Riot.
260-
261-
A manual password reset can be done via direct database access as follows.
230+
Users can reset their password through their client. Alternatively, a server admin
231+
can reset a users password using the `admin API <docs/admin_api/user_admin_api.rst#reset-password>`_
232+
or by directly editing the database as shown below.
262233

263234
First calculate the hash of the new password::
264235

changelog.d/8056.docker

Lines changed: 0 additions & 1 deletion
This file was deleted.

contrib/cmdclient/console.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -609,13 +609,15 @@ def do_stream(self, line):
609609

610610
@defer.inlineCallbacks
611611
def _do_event_stream(self, timeout):
612-
res = yield self.http_client.get_json(
613-
self._url() + "/events",
614-
{
615-
"access_token": self._tok(),
616-
"timeout": str(timeout),
617-
"from": self.event_stream_token,
618-
},
612+
res = yield defer.ensureDeferred(
613+
self.http_client.get_json(
614+
self._url() + "/events",
615+
{
616+
"access_token": self._tok(),
617+
"timeout": str(timeout),
618+
"from": self.event_stream_token,
619+
},
620+
)
619621
)
620622
print(json.dumps(res, indent=4))
621623

0 commit comments

Comments
 (0)