Carbon/src/js/functions.js
Cadence Ember 4855b2c6a0
All checks were successful
continuous-integration/drone/push Build is passing
Update build script for relative paths everywhere
2020-10-20 23:25:26 +13:00

12 lines
410 B
JavaScript

import * as lsm from $to_relative "/js/lsm.js"
function resolveMxc(url, size, method) {
const [server, id] = url.match(/^mxc:\/\/([^/]+)\/(.*)/).slice(1)
if (size && method) {
return `${lsm.get("domain")}/_matrix/media/r0/thumbnail/${server}/${id}?width=${size}&height=${size}&method=${method}`
} else {
return `${lsm.get("domain")}/_matrix/media/r0/download/${server}/${id}`
}
}
export {resolveMxc}