Avoid extra redirect with spee.ch images

I'm not sure what's the history behind splitting the logic between speech and non-speech, but currently, doing

`${thumbnail}?quality=${quality}&height=${height}&width=${width}`

will result in a redirect to

`${THUMBNAIL_CDN_URL}s:${width}:${height}/quality:80/plain/${thumbnail}` (hardcoded to 80).

That's the same CDN url we use for non-speech, so might as do the same for all images to avoid the redirect.
This commit is contained in:
infinite-persistence 2021-07-20 01:33:11 +08:00
parent 05f7e55aed
commit ed2b5ff1d7
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -19,11 +19,7 @@ export function getThumbnailCdnUrl(props: Props) {
return thumbnail;
}
if (thumbnail && !thumbnail.includes('https://spee.ch')) {
if (thumbnail) {
return `${THUMBNAIL_CDN_URL}s:${width}:${height}/quality:${quality}/plain/${thumbnail}`;
}
if (thumbnail && thumbnail.includes('https://spee.ch')) {
return `${thumbnail}?quality=${quality}&height=${height}&width=${width}`;
}
}