diff options
author | Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> | 2023-02-17 14:54:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-17 13:54:55 +0000 |
commit | 61bfcd669ae596a8df940f434e3e2335059100b1 (patch) | |
tree | 8850b7a471114128422acf2ab7e785e3eae079f9 /synapse/app/admin_cmd.py | |
parent | Mitigate a race where /make_join could 403 for restricted rooms (#15080) (diff) | |
download | synapse-61bfcd669ae596a8df940f434e3e2335059100b1.tar.xz |
Add account data to export command (#14969)
* Add account data to to export command * newsfile * remove not needed function * update newsfile * adopt #14973
Diffstat (limited to 'synapse/app/admin_cmd.py')
-rw-r--r-- | synapse/app/admin_cmd.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/synapse/app/admin_cmd.py b/synapse/app/admin_cmd.py index fe7afb9475..ad51f33165 100644 --- a/synapse/app/admin_cmd.py +++ b/synapse/app/admin_cmd.py @@ -17,7 +17,7 @@ import logging import os import sys import tempfile -from typing import List, Optional +from typing import List, Mapping, Optional from twisted.internet import defer, task @@ -222,6 +222,19 @@ class FileExfiltrationWriter(ExfiltrationWriter): with open(connection_file, "a") as f: print(json.dumps(connection), file=f) + def write_account_data( + self, file_name: str, account_data: Mapping[str, JsonDict] + ) -> None: + account_data_directory = os.path.join( + self.base_directory, "user_data", "account_data" + ) + os.makedirs(account_data_directory, exist_ok=True) + + account_data_file = os.path.join(account_data_directory, file_name) + + with open(account_data_file, "a") as f: + print(json.dumps(account_data), file=f) + def finished(self) -> str: return self.base_directory |