mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-18 15:37:46 -04:00
Merge remote-tracking branch 'upstream/release-v1.71'
This commit is contained in:
commit
2337ca829d
135 changed files with 5192 additions and 2356 deletions
|
@ -77,6 +77,11 @@ class CapabilitiesRestServlet(RestServlet):
|
|||
"enabled": True,
|
||||
}
|
||||
|
||||
if self.config.experimental.msc3664_enabled:
|
||||
response["capabilities"]["im.nheko.msc3664.related_event_match"] = {
|
||||
"enabled": self.config.experimental.msc3664_enabled,
|
||||
}
|
||||
|
||||
return HTTPStatus.OK, response
|
||||
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ class DehydratedDeviceServlet(RestServlet):
|
|||
}
|
||||
}
|
||||
|
||||
PUT /org.matrix.msc2697/dehydrated_device
|
||||
PUT /org.matrix.msc2697.v2/dehydrated_device
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
|
@ -271,7 +271,6 @@ class DehydratedDeviceServlet(RestServlet):
|
|||
raise errors.NotFoundError("No dehydrated device available")
|
||||
|
||||
class PutBody(RequestBodyModel):
|
||||
device_id: StrictStr
|
||||
device_data: DehydratedDeviceDataModel
|
||||
initial_device_display_name: Optional[StrictStr]
|
||||
|
||||
|
@ -281,7 +280,7 @@ class DehydratedDeviceServlet(RestServlet):
|
|||
|
||||
device_id = await self.device_handler.store_dehydrated_device(
|
||||
requester.user.to_string(),
|
||||
submission.device_data,
|
||||
submission.device_data.dict(),
|
||||
submission.initial_device_display_name,
|
||||
)
|
||||
return 200, {"device_id": device_id}
|
||||
|
|
|
@ -436,8 +436,7 @@ class LoginRestServlet(RestServlet):
|
|||
The body of the JSON response.
|
||||
"""
|
||||
token = login_submission["token"]
|
||||
auth_handler = self.auth_handler
|
||||
res = await auth_handler.validate_short_term_login_token(token)
|
||||
res = await self.auth_handler.consume_login_token(token)
|
||||
|
||||
return await self._complete_login(
|
||||
res.user_id,
|
||||
|
|
|
@ -57,7 +57,6 @@ class LoginTokenRequestServlet(RestServlet):
|
|||
self.store = hs.get_datastores().main
|
||||
self.clock = hs.get_clock()
|
||||
self.server_name = hs.config.server.server_name
|
||||
self.macaroon_gen = hs.get_macaroon_generator()
|
||||
self.auth_handler = hs.get_auth_handler()
|
||||
self.token_timeout = hs.config.experimental.msc3882_token_timeout
|
||||
self.ui_auth = hs.config.experimental.msc3882_ui_auth
|
||||
|
@ -76,10 +75,10 @@ class LoginTokenRequestServlet(RestServlet):
|
|||
can_skip_ui_auth=False, # Don't allow skipping of UI auth
|
||||
)
|
||||
|
||||
login_token = self.macaroon_gen.generate_short_term_login_token(
|
||||
login_token = await self.auth_handler.create_login_token_for_user_id(
|
||||
user_id=requester.user.to_string(),
|
||||
auth_provider_id="org.matrix.msc3882.login_token_request",
|
||||
duration_in_ms=self.token_timeout,
|
||||
duration_ms=self.token_timeout,
|
||||
)
|
||||
|
||||
return (
|
||||
|
|
|
@ -110,6 +110,13 @@ class RoomBatchSendEventRestServlet(RestServlet):
|
|||
errcode=Codes.MISSING_PARAM,
|
||||
)
|
||||
|
||||
if await self.store.is_partial_state_room(room_id):
|
||||
raise SynapseError(
|
||||
HTTPStatus.BAD_REQUEST,
|
||||
"Cannot insert history batches until we have fully joined the room",
|
||||
errcode=Codes.UNABLE_DUE_TO_PARTIAL_STATE,
|
||||
)
|
||||
|
||||
# Verify the batch_id_from_query corresponds to an actual insertion event
|
||||
# and have the batch connected.
|
||||
if batch_id_from_query:
|
||||
|
|
|
@ -146,12 +146,12 @@ class SyncRestServlet(RestServlet):
|
|||
elif filter_id.startswith("{"):
|
||||
try:
|
||||
filter_object = json_decoder.decode(filter_id)
|
||||
set_timeline_upper_limit(
|
||||
filter_object, self.hs.config.server.filter_timeline_limit
|
||||
)
|
||||
except Exception:
|
||||
raise SynapseError(400, "Invalid filter JSON")
|
||||
raise SynapseError(400, "Invalid filter JSON", errcode=Codes.NOT_JSON)
|
||||
self.filtering.check_valid_filter(filter_object)
|
||||
set_timeline_upper_limit(
|
||||
filter_object, self.hs.config.server.filter_timeline_limit
|
||||
)
|
||||
filter_collection = FilterCollection(self.hs, filter_object)
|
||||
else:
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue