2020-01-18 15:38:14 +00:00
|
|
|
function proxyImage(url, width) {
|
2020-01-14 14:38:33 +00:00
|
|
|
const params = new URLSearchParams()
|
2020-01-18 15:38:14 +00:00
|
|
|
if (width) params.set("width", width)
|
2020-01-14 14:38:33 +00:00
|
|
|
params.set("url", url)
|
|
|
|
return "/imageproxy?"+params.toString()
|
|
|
|
}
|
|
|
|
|
2020-01-26 14:56:59 +00:00
|
|
|
/**
|
|
|
|
* @param {import("../types").ExtendedOwner} owner
|
|
|
|
*/
|
|
|
|
function proxyExtendedOwner(owner) {
|
|
|
|
const clone = {...owner}
|
|
|
|
clone.profile_pic_url = proxyImage(clone.profile_pic_url)
|
|
|
|
return clone
|
|
|
|
}
|
|
|
|
|
2020-01-14 14:38:33 +00:00
|
|
|
module.exports.proxyImage = proxyImage
|
2020-01-26 14:56:59 +00:00
|
|
|
module.exports.proxyExtendedOwner = proxyExtendedOwner
|