diff --git a/src/matrix/net/HomeServerApi.js b/src/matrix/net/HomeServerApi.js index 81da33d1..1f2acab4 100644 --- a/src/matrix/net/HomeServerApi.js +++ b/src/matrix/net/HomeServerApi.js @@ -220,6 +220,10 @@ export class HomeServerApi { roomKeyForRoomAndSession(version, roomId, sessionId, options = null) { return this._get(`/room_keys/keys/${encodeURIComponent(roomId)}/${encodeURIComponent(sessionId)}`, {version}, null, options); } + + uploadAttachment(blob, filename, options = null) { + return this._post("/upload", {filename}, blob, options); + } } export function tests() { diff --git a/src/matrix/net/MediaRepository.js b/src/matrix/net/MediaRepository.js index 8ab37a87..2e7ec438 100644 --- a/src/matrix/net/MediaRepository.js +++ b/src/matrix/net/MediaRepository.js @@ -72,11 +72,4 @@ export class MediaRepository { return this.downloadPlaintextFile(content.url, content.info?.mimetype, cache); } } - - async upload(bufferHandle, filename) { - const url = `${this._homeServer}/_matrix/media/r0/upload?filename=${encodeURIComponent(filename)}`; - // TODO: body doesn't take a bufferHandle currently - const {content_uri} = await this._platform.request(url, {method: "POST", body: bufferHandle}).response(); - return content_uri; - } }