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

Commit

Permalink
Merge commit 'de119063f' into anoa/dinsic_release_1_18_x
Browse files Browse the repository at this point in the history
* commit 'de119063f': (31 commits)
  Convert room list handler to async/await. (#7912)
  Element CSS and logo in email templates (#7919)
  Lint the contrib/ directory in CI and linting scripts, add synctl to linting script (#7914)
  Remove unused code from synapse.logging.utils. (#7897)
  Fix a typo in the sample config. (#7890)
  Fix deprecation warning: import ABC from collections.abc (#7892)
  Change sample config's postgres user to synapse_user (#7889)
  Fix deprecation warning due to invalid escape sequences (#7895)
  Remove Ubuntu Eoan that is now EOL (#7888)
  Fix the trace function for async functions. (#7872)
  Add help for creating a user via docker (#7885)
  Switch to Debian:Slim from Alpine for the docker image (#7839)
  Stop using 'device_max_stream_id' (#7882)
  Fix TypeError in synapse.notifier (#7880)
  Add a default limit (of 100) to get/sync operations. (#7858)
  Change "unknown room ver" logging to warning. (#7881)
  Convert device handler to async/await (#7871)
  Convert synapse.app to async/await. (#7868)
  Convert _base, profile, and _receipts handlers to async/await (#7860)
  Add admin endpoint to get members in a room. (#7842)
  ...
  • Loading branch information
anoadragon453 committed Aug 4, 2020
2 parents d9e25be + de11906 commit a567e76
Show file tree
Hide file tree
Showing 122 changed files with 1,703 additions and 1,145 deletions.
1 change: 1 addition & 0 deletions changelog.d/7839.docker
@@ -0,0 +1 @@
Base docker image on Debian Buster rather than Alpine Linux. Contributed by @maquis196.
1 change: 1 addition & 0 deletions changelog.d/7842.feature
@@ -0,0 +1 @@
Add an admin API to list the users in a room. Contributed by Awesome Technologies Innovationslabor GmbH.
1 change: 1 addition & 0 deletions changelog.d/7849.misc
@@ -0,0 +1 @@
Consistently use `db_to_json` to convert from database values to JSON objects.
1 change: 1 addition & 0 deletions changelog.d/7855.feature
@@ -0,0 +1 @@
Add experimental support for running multiple pusher workers.
1 change: 1 addition & 0 deletions changelog.d/7858.misc
@@ -0,0 +1 @@
The default value of `filter_timeline_limit` was changed from -1 (no limit) to 100.
1 change: 1 addition & 0 deletions changelog.d/7859.bugfix
@@ -0,0 +1 @@
Fix a bug which allowed empty rooms to be rejoined over federation.
1 change: 1 addition & 0 deletions changelog.d/7860.misc
@@ -0,0 +1 @@
Convert _base, profile, and _receipts handlers to async/await.
1 change: 1 addition & 0 deletions changelog.d/7861.misc
@@ -0,0 +1 @@
Optimise queueing of inbound replication commands.
1 change: 1 addition & 0 deletions changelog.d/7866.bugfix
@@ -0,0 +1 @@
Fix 'Unable to find a suitable guest user ID' error when using multiple client_reader workers.
1 change: 1 addition & 0 deletions changelog.d/7868.misc
@@ -0,0 +1 @@
Convert synapse.app and federation client to async/await.
1 change: 1 addition & 0 deletions changelog.d/7869.feature
@@ -0,0 +1 @@
Add experimental support for moving typing off master.
1 change: 1 addition & 0 deletions changelog.d/7871.misc
@@ -0,0 +1 @@
Convert device handler to async/await.
1 change: 1 addition & 0 deletions changelog.d/7872.bugfix
@@ -0,0 +1 @@
Fix a long standing bug where the tracing of async functions with opentracing was broken.
1 change: 1 addition & 0 deletions changelog.d/7880.bugfix
@@ -0,0 +1 @@
Fix "TypeError in `synapse.notifier`" exceptions.
1 change: 1 addition & 0 deletions changelog.d/7881.misc
@@ -0,0 +1 @@
Change "unknown room version" logging from 'error' to 'warning'.
1 change: 1 addition & 0 deletions changelog.d/7882.misc
@@ -0,0 +1 @@
Stop using `device_max_stream_id` table and just use `device_inbox.stream_id`.
1 change: 1 addition & 0 deletions changelog.d/7885.doc
@@ -0,0 +1 @@
Provide instructions on using `register_new_matrix_user` via docker.
1 change: 1 addition & 0 deletions changelog.d/7888.misc
@@ -0,0 +1 @@
Remove Ubuntu Eoan from the list of `.deb` packages that we build as it is now end-of-life. Contributed by @gary-kim.
1 change: 1 addition & 0 deletions changelog.d/7889.doc
@@ -0,0 +1 @@
Change the sample config postgres user section to use `synapse_user` instead of `synapse` to align with the documentation.
1 change: 1 addition & 0 deletions changelog.d/7890.misc
@@ -0,0 +1 @@
Fix typo in generated config file. Contributed by @ThiefMaster.
1 change: 1 addition & 0 deletions changelog.d/7892.misc
@@ -0,0 +1 @@
Import ABC from `collections.abc` for Python 3.10 compatibility.
1 change: 1 addition & 0 deletions changelog.d/7895.bugfix
@@ -0,0 +1 @@
Fix deprecation warning due to invalid escape sequences.
2 changes: 2 additions & 0 deletions changelog.d/7897.misc
@@ -0,0 +1,2 @@
Remove unused functions `time_function`, `trace_function`, `get_previous_frames`
and `get_previous_frame` from `synapse.logging.utils` module.
1 change: 1 addition & 0 deletions changelog.d/7912.misc
@@ -0,0 +1 @@
Convert `RoomListHandler` to async/await.
1 change: 1 addition & 0 deletions changelog.d/7914.misc
@@ -0,0 +1 @@
Lint the `contrib/` directory in CI and linting scripts, add `synctl` to the linting script for consistency with CI.
1 change: 1 addition & 0 deletions changelog.d/7919.misc
@@ -0,0 +1 @@
Use Element CSS and logo in notification emails when app name is Element.
21 changes: 10 additions & 11 deletions contrib/cmdclient/console.py
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
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
55 changes: 21 additions & 34 deletions contrib/experiments/test_messaging.py
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
21 changes: 10 additions & 11 deletions contrib/graph/graph.py
@@ -1,5 +1,13 @@
from __future__ import print_function

import argparse
import cgi
import datetime
import json

import pydot
import urllib2

# Copyright 2014-2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,15 +23,6 @@
# limitations under the License.


import sqlite3
import pydot
import cgi
import json
import datetime
import argparse
import urllib2


def make_name(pdu_id, origin):
return "%s@%s" % (pdu_id, origin)

Expand All @@ -33,7 +32,7 @@ def make_graph(pdus, room, filename_prefix):
node_map = {}

origins = set()
colors = set(("red", "green", "blue", "yellow", "purple"))
colors = {"red", "green", "blue", "yellow", "purple"}

for pdu in pdus:
origins.add(pdu.get("origin"))
Expand All @@ -49,7 +48,7 @@ def make_graph(pdus, room, filename_prefix):
try:
c = colors.pop()
color_map[o] = c
except:
except Exception:
print("Run out of colours!")
color_map[o] = "black"

Expand Down
11 changes: 6 additions & 5 deletions contrib/graph/graph2.py
Expand Up @@ -13,12 +13,13 @@
# limitations under the License.


import sqlite3
import pydot
import argparse
import cgi
import json
import datetime
import argparse
import json
import sqlite3

import pydot

from synapse.events import FrozenEvent
from synapse.util.frozenutils import unfreeze
Expand Down Expand Up @@ -98,7 +99,7 @@ def make_graph(db_name, room_id, file_prefix, limit):
for prev_id, _ in event.prev_events:
try:
end_node = node_map[prev_id]
except:
except Exception:
end_node = pydot.Node(name=prev_id, label="<<b>%s</b>>" % (prev_id,))

node_map[prev_id] = end_node
Expand Down
22 changes: 11 additions & 11 deletions contrib/graph/graph3.py
@@ -1,5 +1,15 @@
from __future__ import print_function

import argparse
import cgi
import datetime

import pydot
import simplejson as json

from synapse.events import FrozenEvent
from synapse.util.frozenutils import unfreeze

# Copyright 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,16 +25,6 @@
# limitations under the License.


import pydot
import cgi
import simplejson as json
import datetime
import argparse

from synapse.events import FrozenEvent
from synapse.util.frozenutils import unfreeze


def make_graph(file_name, room_id, file_prefix, limit):
print("Reading lines")
with open(file_name) as f:
Expand Down Expand Up @@ -106,7 +106,7 @@ def make_graph(file_name, room_id, file_prefix, limit):
for prev_id, _ in event.prev_events:
try:
end_node = node_map[prev_id]
except:
except Exception:
end_node = pydot.Node(name=prev_id, label="<<b>%s</b>>" % (prev_id,))

node_map[prev_id] = end_node
Expand Down

0 comments on commit a567e76

Please sign in to comment.