Compare commits

..

No commits in common. "a66b93ed2625dacf7cb5f24191c1baa2f8f7fdf2" and "5a853249a295ecc2e6a0ce9a7f0df87811872bc1" have entirely different histories.

2 changed files with 3 additions and 13 deletions

View file

@ -39,20 +39,14 @@ async function resolvePendingFiles(message) {
if ("key" in p) { if ("key" in p) {
// Encrypted file // Encrypted file
const d = crypto.createDecipheriv("aes-256-ctr", Buffer.from(p.key, "base64url"), Buffer.from(p.iv, "base64url")) const d = crypto.createDecipheriv("aes-256-ctr", Buffer.from(p.key, "base64url"), Buffer.from(p.iv, "base64url"))
await api.getMedia(p.mxc).then(res => stream.Readable.fromWeb( await api.getMedia(p.mxc).then(res => stream.Readable.fromWeb(res.body).pipe(d))
// @ts-ignore
res.body
).pipe(d))
return { return {
name: p.name, name: p.name,
file: d file: d
} }
} else { } else {
// Unencrypted file // Unencrypted file
const body = await api.getMedia(p.mxc).then(res => stream.Readable.fromWeb( const body = await api.getMedia(p.mxc).then(res => stream.Readable.fromWeb(res.body))
// @ts-ignore
res.body
))
return { return {
name: p.name, name: p.name,
file: body file: body

View file

@ -156,12 +156,8 @@ async function sendError(roomID, source, type, e, payload) {
} catch (e) {} } catch (e) {}
} }
/**
* @param {string} type
* @param {(event: any, ...args: any)=>any} fn
*/
function guard(type, fn) { function guard(type, fn) {
return async function(/** @type {Ty.Event.Outer<any>} */ event, /** @type {any} */ ...args) { return async function(event, ...args) {
try { try {
return await fn(event, ...args) return await fn(event, ...args)
} catch (e) { } catch (e) {