mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-11 04:33:02 +02:00
Fix m->d encrypted files
This commit is contained in:
parent
d0ac5b58a7
commit
a05868f418
3 changed files with 10 additions and 7 deletions
|
@ -343,16 +343,20 @@ async function ping() {
|
|||
/**
|
||||
* @param {string} mxc
|
||||
* @param {RequestInit} [init]
|
||||
* @return {Promise<Response & {body: import("stream/web").ReadableStream<Uint8Array>}>}
|
||||
*/
|
||||
function getMedia(mxc, init = {}) {
|
||||
async function getMedia(mxc, init = {}) {
|
||||
const mediaParts = mxc?.match(/^mxc:\/\/([^/]+)\/(\w+)$/)
|
||||
assert(mediaParts)
|
||||
return fetch(`${mreq.baseUrl}/client/v1/media/download/${mediaParts[1]}/${mediaParts[2]}`, {
|
||||
const res = await fetch(`${mreq.baseUrl}/client/v1/media/download/${mediaParts[1]}/${mediaParts[2]}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${reg.as_token}`
|
||||
},
|
||||
...init
|
||||
})
|
||||
assert(res.body)
|
||||
// @ts-ignore
|
||||
return res
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue