force loading images with https

This commit is contained in:
john 2025-05-20 11:22:59 +02:00
parent 76843ba7e8
commit bc2a15bc40

View file

@ -53,14 +53,19 @@ interface PostMediaProps {
} }
function PostMediaItem({ media }: PostMediaProps) { function PostMediaItem({ media }: PostMediaProps) {
const url = media.url.toString() const url = new URL(media.url.toString())
if (location.protocol === 'https:' && url.protocol !== 'https:') {
url.protocol = 'https:'
}
const width = media.width ?? undefined const width = media.width ?? undefined
const height = media.height ?? undefined const height = media.height ?? undefined
return ( return (
<img <img
width={width} width={width}
height={height} height={height}
src={url} src={url.toString()}
alt="todo sry :(" alt="todo sry :("
className="w-full h-auto" className="w-full h-auto"
loading="lazy" loading="lazy"