mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2025-06-28 07:58:25 +00:00
19 lines
471 B
JavaScript
19 lines
471 B
JavaScript
function proxyImage(url, width) {
|
|
const params = new URLSearchParams()
|
|
if (width) params.set("width", width)
|
|
params.set("url", url)
|
|
return "/imageproxy?"+params.toString()
|
|
}
|
|
|
|
/**
|
|
* @param {import("../types").ExtendedOwner} owner
|
|
*/
|
|
function proxyExtendedOwner(owner) {
|
|
const clone = {...owner}
|
|
clone.profile_pic_url = proxyImage(clone.profile_pic_url)
|
|
return clone
|
|
}
|
|
|
|
module.exports.proxyImage = proxyImage
|
|
module.exports.proxyExtendedOwner = proxyExtendedOwner
|