fix(dearrow): support DeArrow thumbnail submissions at 0 seconds (#1979)

This commit is contained in:
Ajay Ramachandran 2023-11-12 15:33:34 -05:00 committed by Luna
parent 05eba3303e
commit 6e593ad3cb

View file

@ -50,7 +50,7 @@ async function embedDidMount(this: Component<Props>) {
const { titles, thumbnails } = await res.json(); const { titles, thumbnails } = await res.json();
const hasTitle = titles[0]?.votes >= 0; const hasTitle = titles[0]?.votes >= 0;
const hasThumb = thumbnails[0]?.votes >= 0; const hasThumb = thumbnails[0]?.votes >= 0 && !thumbnails[0].original;
if (!hasTitle && !hasThumb) return; if (!hasTitle && !hasThumb) return;
@ -58,12 +58,12 @@ async function embedDidMount(this: Component<Props>) {
enabled: true enabled: true
}; };
if (titles[0]?.votes >= 0) { if (hasTitle) {
embed.dearrow.oldTitle = embed.rawTitle; embed.dearrow.oldTitle = embed.rawTitle;
embed.rawTitle = titles[0].title; embed.rawTitle = titles[0].title;
} }
if (thumbnails[0]?.votes >= 0 && thumbnails[0].timestamp) { if (hasThumb) {
embed.dearrow.oldThumb = embed.thumbnail.proxyURL; embed.dearrow.oldThumb = embed.thumbnail.proxyURL;
embed.thumbnail.proxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`; embed.thumbnail.proxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`;
} }