From e924a76b4b563782601f846ae7c08d43fe8ec00f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20S=C3=B8borg?= Date: Sun, 28 Jan 2024 20:53:40 +0100 Subject: [PATCH] uploadRoomKeysToBackup: Use V3 route Fixes https://github.com/element-hq/hydrogen-web/issues/741 "Tested" locally by rewriting `r0` to `v3` in reverse proxy (Caddy) and seeing `All keys are backed up.` instead of repeated failing PUT requests towards Conduit (home server) ``` matrix.example.com { rewrite /_matrix/client/r0/room_keys/keys /_matrix/client/v3/room_keys/keys?{query} reverse_proxy /_matrix/* localhost:8448 } ``` --- src/matrix/net/HomeServerApi.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/matrix/net/HomeServerApi.ts b/src/matrix/net/HomeServerApi.ts index eebc692a..583f9f09 100644 --- a/src/matrix/net/HomeServerApi.ts +++ b/src/matrix/net/HomeServerApi.ts @@ -251,7 +251,8 @@ export class HomeServerApi { return this._get(`/room_keys/keys/${encodeURIComponent(roomId)}/${encodeURIComponent(sessionId)}`, {version}, undefined, options); } - uploadRoomKeysToBackup(version: string, payload: Record, options?: BaseRequestOptions): IHomeServerRequest { + uploadRoomKeysToBackup(version: string, payload: Record, options: BaseRequestOptions = {}): IHomeServerRequest { + options.prefix = CS_V3_PREFIX; return this._put(`/room_keys/keys`, {version}, payload, options); }