Cadence Ember
ff196a64bb
All checks were successful
continuous-integration/drone/push Build is passing
- Refactor sender class into parts - Sender name colour depends on mxid, like Element - (colours slightly modified for contrast) - Display blank avatar if loading fails - Remove # parts from mxc - Don't replace member state if loaded state is older
13 lines
432 B
JavaScript
13 lines
432 B
JavaScript
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}
|