Skip to content

Commit

Permalink
Merge pull request #151 from codemonium/decrypt-initial-dm
Browse files Browse the repository at this point in the history
Decrypt initial message after joining new DM
  • Loading branch information
chookity-pokk authored Oct 30, 2024
2 parents 6d88b8a + a82652f commit a2a2d70
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pantalaimon/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,27 @@ async def sync(self, request):
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)

Expand Down
2 changes: 2 additions & 0 deletions pantalaimon/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a2a2d70

Please sign in to comment.