Allow specific users to use timestamp massaging without being appservices

This commit is contained in:
Tulir Asokan 2023-02-12 15:02:25 +02:00
parent 3108b67232
commit de89885d15

View File

@ -337,6 +337,7 @@ class RoomSendEventRestServlet(TransactionRestServlet):
super().__init__(hs) super().__init__(hs)
self.event_creation_handler = hs.get_event_creation_handler() self.event_creation_handler = hs.get_event_creation_handler()
self.auth = hs.get_auth() self.auth = hs.get_auth()
self.hs = hs
def register(self, http_server: HttpServer) -> None: def register(self, http_server: HttpServer) -> None:
# /rooms/$roomid/send/$event_type[/$txn_id] # /rooms/$roomid/send/$event_type[/$txn_id]
@ -360,7 +361,10 @@ class RoomSendEventRestServlet(TransactionRestServlet):
"sender": requester.user.to_string(), "sender": requester.user.to_string(),
} }
if requester.app_service: if (
requester.app_service
or requester.user.to_string() in self.hs.config.meow.timestamp_override
):
origin_server_ts = parse_integer(request, "ts") origin_server_ts = parse_integer(request, "ts")
if origin_server_ts is not None: if origin_server_ts is not None:
event_dict["origin_server_ts"] = origin_server_ts event_dict["origin_server_ts"] = origin_server_ts