diff --git a/apps/infoalloggi/src/components/annunci_map.tsx b/apps/infoalloggi/src/components/annunci_map.tsx index 5338bd6..2b5ed63 100644 --- a/apps/infoalloggi/src/components/annunci_map.tsx +++ b/apps/infoalloggi/src/components/annunci_map.tsx @@ -123,7 +123,7 @@ const SelectedComp = memo( alt="a" className="size-24 rounded-md object-cover sm:size-40" height={500} - src={`/storage-api/get/${selected.images[0].img}?image=true&${selected.media_updated_at?.toString() || new Date().toString()}`} + src={`/storage-api/get/${selected.images[0].img}?image=true&cachekey=${selected?.toString()}`} width={500} /> ) : ( diff --git a/apps/infoalloggi/src/components/annuncio_card.tsx b/apps/infoalloggi/src/components/annuncio_card.tsx index 7f1130d..6eba68e 100644 --- a/apps/infoalloggi/src/components/annuncio_card.tsx +++ b/apps/infoalloggi/src/components/annuncio_card.tsx @@ -217,14 +217,14 @@ export const CardAnnuncio = ({ @@ -240,13 +240,10 @@ export const CardAnnuncio = ({ }} > ); @@ -278,11 +275,11 @@ export const CardAnnuncio = ({ {images && images.length > 0 && images[0] ? ( ) : ( @@ -423,7 +420,7 @@ export const CarouselAnnuncio = ({ height={400} onClick={() => handleOpenModal(idx)} priority={idx === 0} - src={`/storage-api/get/${img.img}?image=true&${updated_at?.toString() || new Date().toString()}`} + src={`/storage-api/get/${img.img}?image=true&cachekey=${updated_at?.toString()}`} width={800} /> @@ -501,10 +497,9 @@ export const CarouselAnnuncio = ({ key={`carousel-videoplayer-${video.video}`} > ); diff --git a/apps/infoalloggi/src/components/servizio/annuncio_card.tsx b/apps/infoalloggi/src/components/servizio/annuncio_card.tsx index f679a2b..08c0bb2 100644 --- a/apps/infoalloggi/src/components/servizio/annuncio_card.tsx +++ b/apps/infoalloggi/src/components/servizio/annuncio_card.tsx @@ -58,7 +58,7 @@ export const BasicAnnuncioCard = ({ priority src={ (data?.images[0] && - `/storage-api/get/${data.images[0].img}?image=true&${data.media_updated_at?.toString() || new Date().toISOString()}`) || + `/storage-api/get/${data.images[0].img}?image=true&cachekey=${data.media_updated_at?.toString()}`) || "/fallback-image.png" } width={1920} diff --git a/apps/infoalloggi/src/components/videoPlayer.tsx b/apps/infoalloggi/src/components/videoPlayer.tsx index 3de4f2f..b4c445a 100644 --- a/apps/infoalloggi/src/components/videoPlayer.tsx +++ b/apps/infoalloggi/src/components/videoPlayer.tsx @@ -12,7 +12,6 @@ interface VideoPlayerProps { title?: string; aspectRatio?: "square" | "video" | "vertical"; className?: string; - cacheKey: string; } export function VideoPlayer({ @@ -21,7 +20,6 @@ export function VideoPlayer({ title, aspectRatio = "video", className, - cacheKey, }: VideoPlayerProps) { const [isPlaying, setIsPlaying] = useState(false); const videoRef = useRef(null); @@ -64,7 +62,7 @@ export function VideoPlayer({ className="object-cover" fill priority - src={`${coverImage}?${cacheKey}` || "/fallback-video.png"} + src={coverImage || "/fallback-video.png"} />
setIsPlaying(false)} - src={`${videoSrc}?${cacheKey}`} + src={videoSrc} > Your browser does not support the video tag. diff --git a/apps/infoalloggi/src/pages/annuncio/[cod].tsx b/apps/infoalloggi/src/pages/annuncio/[cod].tsx index 9d4cee4..fd170f6 100644 --- a/apps/infoalloggi/src/pages/annuncio/[cod].tsx +++ b/apps/infoalloggi/src/pages/annuncio/[cod].tsx @@ -630,11 +630,10 @@ const AnnuncioFooter = ({ {videos.map((video) => { return ( ); })} diff --git a/apps/infoalloggi/src/server/controllers/annunci.controller.ts b/apps/infoalloggi/src/server/controllers/annunci.controller.ts index d626725..7df8d26 100644 --- a/apps/infoalloggi/src/server/controllers/annunci.controller.ts +++ b/apps/infoalloggi/src/server/controllers/annunci.controller.ts @@ -101,7 +101,12 @@ export const getAnnunciMetaByCod = async ({ cod }: { cod: string }) => { try { const annuncio = await db .selectFrom("annunci") - .select((_eb) => ["titolo_it", "desc_it", withImages()]) + .select((_eb) => [ + "titolo_it", + "desc_it", + withImages(), + "media_updated_at", + ]) .where("annunci.web", "=", true) .where("codice", "=", cod) .executeTakeFirst(); @@ -110,7 +115,7 @@ export const getAnnunciMetaByCod = async ({ cod }: { cod: string }) => { } const ogImage = annuncio.images && annuncio.images.length > 0 && annuncio.images[0] - ? `${env.BASE_URL}/storage-api/get/${annuncio.images[0].img}?image=true` + ? `${env.BASE_URL}/storage-api/get/${annuncio.images[0].img}?image=true&cachekey=${annuncio.media_updated_at?.toString()}` : `${env.BASE_URL}/og.jpg`; return {