api/twitter: proxy thumbnails
Some checks are pending
Run tests / check lockfile correctness (push) Waiting to run
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run
Run tests / test service functionality (push) Waiting to run
Run tests / test service: ${{ matrix.service }} (push) Blocked by required conditions

This commit is contained in:
wukko 2024-08-22 13:38:16 +06:00
parent 07dc176024
commit 1064be6a7a
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -180,12 +180,21 @@ export default async function({ id, index, toGif, dispatcher }) {
isGif: media[0].type === "animated_gif"
}
default:
const proxyThumb = (url) =>
createStream({
service: "twitter",
type: "default",
u: url,
filename: `image.${new URL(url).pathname.split(".", 2)[1]}`
})
const picker = media.map((content, i) => {
if (content.type === "photo") {
let url = `${content.media_url_https}?name=4096x4096`;
return {
type: "photo",
url,
thumb: proxyThumb(url),
}
}
@ -207,7 +216,7 @@ export default async function({ id, index, toGif, dispatcher }) {
return {
type,
url,
thumb: content.media_url_https
thumb: proxyThumb(content.media_url_https),
}
});
return { picker };