Commit Graph

153 Commits

Author SHA1 Message Date
Andrew Morgan
fb0ffa9676
Rename various ApplicationServices interested methods () 2022-03-03 18:14:09 +00:00
Patrick Cloke
1d11b452b7
Use the proper serialization format when bundling aggregations. ()
This ensures that the `latest_event` field of the bundled aggregation
for threads uses the same format as the other events in the response.
2022-03-03 10:43:06 -05:00
reivilibre
2cc5ea933d
Add support for MSC3202: sending one-time key counts and fallback key usage states to Application Services. ()
Co-authored-by: Erik Johnston <erik@matrix.org>
2022-02-24 17:55:45 +00:00
Richard van der Hoff
e24ff8ebe3
Remove HomeServer.get_datastore() ()
The presence of this method was confusing, and mostly present for backwards
compatibility. Let's get rid of it.

Part of 
2022-02-23 11:04:02 +00:00
Andrew Morgan
cf06783d54
Remove optional state of ApplicationService.is_interested's store parameter () 2022-02-07 18:26:42 +00:00
Andrew Morgan
64ec45fc1b
Send to-device messages to application services ()
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2022-02-01 14:13:38 +00:00
Patrick Cloke
2519beaad2
Add missing type hints to synapse.appservice () 2021-12-14 17:02:46 +00:00
reivilibre
435f044807
Add type annotations to tests.storage.test_appservice. () 2021-12-02 15:30:05 +00:00
Eric Eastwood
7ffddd819c
Prevent historical state from being pushed to an application service via /transactions (MSC2716) ()
Mark historical state from the MSC2716 `/batch_send` endpoint as `historical` which makes it `backfilled` and have a negative `stream_ordering` so it doesn't get queried by `/transactions`.

Fix https://github.com/matrix-org/synapse/issues/11241

Complement tests: https://github.com/matrix-org/complement/pull/221
2021-11-18 14:16:08 -06:00
Sean Quah
2b82ec425f
Add type hints for most HomeServer parameters () 2021-10-22 18:15:41 +01:00
Jonathan de Jong
bf72d10dbf
Use inline type hints in various other places (in synapse/) () 2021-07-15 11:02:43 +01:00
Sorunome
d936371b69
Implement knock feature ()
This PR aims to implement the knock feature as proposed in https://github.com/matrix-org/matrix-doc/pull/2403

Signed-off-by: Sorunome mail@sorunome.de
Signed-off-by: Andrew Morgan andrewm@element.io
2021-06-09 19:39:51 +01:00
Jonathan de Jong
4b965c862d
Remove redundant "coding: utf-8" lines ()
Part of 

Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now.

`Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
2021-04-14 15:34:27 +01:00
Jonathan de Jong
2ca4e349e9
Bugbear: Add Mutable Parameter fixes ()
Part of 

Adds in fixes for B006 and B008, both relating to mutable parameter lint errors.

Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
2021-04-08 22:38:54 +01:00
Jonathan de Jong
d6196efafc
Add ResponseCache tests. () 2021-03-08 14:00:07 -05:00
Eric Eastwood
0a00b7ff14
Update black, and run auto formatting over the codebase ()
- Update black version to the latest
 - Run black auto formatting over the codebase
    - Run autoformatting according to [`docs/code_style.md
`](80d6dc9783/docs/code_style.md)
 - Update `code_style.md` docs around installing black to use the correct version
2021-02-16 22:32:34 +00:00
Brendan Abolivier
29ae04af3b
Remove unneeded type constraints on 3rd party protocol lookup responses 2021-02-09 17:50:25 +01:00
Will Hunt
70269fbd18
Tie together matches_user_in_member_list and get_users_in_room caches ()
* Tie together matches_user_in_member_list and get_users_in_room

* changelog

* Remove type to fix mypy

* Add `on_invalidate` to the function signature in the hopes that may make things work well

* Remove **kwargs

* Update 8676.bugfix
2020-10-29 16:58:16 +00:00
Erik Johnston
f21e24ffc2
Add ability for access tokens to belong to one user but grant access to another user. ()
We do it this way round so that only the "owner" can delete the access token (i.e. `/logout/all` by the "owner" also deletes that token, but `/logout/all` by the "target user" doesn't).

A future PR will add an API for creating such a token.

When the target user and authenticated entity are different the `Processed request` log line will be logged with a: `{@admin:server as @bob:server} ...`. I'm not convinced by that format (especially since it adds spaces in there, making it harder to use `cut -d ' '` to chop off the start of log lines). Suggestions welcome.
2020-10-29 15:58:44 +00:00
Will Hunt
70259d8c8c
Limit AS transactions to 100 events ()
* Limit AS transactions to 100 events

* Update changelog.d/8606.feature

Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>

* Add tests

* Update synapse/appservice/scheduler.py

Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2020-10-21 15:36:53 +01:00
Will Hunt
c276bd9969
Send some ephemeral events to appservices ()
Optionally sends typing, presence, and read receipt information to appservices.
2020-10-15 12:33:28 -04:00
Patrick Cloke
1781bbe319
Add type hints to response cache. () 2020-10-09 11:35:11 -04:00
Richard van der Hoff
11c9e17738
Add type annotations to SimpleHttpClient () 2020-09-24 15:47:20 +01:00
Patrick Cloke
8a4a4186de
Simplify super() calls to Python 3 syntax. ()
This converts calls like super(Foo, self) -> super().

Generated with:

    sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
2020-09-18 09:56:44 -04:00
Patrick Cloke
c619253db8
Stop sub-classing object () 2020-09-04 06:54:56 -04:00
Patrick Cloke
7d103a594e
Convert appservice code to async/await. () 2020-09-01 11:03:49 -04:00
Patrick Cloke
5c03134d0f
Convert additional database code to async/await. () 2020-08-28 07:54:27 -04:00
Patrick Cloke
88a3ff12f0
Convert the SimpleHttpClient to async. () 2020-08-04 07:22:04 -04:00
Patrick Cloke
4cce8ef74e
Convert appservice to async. () 2020-07-30 07:27:39 -04:00
Sorunome
1bca21e1da
Include room states on invite events sent to ASes () 2020-07-10 18:44:56 +01:00
Patrick Cloke
6d687ebba1
Convert the appservice handler to async/await. () 2020-07-06 07:40:35 -04:00
Dagfinn Ilmari Mannsåker
a3f11567d9
Replace all remaining six usage with native Python 3 equivalents () 2020-06-16 08:51:47 -04:00
Andrew Morgan
34a43f0084 Fix a couple of small typos 2020-05-15 18:54:32 +01:00
Andrew Morgan
3916e1b97a
Clean up newline quote marks around the codebase () 2019-11-21 12:00:14 +00:00
Will Hunt
42e707c663 rstrip slashes from url on appservice () 2019-10-31 17:32:25 +00:00
Andrew Morgan
2a44782666
Remove double return statements ()
Remove all the "double return" statements which were a result of us removing all the instances of

```
defer.returnValue(...)
return
```

statements when we switched to python3 fully.
2019-09-03 11:42:45 +01:00
Richard van der Hoff
72bc285669
Refactor the Appservice scheduler code ()
Get rid of the labyrinthine `recoverer_fn` code, and clean up the startup code
(it seemed to be previously inexplicably split between
`ApplicationServiceScheduler.start` and `_Recoverer.start`).

Add some docstrings too.
2019-08-20 17:42:45 +01:00
Richard van der Hoff
baa3f4a80d
Avoid deep recursion in appservice recovery ()
Hopefully, this will fix a stack overflow when recovering an appservice.

The recursion here leads to a huge chain of deferred callbacks, which then
overflows the stack when the chain completes. `inlineCallbacks` makes a better
job of this if we use iteration instead.

Clean up the code a bit too, while we're there.
2019-08-20 17:39:38 +01:00
Richard van der Hoff
5019945828 Refactor the Appservice scheduler code
Get rid of the labyrinthine `recoverer_fn` code, and clean up the startup code
(it seemed to be previously inexplicably split between
`ApplicationServiceScheduler.start` and `_Recoverer.start`).

Add some docstrings too.
2019-08-20 11:50:23 +01:00
Amber Brown
4806651744
Replace returnValue with return () 2019-07-23 23:00:55 +10:00
Amber Brown
463b072b12
Move logging utilities out of the side drawer of util/ and into logging/ () 2019-07-04 00:07:04 +10:00
Amber Brown
32e7c9e7f2
Run Black. () 2019-06-20 19:32:02 +10:00
Richard van der Hoff
52e87fbfbe
Run the AS senders as background processes ()
This should fix some "Starting db connection from sentinel context" warnings,
and will mean we get metrics for these processes.
2018-12-04 10:53:49 +01:00
Amber Brown
2d2828dcbc
Port http/ to Python 3 () 2018-09-06 00:10:47 +10:00
Amber Brown
49af402019 run isort 2018-07-09 16:09:20 +10:00
Matthew Hodgson
f4f1cda928 add ip_range_whitelist parameter to limit where ASes can connect from 2018-06-28 20:32:00 +01:00
Will Hunt
13d211edc1
Merge pull request from Half-Shot/hs/as-metrics
Add metrics to track appservice transactions
2018-06-07 11:37:12 +01:00
Michael Telatynski
592c162516
also redact __str__ of ApplicationService used for logging 2018-06-06 10:35:29 +01:00
Will Hunt
d6e3c2c79b Let's try labels instead of label, that might work 2018-06-05 17:30:45 +01:00
Will Hunt
604cff1a06 Add metrics to track appservice transactions 2018-06-05 13:21:30 +01:00