const lsm = require("./lsm.js") function resolveMxc(url, size, method) { let [server, id] = url.match(/^mxc:\/\/([^/]+)\/(.*)/).slice(1) id = id.replace(/#.*$/, "") 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}` } } module.exports = {resolveMxc}