add authorization headers for downloads

master
Lauren Liberda 2021-05-17 21:54:27 +02:00
parent 8e1f9558f9
commit 1fb7da56a8
1 changed files with 6 additions and 0 deletions

View File

@ -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'],
},
},
);
}