buh
This commit is contained in:
parent
aa7caab9d3
commit
c766c245ec
1 changed files with 10 additions and 3 deletions
|
@ -100,11 +100,18 @@ function proxy(url) {
|
||||||
if (!process.env.IMGPROXY_HOST)
|
if (!process.env.IMGPROXY_HOST)
|
||||||
return url;
|
return url;
|
||||||
|
|
||||||
|
const auth = {};
|
||||||
|
if (process.env.IMGPROXY_SALT && process.env.IMGPROXY_KEY) {
|
||||||
|
Object.assign(auth, {
|
||||||
|
salt: process.env.IMGPROXY_SALT,
|
||||||
|
key: process.env.IMGPROXY_KEY
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
url = generateImageUrl({
|
url = generateImageUrl({
|
||||||
endpoint: process.env.IMGPROXY_HOST,
|
endpoint: process.env.IMGPROXY_HOST,
|
||||||
url: url,
|
url: url,
|
||||||
salt: process.env.IMGPROXY_SALT,
|
...auth
|
||||||
key: process.env.IMGPROXY_KEY
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
|
@ -160,7 +167,7 @@ module.exports = {
|
||||||
.setTitle(`Post #${post.id}`)
|
.setTitle(`Post #${post.id}`)
|
||||||
.setURL(post.postView)
|
.setURL(post.postView)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setImage(post.fileUrl)
|
.setImage(proxy(post.fileUrl))
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: footerText,
|
text: footerText,
|
||||||
iconURL: proxy(`https://${post.booru.domain}/favicon.ico`),
|
iconURL: proxy(`https://${post.booru.domain}/favicon.ico`),
|
||||||
|
|
Loading…
Reference in a new issue