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

Commit

Permalink
Merge branch 'develop' of github.com:matrix-org/synapse into anoa/imp…
Browse files Browse the repository at this point in the history
…rove_test_times

* 'develop' of github.com:matrix-org/synapse: (148 commits)
  Add script for finding files with unix line terminators (#7965)
  Convert the remaining media repo code to async / await. (#7947)
  Convert a synapse.events to async/await. (#7949)
  Convert groups and visibility code to async / await. (#7951)
  Convert push to async/await. (#7948)
  update changelog
  1.18.0rc1
  Fix error reporting when using `opentracing.trace` (#7961)
  Fix typing replication not being handled on master (#7959)
  Remove hacky error handling for inlineDeferreds. (#7950)
  Convert tests/rest/admin/test_room.py to unix file endings (#7953)
  Support oEmbed for media previews. (#7920)
  Convert state resolution to async/await (#7942)
  Fix up types and comments that refer to Deferreds. (#7945)
  Do not convert async functions to Deferreds in the interactive_auth_handler (#7944)
  Convert more of the media code to async/await (#7873)
  Return an empty body for OPTIONS requests. (#7886)
  Downgrade warning on client disconnect to INFO (#7928)
  Convert presence handler helpers to async/await. (#7939)
  Update the auth providers to be async. (#7935)
  ...
  • Loading branch information
anoadragon453 committed Jul 28, 2020
2 parents 7b0967f + c4ce0da commit 5d230b3
Show file tree
Hide file tree
Showing 329 changed files with 10,722 additions and 6,098 deletions.
274 changes: 274 additions & 0 deletions CHANGES.md

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,13 +405,11 @@ so, you will need to edit `homeserver.yaml`, as follows:
```

* You will also need to uncomment the `tls_certificate_path` and
`tls_private_key_path` lines under the `TLS` section. You can either
point these settings at an existing certificate and key, or you can
enable Synapse's built-in ACME (Let's Encrypt) support. Instructions
for having Synapse automatically provision and renew federation
certificates through ACME can be found at [ACME.md](docs/ACME.md).
Note that, as pointed out in that document, this feature will not
work with installs set up after November 2019.
`tls_private_key_path` lines under the `TLS` section. You will need to manage
provisioning of these certificates yourself — Synapse had built-in ACME
support, but the ACMEv1 protocol Synapse implements is deprecated, not
allowed by LetsEncrypt for new sites, and will break for existing sites in
late 2020. See [ACME.md](docs/ACME.md).

If you are using your own certificate, be sure to use a `.pem` file that
includes the full certificate chain including any intermediate certificates
Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,8 @@ Using PostgreSQL
================

Synapse offers two database engines:
* `SQLite <https://sqlite.org/>`_
* `PostgreSQL <https://www.postgresql.org>`_

By default Synapse uses SQLite in and doing so trades performance for convenience.
SQLite is only recommended in Synapse for testing purposes or for servers with
light workloads.
* `SQLite <https://sqlite.org/>`_

Almost all installations should opt to use PostgreSQL. Advantages include:

Expand All @@ -207,6 +203,10 @@ Almost all installations should opt to use PostgreSQL. Advantages include:
For information on how to install and use PostgreSQL, please see
`docs/postgres.md <docs/postgres.md>`_.

By default Synapse uses SQLite and in doing so trades performance for convenience.
SQLite is only recommended in Synapse for testing purposes or for servers with
light workloads.

.. _reverse-proxy:

Using a reverse proxy with Synapse
Expand All @@ -215,7 +215,7 @@ Using a reverse proxy with Synapse
It is recommended to put a reverse proxy such as
`nginx <https://nginx.org/en/docs/http/ngx_http_proxy_module.html>`_,
`Apache <https://httpd.apache.org/docs/current/mod/mod_proxy_http.html>`_,
`Caddy <https://caddyserver.com/docs/proxy>`_ or
`Caddy <https://caddyserver.com/docs/quick-starts/reverse-proxy>`_ or
`HAProxy <https://www.haproxy.org/>`_ in front of Synapse. One advantage of
doing so is that it means that you can expose the default https port (443) to
Matrix clients without needing to run Synapse with root privileges.
Expand Down
1 change: 0 additions & 1 deletion changelog.d/7606.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7636.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7639.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7648.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7652.doc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7657.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7659.doc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7663.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7664.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7673.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7675.removal

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7677.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7678.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7679.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7680.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7681.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7687.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7688.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7689.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7691.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7692.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7697.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7698.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7701.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7703.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7704.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7706.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7708.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7711.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7712.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7714.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7716.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7717.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7718.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7724.doc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7725.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7727.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7730.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7735.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7738.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/7746.bugfix

This file was deleted.

1 change: 1 addition & 0 deletions changelog.d/7947.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert various parts of the codebase to async/await.
1 change: 1 addition & 0 deletions changelog.d/7948.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert various parts of the codebase to async/await.
1 change: 1 addition & 0 deletions changelog.d/7949.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert various parts of the codebase to async/await.
1 change: 1 addition & 0 deletions changelog.d/7951.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert various parts of the codebase to async/await.
1 change: 1 addition & 0 deletions changelog.d/7965.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a script to detect source code files using non-unix line terminators.
21 changes: 10 additions & 11 deletions contrib/cmdclient/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
""" Starts a synapse client console. """
from __future__ import print_function

from twisted.internet import reactor, defer, threads
from http import TwistedHttpClient

import argparse
import cmd
import getpass
Expand All @@ -28,12 +25,14 @@
import sys
import time
import urllib
import urlparse
from http import TwistedHttpClient

import nacl.signing
import nacl.encoding
import nacl.signing
import urlparse
from signedjson.sign import SignatureVerifyException, verify_signed_json

from signedjson.sign import verify_signed_json, SignatureVerifyException
from twisted.internet import defer, reactor, threads

CONFIG_JSON = "cmdclient_config.json"

Expand Down Expand Up @@ -493,7 +492,7 @@ def do_list(self, line):
"list messages <roomid> from=END&to=START&limit=3"
"""
args = self._parse(line, ["type", "roomid", "qp"])
if not "type" in args or not "roomid" in args:
if "type" not in args or "roomid" not in args:
print("Must specify type and room ID.")
return
if args["type"] not in ["members", "messages"]:
Expand All @@ -508,7 +507,7 @@ def do_list(self, line):
try:
key_value = key_value_str.split("=")
qp[key_value[0]] = key_value[1]
except:
except Exception:
print("Bad query param: %s" % key_value)
return

Expand Down Expand Up @@ -585,7 +584,7 @@ def do_raw(self, line):
parsed_url = urlparse.urlparse(args["path"])
qp.update(urlparse.parse_qs(parsed_url.query))
args["path"] = parsed_url.path
except:
except Exception:
pass

reactor.callFromThread(
Expand Down Expand Up @@ -772,10 +771,10 @@ def main(server_url, identity_server_url, username, token, config_path):
syn_cmd.config = json.load(config)
try:
http_client.verbose = "on" == syn_cmd.config["verbose"]
except:
except Exception:
pass
print("Loaded config from %s" % config_path)
except:
except Exception:
pass

# Twisted-specific: Runs the command processor in Twisted's event loop
Expand Down
10 changes: 5 additions & 5 deletions contrib/cmdclient/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
# limitations under the License.

from __future__ import print_function
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers
from twisted.internet import defer, reactor

from pprint import pformat

import json
import urllib
from pprint import pformat

from twisted.internet import defer, reactor
from twisted.web.client import Agent, readBody
from twisted.web.http_headers import Headers


class HttpClient(object):
Expand Down
2 changes: 1 addition & 1 deletion contrib/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ services:
- traefik.http.routers.https-synapse.tls.certResolver=le-ssl

db:
image: docker.io/postgres:10-alpine
image: docker.io/postgres:12-alpine
# Change that password, of course!
environment:
- POSTGRES_USER=synapse
Expand Down
55 changes: 21 additions & 34 deletions contrib/experiments/test_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,24 @@
"""


from synapse.federation import ReplicationHandler

from synapse.federation.units import Pdu

from synapse.util import origin_from_ucid

from synapse.app.homeserver import SynapseHomeServer

# from synapse.logging.utils import log_function

from twisted.internet import reactor, defer
from twisted.python import log

import argparse
import curses.wrapper
import json
import logging
import os
import re

import cursesio
import curses.wrapper

from twisted.internet import defer, reactor
from twisted.python import log

from synapse.app.homeserver import SynapseHomeServer
from synapse.federation import ReplicationHandler
from synapse.federation.units import Pdu
from synapse.util import origin_from_ucid

# from synapse.logging.utils import log_function


logger = logging.getLogger("example")
Expand All @@ -75,7 +72,7 @@ def on_line(self, line):
"""

try:
m = re.match("^join (\S+)$", line)
m = re.match(r"^join (\S+)$", line)
if m:
# The `sender` wants to join a room.
(room_name,) = m.groups()
Expand All @@ -84,7 +81,7 @@ def on_line(self, line):
# self.print_line("OK.")
return

m = re.match("^invite (\S+) (\S+)$", line)
m = re.match(r"^invite (\S+) (\S+)$", line)
if m:
# `sender` wants to invite someone to a room
room_name, invitee = m.groups()
Expand All @@ -93,7 +90,7 @@ def on_line(self, line):
# self.print_line("OK.")
return

m = re.match("^send (\S+) (.*)$", line)
m = re.match(r"^send (\S+) (.*)$", line)
if m:
# `sender` wants to message a room
room_name, body = m.groups()
Expand All @@ -102,7 +99,7 @@ def on_line(self, line):
# self.print_line("OK.")
return

m = re.match("^backfill (\S+)$", line)
m = re.match(r"^backfill (\S+)$", line)
if m:
# we want to backfill a room
(room_name,) = m.groups()
Expand Down Expand Up @@ -201,16 +198,6 @@ def on_receive_pdu(self, pdu):
% (pdu.context, pdu.pdu_type, json.dumps(pdu.content))
)

# def on_state_change(self, pdu):
##self.output.print_line("#%s (state) %s *** %s" %
##(pdu.context, pdu.state_key, pdu.pdu_type)
##)

# if "joinee" in pdu.content:
# self._on_join(pdu.context, pdu.content["joinee"])
# elif "invitee" in pdu.content:
# self._on_invite(pdu.origin, pdu.context, pdu.content["invitee"])

def _on_message(self, pdu):
""" We received a message
"""
Expand Down Expand Up @@ -314,7 +301,7 @@ def backfill(self, room_name, limit=5):
return self.replication_layer.backfill(dest, room_name, limit)

def _get_room_remote_servers(self, room_name):
return [i for i in self.joined_rooms.setdefault(room_name).servers]
return list(self.joined_rooms.setdefault(room_name).servers)

def _get_or_create_room(self, room_name):
return self.joined_rooms.setdefault(room_name, Room(room_name))
Expand All @@ -334,7 +321,7 @@ def main(stdscr):
user = args.user
server_name = origin_from_ucid(user)

## Set up logging ##
# Set up logging

root_logger = logging.getLogger()

Expand All @@ -354,7 +341,7 @@ def main(stdscr):
observer = log.PythonLoggingObserver()
observer.start()

## Set up synapse server
# Set up synapse server

curses_stdio = cursesio.CursesStdIO(stdscr)
input_output = InputOutput(curses_stdio, user)
Expand All @@ -368,16 +355,16 @@ def main(stdscr):

input_output.set_home_server(hs)

## Add input_output logger
# Add input_output logger
io_logger = IOLoggerHandler(input_output)
io_logger.setFormatter(formatter)
root_logger.addHandler(io_logger)

## Start! ##
# Start!

try:
port = int(server_name.split(":")[1])
except:
except Exception:
port = 12345

app_hs.get_http_server().start_listening(port)
Expand Down
Loading

0 comments on commit 5d230b3

Please sign in to comment.