Jonathan de Jong
4b965c862d
Remove redundant "coding: utf-8" lines ( #9786 )
Part of #9744
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>`
hace 3 años
Patrick Cloke
44bb881096
Add type hints to expiring cache. ( #9730 )
hace 3 años
Richard van der Hoff
c73cc2c2ad
Spaces summary: call out to other servers ( #9653 )
When we hit an unknown room in the space tree, see if there are other servers that we might be able to poll to get the data.
Fixes : #9447
hace 3 años
Patrick Cloke
b7748d3c00
Import HomeServer from the proper module. ( #9665 )
hace 3 años
Eric Eastwood
0a00b7ff14
Update black, and run auto formatting over the codebase ( #9381 )
- 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
hace 3 años
Erik Johnston
f2c1560eca
Ratelimit invites by room and target user ( #9258 )
hace 3 años
Patrick Cloke
620ecf13b0
Various improvements to the federation client. ( #9129 )
* Type hints for `FederationClient`.
* Using `async` functions instead of returning `Awaitable` instances.
hace 3 años
Richard van der Hoff
2649d545a5
Mypy fixes for `synapse.handlers.federation` ( #8422 )
For some reason, an apparently unrelated PR upset mypy about this module. Here are a number of little fixes.
hace 3 años
Patrick Cloke
8a4a4186de
Simplify super() calls to Python 3 syntax. ( #8344 )
This converts calls like super(Foo, self) -> super().
Generated with:
sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
hace 3 años
Andrew Morgan
27c1abc7b8
Use _check_sigs_and_hash_and_fetch to validate backfill requests ( #8350 )
This is a bit of a hack, as `_check_sigs_and_hash_and_fetch` is intended
for attempting to pull an event from the database/(re)pull it from the
server that originally sent the event if checking the signature of the
event fails.
During backfill we *know* that we won't have the event in our database,
however it is still useful to be able to query the original sending
server as the server we're backfilling from may be acting maliciously.
The main benefit and reason for this change however is that
`_check_sigs_and_hash_and_fetch` will drop an event during backfill if
it cannot be successfully validated, whereas the current code will
simply fail the backfill request - resulting in the client's /messages
request silently being dropped.
This is a quick patch to fix backfilling rooms that contain malformed
events. A better implementation in planned in future.
hace 3 años
Erik Johnston
c570f24acc
Don't assume that an event has an origin field
This fixes #8319 .
hace 3 años
Patrick Cloke
c978f6c451
Convert federation client to async/await. ( #7975 )
hace 3 años
Patrick Cloke
00e57b755c
Convert synapse.app to async/await. ( #7868 )
hace 3 años
Patrick Cloke
38e1fac886
Fix some spelling mistakes / typos. ( #7811 )
hace 3 años
Richard van der Hoff
67593b1728
Add `HomeServer.signing_key` property ( #7805 )
... instead of duplicating `config.signing_key[0]` everywhere
hace 3 años
Andrew Morgan
6b22921b19
async/await is_server_admin ( #7363 )
hace 4 años
Andrew Morgan
2e8955f4a6
Further improvements to requesting the public rooms list on a homeserver which has it set to private ( #7368 )
hace 4 años
Patrick Cloke
c2db6599c8
Fix a bug in the federation API which could cause occasional "Failed to get PDU" errors ( #7089 ).
hace 4 años
Patrick Cloke
7581d30e9f
Remove unused federation endpoint (`query_auth`) ( #7026 )
hace 4 años
Patrick Cloke
12d4259000
Add some type annotations to the federation base & client classes ( #6995 )
hace 4 años
Richard van der Hoff
928edef979
Pass room_version into `event_from_pdu_json`
It's called from all over the shop, so this one's a bit messy.
hace 4 años
Richard van der Hoff
b0c8bdd49d
pass room version into FederationClient.send_join ( #6854 )
... which allows us to sanity-check the create event.
hace 4 años
Richard van der Hoff
ee0525b2b2
Simplify `room_version` handling in `FederationClient.send_invite`
hace 4 años
Richard van der Hoff
f84700fba8
Pass room version object into `FederationClient.get_pdu`
hace 4 años
Richard van der Hoff
6bbd890f05
make FederationClient._do_send_invite async
hace 4 años
Richard van der Hoff
146fec0820
Apply suggestions from code review
Co-Authored-By: Erik Johnston <erik@matrix.org>
hace 4 años
Richard van der Hoff
ea23210b2d
make FederationClient.send_invite async
hace 4 años
Richard van der Hoff
6deeefb68c
make FederationClient.get_missing_events async
hace 4 años
Richard van der Hoff
abadf44eb2
make FederationClient._do_send_leave async
hace 4 años
Richard van der Hoff
e88b90aaeb
make FederationClient.send_leave.send_request async
hace 4 años
Richard van der Hoff
638001116d
make FederationClient._do_send_join async
hace 4 años
Richard van der Hoff
3960527c2e
make FederationClient.send_join.send_request async
hace 4 años
Richard van der Hoff
ad09ee9262
make FederationClient.make_membership_event.send_request async
hace 4 años
Richard van der Hoff
1330c311b7
make FederationClient._try_destination_list async
hace 4 años
Richard van der Hoff
a46fabf17b
make FederationClient.send_leave async
hace 4 años
Richard van der Hoff
8af9f11bea
make FederationClient.send_join async
hace 4 años
Richard van der Hoff
3f11cbb404
make FederationClient.make_membership_event async
hace 4 años
Richard van der Hoff
24d814ca23
make FederationClient.get_event_auth async
hace 4 años
Richard van der Hoff
d73683c363
make FederationClient.get_room_state_ids async
hace 4 años
Richard van der Hoff
0cb0c7bcd5
make FederationClient.get_pdu async
hace 4 años
Richard van der Hoff
0536d0c9be
make FederationClient.backfill async
hace 4 años
Richard van der Hoff
d7bf793cc1
s/get_room_version/get_room_version_id/
... to make way for a forthcoming get_room_version which returns a RoomVersion
object.
hace 4 años
Richard van der Hoff
54f3f369bd
Pass room_version into create_local_event_from_event_dict
hace 4 años
Erik Johnston
8df862e45d
Add `rooms.room_version` column ( #6729 )
This is so that we don't have to rely on pulling it out from `current_state_events` table.
hace 4 años
Richard van der Hoff
be294d6fde
Move get_state methods into FederationHandler ( #6503 )
This is a non-functional refactor as a precursor to some other work.
hace 4 años
Richard van der Hoff
4c7b1bb6cc
Refactor get_events_from_store_or_dest to return a dict ( #6501 )
There was a bunch of unnecessary conversion back and forth between dict and
list going on here. We can simplify a bunch of the code.
hace 4 años
Richard van der Hoff
f8bc2ae883
Move get_state methods into FederationHandler ( #6503 )
This is a non-functional refactor as a precursor to some other work.
hace 4 años
Richard van der Hoff
c3dda2874d
Refactor get_events_from_store_or_dest to return a dict ( #6501 )
There was a bunch of unnecessary conversion back and forth between dict and
list going on here. We can simplify a bunch of the code.
hace 4 años
Richard van der Hoff
e519489fc4
Remove fallback for missing /federation/v1/state_ids API ( #6488 )
This API was added way back in 0.17.0; the code here is annoying to maintain
and entirely redundant.
hace 4 años
Andrew Morgan
bc29a19731
Replace instance variations of homeserver with correct case/spacing
hace 4 años