fix(dearrow): support DeArrow thumbnail submissions at 0 seconds (#1979)
This commit is contained in:
parent
77d08c5c28
commit
fd25b5f296
|
@ -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}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue