diff options
author | Rafael Gonçalves <8217676+RafaelGoncalves8@users.noreply.github.com> | 2021-10-28 14:54:38 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 18:54:38 +0100 |
commit | 0e16b418f6835c7a2a9aae4637b0a9f2ca47f518 (patch) | |
tree | 3986bbaabb181e2b76be0f4190dde562feac1749 /synapse/app | |
parent | Fetch verify key locally rather than trying to do so over federation if origi... (diff) | |
download | synapse-0e16b418f6835c7a2a9aae4637b0a9f2ca47f518.tar.xz |
Add knock information in admin exported data (#11171)
Signed-off-by: Rafael Goncalves <rafaelgoncalves@riseup.net>
Diffstat (limited to 'synapse/app')
-rw-r--r-- | synapse/app/admin_cmd.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/app/admin_cmd.py b/synapse/app/admin_cmd.py index 2fc848596d..ad20b1d6aa 100644 --- a/synapse/app/admin_cmd.py +++ b/synapse/app/admin_cmd.py @@ -145,6 +145,20 @@ class FileExfiltrationWriter(ExfiltrationWriter): for event in state.values(): print(json.dumps(event), file=f) + def write_knock(self, room_id, event, state): + self.write_events(room_id, [event]) + + # We write the knock state somewhere else as they aren't full events + # and are only a subset of the state at the event. + room_directory = os.path.join(self.base_directory, "rooms", room_id) + os.makedirs(room_directory, exist_ok=True) + + knock_state = os.path.join(room_directory, "knock_state") + + with open(knock_state, "a") as f: + for event in state.values(): + print(json.dumps(event), file=f) + def finished(self): return self.base_directory |