From 1fb7da56a86a44839fc0730baffbfb1016839b2b Mon Sep 17 00:00:00 2001 From: Lauren Liberda Date: Mon, 17 May 2021 21:54:27 +0200 Subject: [PATCH] add authorization headers for downloads --- src/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.ts b/src/index.ts index 92394e5..c1d6172 100644 --- a/src/index.ts +++ b/src/index.ts @@ -84,6 +84,9 @@ media.get( if (!FUCKED_UP_SERVERS.includes(serverName)) { file = await got.get(`${DEST_SERVER}/_matrix/media/r0/download/${serverName}/${mediaId}`, { responseType: 'buffer', + headers: { + Authorization: ctx.headers['authorization'], + }, }); if (file && file.statusCode === 200) { sendFile(file); @@ -133,6 +136,9 @@ media.get('/thumbnail/:serverName/:mediaId', async (ctx) => { `https://${remoteHost}/_matrix/media/r0/download/${serverName}/${mediaId}`, { responseType: 'buffer', + headers: { + Authorization: ctx.headers['authorization'], + }, }, ); }