client/posts: skip thumbnail placeholder if fullsize image is in cache

This commit is contained in:
Eva
2025-04-01 02:36:20 +02:00
parent 289f8a87be
commit 14a4386561
4 changed files with 18 additions and 3 deletions

View File

@ -211,6 +211,15 @@ function getPrettyName(tag) {
return tag;
}
function isMediaCached(post) {
if (post.type !== "image") {
return false;
}
const img = new Image()
img.src = post.contentUrl;
return img.complete;
}
module.exports = {
range: range,
formatRelativeTime: formatRelativeTime,
@ -229,4 +238,5 @@ module.exports = {
escapeSearchTerm: escapeSearchTerm,
dataURItoBlob: dataURItoBlob,
getPrettyName: getPrettyName,
isMediaCached: isMediaCached,
};