Merge pull request #151 from codemonium/decrypt-initial-dm

Decrypt initial message after joining new DM
This commit is contained in:
Hank Greenburg 2024-10-30 14:39:08 -07:00 committed by GitHub
commit a2a2d704ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View File

@ -795,6 +795,27 @@ class ProxyDaemon:
body=await response.read(),
)
async def createRoom(self, request):
try:
content = await request.json()
except (JSONDecodeError, ContentTypeError):
return self._not_json
invite = content.get("invite", ())
if invite:
access_token = self.get_access_token(request)
if not access_token:
return self._missing_token
client = await self._find_client(access_token)
if not client:
return self._unknown_token
client.users_for_key_query.update(invite)
return await self.forward_to_web(request)
async def messages(self, request):
access_token = self.get_access_token(request)

View File

@ -70,6 +70,8 @@ async def init(data_dir, server_conf, send_queue, recv_queue):
web.post("/_matrix/client/v3/login", proxy.login),
web.get("/_matrix/client/r0/sync", proxy.sync),
web.get("/_matrix/client/v3/sync", proxy.sync),
web.post("/_matrix/client/r0/createRoom", proxy.createRoom),
web.post("/_matrix/client/v3/createRoom", proxy.createRoom),
web.get("/_matrix/client/r0/rooms/{room_id}/messages", proxy.messages),
web.get("/_matrix/client/v3/rooms/{room_id}/messages", proxy.messages),
web.put(