mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-15 20:38:46 -05:00
parent
dc016c66ae
commit
1d55c7b567
4 changed files with 34 additions and 11 deletions
|
|
@ -440,6 +440,7 @@ class RoomCreationHandler(BaseHandler):
|
|||
invite_list=[],
|
||||
initial_state=initial_state,
|
||||
creation_content=creation_content,
|
||||
ratelimit=False,
|
||||
)
|
||||
|
||||
# Transfer membership events
|
||||
|
|
@ -735,6 +736,7 @@ class RoomCreationHandler(BaseHandler):
|
|||
room_alias=room_alias,
|
||||
power_level_content_override=power_level_content_override,
|
||||
creator_join_profile=creator_join_profile,
|
||||
ratelimit=ratelimit,
|
||||
)
|
||||
|
||||
if "name" in config:
|
||||
|
|
@ -838,6 +840,7 @@ class RoomCreationHandler(BaseHandler):
|
|||
room_alias: Optional[RoomAlias] = None,
|
||||
power_level_content_override: Optional[JsonDict] = None,
|
||||
creator_join_profile: Optional[JsonDict] = None,
|
||||
ratelimit: bool = True,
|
||||
) -> int:
|
||||
"""Sends the initial events into a new room.
|
||||
|
||||
|
|
@ -884,7 +887,7 @@ class RoomCreationHandler(BaseHandler):
|
|||
creator.user,
|
||||
room_id,
|
||||
"join",
|
||||
ratelimit=False,
|
||||
ratelimit=ratelimit,
|
||||
content=creator_join_profile,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
|
|||
|
||||
# Only rate-limit if the user actually joined the room, otherwise we'll end
|
||||
# up blocking profile updates.
|
||||
if newly_joined:
|
||||
if newly_joined and ratelimit:
|
||||
time_now_s = self.clock.time()
|
||||
(
|
||||
allowed,
|
||||
|
|
@ -488,17 +488,20 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
|
|||
raise AuthError(403, "Guest access not allowed")
|
||||
|
||||
if not is_host_in_room:
|
||||
time_now_s = self.clock.time()
|
||||
(
|
||||
allowed,
|
||||
time_allowed,
|
||||
) = self._join_rate_limiter_remote.can_requester_do_action(requester,)
|
||||
|
||||
if not allowed:
|
||||
raise LimitExceededError(
|
||||
retry_after_ms=int(1000 * (time_allowed - time_now_s))
|
||||
if ratelimit:
|
||||
time_now_s = self.clock.time()
|
||||
(
|
||||
allowed,
|
||||
time_allowed,
|
||||
) = self._join_rate_limiter_remote.can_requester_do_action(
|
||||
requester,
|
||||
)
|
||||
|
||||
if not allowed:
|
||||
raise LimitExceededError(
|
||||
retry_after_ms=int(1000 * (time_allowed - time_now_s))
|
||||
)
|
||||
|
||||
inviter = await self._get_inviter(target.to_string(), room_id)
|
||||
if inviter and not self.hs.is_mine(inviter):
|
||||
remote_room_hosts.append(inviter.domain)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue