mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-15 06:21:49 +01:00
Add option to allow anyone to use timestamp massaging
This commit is contained in:
parent
39fa6cc01d
commit
f279a43dc8
3 changed files with 15 additions and 3 deletions
|
@ -26,7 +26,9 @@ use the specific release tags.
|
|||
* Config option to allow specific users to send events without unnecessary
|
||||
validation.
|
||||
* Config option to allow specific users to receive events that are usually
|
||||
filtered away (e.g. `org.matrix.dummy_event` and `m.room.aliases`)
|
||||
filtered away (e.g. `org.matrix.dummy_event` and `m.room.aliases`).
|
||||
* Config option to allow specific users to use timestamp massaging without
|
||||
being appservice users.
|
||||
|
||||
## Configuration
|
||||
Generating a new config will include the `meow` section, but this is here for
|
||||
|
@ -42,4 +44,7 @@ meow:
|
|||
- "@you:example.com"
|
||||
# Whether or not the admin API should be able to register invalid user IDs.
|
||||
admin_api_register_invalid: true
|
||||
# List of users who can use timestamp massaging without being appservices
|
||||
timestamp_override:
|
||||
- "@you:example.com"
|
||||
```
|
||||
|
|
|
@ -27,6 +27,7 @@ class MeowConfig(Config):
|
|||
meow_config = config.get("meow", {})
|
||||
self.validation_override = set(meow_config.get("validation_override", []))
|
||||
self.filter_override = set(meow_config.get("filter_override", []))
|
||||
self.timestamp_override = set(meow_config.get("timestamp_override", []))
|
||||
self.admin_api_register_invalid = meow_config.get("admin_api_register_invalid", True)
|
||||
|
||||
def generate_config_section(self, config_dir_path, server_name, **kwargs):
|
||||
|
@ -40,6 +41,9 @@ class MeowConfig(Config):
|
|||
# # List of users who will get org.matrix.dummy_event and m.room.aliases events down /sync
|
||||
# filter_override:
|
||||
# - "@you:example.com"
|
||||
# # List of users who can use timestamp massaging without being appservices
|
||||
# timestamp_override:
|
||||
# - "@you:example.com"
|
||||
# # Whether or not the admin API should be able to register invalid user IDs.
|
||||
# admin_api_register_invalid: true
|
||||
"""
|
||||
|
|
|
@ -213,6 +213,7 @@ class RoomSendEventRestServlet(TransactionRestServlet):
|
|||
super().__init__(hs)
|
||||
self.event_creation_handler = hs.get_event_creation_handler()
|
||||
self.auth = hs.get_auth()
|
||||
self.hs = hs
|
||||
|
||||
def register(self, http_server):
|
||||
# /rooms/$roomid/send/$event_type[/$txn_id]
|
||||
|
@ -230,8 +231,10 @@ class RoomSendEventRestServlet(TransactionRestServlet):
|
|||
"sender": requester.user.to_string(),
|
||||
}
|
||||
|
||||
if b"ts" in request.args and requester.app_service:
|
||||
event_dict["origin_server_ts"] = parse_integer(request, "ts", 0)
|
||||
if b"ts" in request.args:
|
||||
if (requester.app_service
|
||||
or requester.user.to_string() in self.hs.config.meow.timestamp_override):
|
||||
event_dict["origin_server_ts"] = parse_integer(request, "ts", 0)
|
||||
|
||||
try:
|
||||
(
|
||||
|
|
Loading…
Reference in a new issue