Images : retour au chargement habituel (affiches cassées sur iPhone)
deploy / deploy (push) Successful in 44s
deploy / deploy (push) Successful in 44s
Les images TMDB / AniList étaient demandées en mode CORS (crossOrigin) depuis 425bff8. Sur iPhone, les
affiches déjà en mémoire, reçues sans en-tête CORS, étaient alors refusées : bannière, affiches et vignettes
vides. Retour à l'ancien fonctionnement (caches posters / backdrops, réponses opaques acceptées) ;
les caches posters-v2 / backdrops-v2 de l'essai sont supprimés au lancement.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
14 files changed
+24
-44
No files matched your search
@@ -62,14 +62,14 @@ npm run build # build de prod
|
|||||||
- RTL géré (arabe) : préférer les classes logiques (`ps-`/`pe-`, `ms-`/`me-`, `start-`/`end-`, `border-e`).
|
- RTL géré (arabe) : préférer les classes logiques (`ps-`/`pe-`, `ms-`/`me-`, `start-`/`end-`, `border-e`).
|
||||||
- **Dates et nombres** : `dateFormat(opts).format(d)` / `numberFormat(opts)` / `fmtNumber` (`src/i18n`), formateurs gardés en mémoire — jamais `toLocaleDateString` ni `new Intl.*` dans un rendu (lent sur les longues listes).
|
- **Dates et nombres** : `dateFormat(opts).format(d)` / `numberFormat(opts)` / `fmtNumber` (`src/i18n`), formateurs gardés en mémoire — jamais `toLocaleDateString` ni `new Intl.*` dans un rendu (lent sur les longues listes).
|
||||||
- **Store** : un composant qui ne fait qu'agir (cocher, ajouter…) prend `useMediaActions()` (fonctions stables, ne se redessine pas quand la bibliothèque change) ; l'état de la synchro, c'est `useSyncStatus()`. `useMedia()` seulement pour lire les fiches / réglages. Les écrans principaux (`HomePage`, `CatalogPage`, `SelectableCard`, `MediaCard`) sont mémorisés : leur passer des fonctions stables (`useCallback` dans `App.tsx`).
|
- **Store** : un composant qui ne fait qu'agir (cocher, ajouter…) prend `useMediaActions()` (fonctions stables, ne se redessine pas quand la bibliothèque change) ; l'état de la synchro, c'est `useSyncStatus()`. `useMedia()` seulement pour lire les fiches / réglages. Les écrans principaux (`HomePage`, `CatalogPage`, `SelectableCard`, `MediaCard`) sont mémorisés : leur passer des fonctions stables (`useCallback` dans `App.tsx`).
|
||||||
- **Images** : toute `<img>` qui peut afficher une image TMDB / AniList prend `crossOrigin={imgCors(src)}` (`src/lib/tmdbImage.ts`) ; sinon le service worker n'en garde pas de copie (les copies « opaques » comptaient ~7 Mo de quota chacune). Pas d'effet de flou (`backdrop-blur`) sur les barres fixes : coûteux au défilement sur téléphone.
|
- **Images** : ne PAS ajouter `crossOrigin` aux `<img>` TMDB / AniList. Essayé le 29/11/2026 (pour réduire le quota compté par Chrome) : sur iPhone, les affiches déjà en mémoire, reçues sans en-tête CORS, ne s'affichaient plus du tout. Annulé le soir même. Pas d'effet de flou (`backdrop-blur`) sur les barres fixes : coûteux au défilement sur téléphone.
|
||||||
- **Appels aux données publiques** (proxy TMDB, notes Trakt) : `publicFetch` dans `cloud/api.ts`, sans aucun en-tête → pas de pré-requête CORS (un aller-retour au lieu de deux). Limite côté serveur par adresse IP (tmdb 1000, ratings 400 / 10 min). Les données perso restent sur `cloudFetch` (jeton).
|
- **Appels aux données publiques** (proxy TMDB, notes Trakt) : `publicFetch` dans `cloud/api.ts`, sans aucun en-tête → pas de pré-requête CORS (un aller-retour au lieu de deux). Limite côté serveur par adresse IP (tmdb 1000, ratings 400 / 10 min). Les données perso restent sur `cloudFetch` (jeton).
|
||||||
|
|
||||||
## État (au 28 nov. 2026)
|
## État (au 28 nov. 2026)
|
||||||
- **Toutes les migrations de `supabase/migrations/` sont appliquées en ligne**, jusqu'à `20261129210000_drop_azuu_backup.sql` incluse (pg_net supprimée, index des notifications revus, réserve des notes Trakt ; notifications aux abonnés en une requête, quota vérifié une fois par envoi (trigger `*_quota_stmt`), fiche renvoyée à l'identique non réécrite).
|
- **Toutes les migrations de `supabase/migrations/` sont appliquées en ligne**, jusqu'à `20261129210000_drop_azuu_backup.sql` incluse (pg_net supprimée, index des notifications revus, réserve des notes Trakt ; notifications aux abonnés en une requête, quota vérifié une fois par envoi (trigger `*_quota_stmt`), fiche renvoyée à l'identique non réécrite).
|
||||||
- **29 nov. 2026** : 123 avis du compte de Romain contenaient « Réalisation : … » (ancien import, `legacyImport.ts`, corrigé). Lignes retirées en base (la copie de sauvegarde a été supprimée le même jour, correction validée).
|
- **29 nov. 2026** : 123 avis du compte de Romain contenaient « Réalisation : … » (ancien import, `legacyImport.ts`, corrigé). Lignes retirées en base (la copie de sauvegarde a été supprimée le même jour, correction validée).
|
||||||
- **Affiches** : une fiche garde l'**adresse** de l'affiche (TMDB w342 / AniList), jamais l'image copiée en base64 (≈ 50 Ko par fiche, renvoyés à chaque modification et chez les amis). Seule une image choisie dans la galerie (EditDetails, 360 px) est intégrée. Le 29 nov. 2026, 109 affiches intégrées (342 px, copies automatiques) ont été remplacées par leur adresse TMDB : base des fiches 5,95 Mo → 267 Ko.
|
- **Affiches** : une fiche garde l'**adresse** de l'affiche (TMDB w342 / AniList), jamais l'image copiée en base64 (≈ 50 Ko par fiche, renvoyés à chaque modification et chez les amis). Seule une image choisie dans la galerie (EditDetails, 360 px) est intégrée. Le 29 nov. 2026, 109 affiches intégrées (342 px, copies automatiques) ont été remplacées par leur adresse TMDB : base des fiches 5,95 Mo → 267 Ko.
|
||||||
- **Cache (service worker, `vite.config.ts`)** : pré-téléchargement ~1 Mo (app + français). Les 17 autres langues (`assets/locale-*`), l'admin (`assets/admin-*`) et les variantes de police sont mises en cache à la demande (`app-files`). Caches d'exécution : `posters-v2` (petites images TMDB/AniList, 1500), `backdrops-v2` (grandes images, 80) — réponses 200 seulement (images en mode CORS) ; les anciens `posters` / `backdrops` sont supprimés au lancement (`main.tsx`), `catalog` (fiches TMDB avec `append_to_response`, saisons, personnes, notes Trakt : StaleWhileRevalidate 14 j ; jamais `/tv/123` seul, recherche, sorties ni données perso). React est dans son propre fichier (`react-*.js`), gardé d'une version à l'autre.
|
- **Cache (service worker, `vite.config.ts`)** : pré-téléchargement ~1 Mo (app + français). Les 17 autres langues (`assets/locale-*`), l'admin (`assets/admin-*`) et les variantes de police sont mises en cache à la demande (`app-files`). Caches d'exécution : `posters` (petites images TMDB/AniList, 1500), `backdrops` (grandes images, 80) — réponses opaques acceptées (`posters-v2` / `backdrops-v2`, d'un essai abandonné, sont supprimés au lancement par `main.tsx`), `catalog` (fiches TMDB avec `append_to_response`, saisons, personnes, notes Trakt : StaleWhileRevalidate 14 j ; jamais `/tv/123` seul, recherche, sorties ni données perso). React est dans son propre fichier (`react-*.js`), gardé d'une version à l'autre.
|
||||||
- **Chargés à la demande** (préchargés au repos par `preloadScreens`, gardés par le service worker) : fiche d'un titre (`TitleSheet`), recherche d'ajout (`AddTitle`), onglets Journal / Listes, listes partagées, assistant d'import (`ImportWizard`), dessin des cartes de partage (`shareCard` ; `shareImage.ts` reste léger), convertisseur des anciennes sauvegardes (`legacyImport`). Garder les petits composants partagés dans leur propre fichier (ex. `NewListForm.tsx`) : un import direct depuis un écran à la demande le ramène dans le fichier principal.
|
- **Chargés à la demande** (préchargés au repos par `preloadScreens`, gardés par le service worker) : fiche d'un titre (`TitleSheet`), recherche d'ajout (`AddTitle`), onglets Journal / Listes, listes partagées, assistant d'import (`ImportWizard`), dessin des cartes de partage (`shareCard` ; `shareImage.ts` reste léger), convertisseur des anciennes sauvegardes (`legacyImport`). Garder les petits composants partagés dans leur propre fichier (ex. `NewListForm.tsx`) : un import direct depuis un écran à la demande le ramène dans le fichier principal.
|
||||||
- **Note Trakt** (`getPublicRatings` / `cachedPublicRatings` dans `catalogApi.ts`) : à part du reste de la fiche, gardée sur l'appareil (`azuucine:ratings`, 800 titres, rafraîchie après 2 jours) → affichage immédiat. Premier chargement : place réservée sans chiffre provisoire.
|
- **Note Trakt** (`getPublicRatings` / `cachedPublicRatings` dans `catalogApi.ts`) : à part du reste de la fiche, gardée sur l'appareil (`azuucine:ratings`, 800 titres, rafraîchie après 2 jours) → affichage immédiat. Premier chargement : place réservée sans chiffre provisoire.
|
||||||
- **Épisodes d'une saison** (`getTmdbSeasonEpisodes` / `cachedSeasonEpisodes`) : gardés sur l'appareil (`azuucine:seasons`, budget 400 Ko, rafraîchis après 12 h) ; images autour du prochain épisode chargées tout de suite (`episodeWindow`, `preloadImages`).
|
- **Épisodes d'une saison** (`getTmdbSeasonEpisodes` / `cachedSeasonEpisodes`) : gardés sur l'appareil (`azuucine:seasons`, budget 400 Ko, rafraîchis après 12 h) ; images autour du prochain épisode chargées tout de suite (`episodeWindow`, `preloadImages`).
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'react'
|
|||||||
import { dateFormat, t } from '../i18n'
|
import { dateFormat, t } from '../i18n'
|
||||||
import { cachedSeasonEpisodes, episodeWindow, getTmdbSeasonEpisodes, preloadImages, type EpisodeInfo } from '../lib/catalogApi'
|
import { cachedSeasonEpisodes, episodeWindow, getTmdbSeasonEpisodes, preloadImages, type EpisodeInfo } from '../lib/catalogApi'
|
||||||
import { episodeCap, episodesBeforeSeason, seasonPosition } from '../lib/franchise'
|
import { episodeCap, episodesBeforeSeason, seasonPosition } from '../lib/franchise'
|
||||||
import { tmdbSized, imgCors } from '../lib/tmdbImage'
|
import { tmdbSized } from '../lib/tmdbImage'
|
||||||
import { cx, todayISO } from '../lib/utils'
|
import { cx, todayISO } from '../lib/utils'
|
||||||
import { useMedia } from '../store'
|
import { useMedia } from '../store'
|
||||||
import type { MediaInput } from '../types'
|
import type { MediaInput } from '../types'
|
||||||
@@ -144,11 +144,11 @@ export default function EpisodeList({ form, aired, onChange, fallbackImage }: Pr
|
|||||||
>
|
>
|
||||||
<span className="relative aspect-video w-28 shrink-0 overflow-hidden rounded-lg border border-line bg-surface-2">
|
<span className="relative aspect-video w-28 shrink-0 overflow-hidden rounded-lg border border-line bg-surface-2">
|
||||||
{e.still ? (
|
{e.still ? (
|
||||||
<img src={e.still} crossOrigin={imgCors(e.still)} alt="" loading={visible.has(e.number) ? 'eager' : 'lazy'} decoding="async" className="size-full object-cover" />
|
<img src={e.still} alt="" loading={visible.has(e.number) ? 'eager' : 'lazy'} decoding="async" className="size-full object-cover" />
|
||||||
) : fallbackImage ? (
|
) : fallbackImage ? (
|
||||||
// Pas d'image pour cet épisode : celle de la série, assombrie, avec le numéro par-dessus
|
// Pas d'image pour cet épisode : celle de la série, assombrie, avec le numéro par-dessus
|
||||||
<>
|
<>
|
||||||
<img src={tmdbSized(fallbackImage, 'w300')} crossOrigin={imgCors(tmdbSized(fallbackImage, 'w300'))} alt="" loading="lazy" decoding="async" className="size-full object-cover" />
|
<img src={tmdbSized(fallbackImage, 'w300')} alt="" loading="lazy" decoding="async" className="size-full object-cover" />
|
||||||
<span className="absolute inset-0 grid place-items-center bg-black/50 text-base font-bold text-white">{e.number}</span>
|
<span className="absolute inset-0 grid place-items-center bg-black/50 text-base font-bold text-white">{e.number}</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { canWatchMore, nextAirDate } from '../lib/airing'
|
|||||||
import { episodeCap, seasonPosition } from '../lib/franchise'
|
import { episodeCap, seasonPosition } from '../lib/franchise'
|
||||||
import { progressView } from '../lib/rewatch'
|
import { progressView } from '../lib/rewatch'
|
||||||
import { genreLabel } from '../lib/genres'
|
import { genreLabel } from '../lib/genres'
|
||||||
import { backdropSrcSet, tmdbSized, imgCors } from '../lib/tmdbImage'
|
import { backdropSrcSet, tmdbSized } from '../lib/tmdbImage'
|
||||||
import { cx, formatDate } from '../lib/utils'
|
import { cx, formatDate } from '../lib/utils'
|
||||||
import { useMediaActions } from '../store'
|
import { useMediaActions } from '../store'
|
||||||
import { useToast } from './Toast'
|
import { useToast } from './Toast'
|
||||||
@@ -172,7 +172,6 @@ export default function HomeHero({ items, onOpen }: { items: MediaItem[]; onOpen
|
|||||||
else images.current.delete(it.id)
|
else images.current.delete(it.id)
|
||||||
}}
|
}}
|
||||||
src={it.backdrop ? tmdbSized(image, 'w1280') : image}
|
src={it.backdrop ? tmdbSized(image, 'w1280') : image}
|
||||||
crossOrigin={imgCors(it.backdrop ? tmdbSized(image, 'w1280') : image)}
|
|
||||||
srcSet={it.backdrop ? backdropSrcSet(image) : undefined}
|
srcSet={it.backdrop ? backdropSrcSet(image) : undefined}
|
||||||
sizes="(min-width: 64rem) 60vw, 100vw"
|
sizes="(min-width: 64rem) 60vw, 100vw"
|
||||||
alt=""
|
alt=""
|
||||||
@@ -254,7 +253,7 @@ export function ContinueCard({ item, onOpen }: { item: MediaItem; onOpen: (item:
|
|||||||
return (
|
return (
|
||||||
<article className="flex h-[5.5rem] w-72 shrink-0 overflow-hidden rounded-md border border-line bg-surface">
|
<article className="flex h-[5.5rem] w-72 shrink-0 overflow-hidden rounded-md border border-line bg-surface">
|
||||||
<button {...prefetchAttrs(item)} onClick={() => onOpen(item)} className="flex min-w-0 flex-1 items-stretch text-start" aria-label={t('card.open', { title: item.title })}>
|
<button {...prefetchAttrs(item)} onClick={() => onOpen(item)} className="flex min-w-0 flex-1 items-stretch text-start" aria-label={t('card.open', { title: item.title })}>
|
||||||
<span className="block w-[3.6rem] shrink-0 bg-surface-2">{image && <img src={image} crossOrigin={imgCors(image)} alt="" loading="lazy" decoding="async" className="size-full object-cover" />}</span>
|
<span className="block w-[3.6rem] shrink-0 bg-surface-2">{image && <img src={image} alt="" loading="lazy" decoding="async" className="size-full object-cover" />}</span>
|
||||||
<span className="flex min-w-0 flex-1 flex-col justify-center px-3">
|
<span className="flex min-w-0 flex-1 flex-col justify-center px-3">
|
||||||
<span className="block truncate font-bold text-base leading-tight">{item.title}</span>
|
<span className="block truncate font-bold text-base leading-tight">{item.title}</span>
|
||||||
<span className="mt-0.5 block truncate text-xs text-ink-3">
|
<span className="mt-0.5 block truncate text-xs text-ink-3">
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { locale, t } from '../i18n'
|
import { locale, t } from '../i18n'
|
||||||
import { imgCors } from '../lib/tmdbImage'
|
|
||||||
import { ArrowLeft, Check, Pencil, Plus, Search, Trash2 } from 'lucide-react'
|
import { ArrowLeft, Check, Pencil, Plus, Search, Trash2 } from 'lucide-react'
|
||||||
import { useMemo, useState } from 'react'
|
import { useMemo, useState } from 'react'
|
||||||
import { cx, normalizeText } from '../lib/utils'
|
import { cx, normalizeText } from '../lib/utils'
|
||||||
@@ -21,7 +20,7 @@ function Mosaic({ items }: { items: MediaItem[] }) {
|
|||||||
<div className="grid grid-cols-2 gap-0.5 overflow-hidden rounded-xl border border-line bg-surface-2">
|
<div className="grid grid-cols-2 gap-0.5 overflow-hidden rounded-xl border border-line bg-surface-2">
|
||||||
{cells.map((item, i) =>
|
{cells.map((item, i) =>
|
||||||
item?.poster ? (
|
item?.poster ? (
|
||||||
<img key={i} src={item.poster} crossOrigin={imgCors(item.poster)} alt="" loading="lazy" className="aspect-[2/3] w-full object-cover" />
|
<img key={i} src={item.poster} alt="" loading="lazy" className="aspect-[2/3] w-full object-cover" />
|
||||||
) : (
|
) : (
|
||||||
<div key={i} className="aspect-[2/3] w-full bg-surface-2" />
|
<div key={i} className="aspect-[2/3] w-full bg-surface-2" />
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { imgCors } from '../lib/tmdbImage'
|
|
||||||
import { cx } from '../lib/utils'
|
import { cx } from '../lib/utils'
|
||||||
|
|
||||||
/** Affiche du média, ou une vignette sobre (aplat + initiale en serif) si aucune image. */
|
/** Affiche du média, ou une vignette sobre (aplat + initiale en serif) si aucune image. */
|
||||||
@@ -10,7 +9,6 @@ export default function Poster({ src, title, className }: { src?: string; title:
|
|||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
src={src}
|
src={src}
|
||||||
crossOrigin={imgCors(src)}
|
|
||||||
alt={title}
|
alt={title}
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
decoding="async"
|
decoding="async"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { ArrowLeft, Check, Loader2 } from 'lucide-react'
|
import { ArrowLeft, Check, Loader2 } from 'lucide-react'
|
||||||
import { imgCors } from '../../lib/tmdbImage'
|
|
||||||
import { useEffect, useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { t } from '../../i18n'
|
import { t } from '../../i18n'
|
||||||
import { useBackToClose } from '../../lib/backNav'
|
import { useBackToClose } from '../../lib/backNav'
|
||||||
@@ -108,7 +107,7 @@ export default function PersonSheet({
|
|||||||
<div className="flex items-start gap-4 lg:gap-8">
|
<div className="flex items-start gap-4 lg:gap-8">
|
||||||
<div className="w-28 shrink-0 lg:w-48">
|
<div className="w-28 shrink-0 lg:w-48">
|
||||||
{photo ? (
|
{photo ? (
|
||||||
<img src={photo} crossOrigin={imgCors(photo)} alt={name} className="aspect-[2/3] w-full rounded-xl border border-line bg-surface-2 object-cover" />
|
<img src={photo} alt={name} className="aspect-[2/3] w-full rounded-xl border border-line bg-surface-2 object-cover" />
|
||||||
) : (
|
) : (
|
||||||
<div className="grid aspect-[2/3] w-full place-items-center rounded-xl border border-line bg-surface-2 text-4xl font-bold text-ink-3" aria-hidden="true">
|
<div className="grid aspect-[2/3] w-full place-items-center rounded-xl border border-line bg-surface-2 text-4xl font-bold text-ink-3" aria-hidden="true">
|
||||||
{name.charAt(0) || '?'}
|
{name.charAt(0) || '?'}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { Check, Loader2, LogOut, Pencil, Plus, Search, Trash2, UserPlus, Users, X } from 'lucide-react'
|
import { Check, Loader2, LogOut, Pencil, Plus, Search, Trash2, UserPlus, Users, X } from 'lucide-react'
|
||||||
import { imgCors } from '../../lib/tmdbImage'
|
|
||||||
import { useEffect, useMemo, useState } from 'react'
|
import { useEffect, useMemo, useState } from 'react'
|
||||||
import { locale, t } from '../../i18n'
|
import { locale, t } from '../../i18n'
|
||||||
import {
|
import {
|
||||||
@@ -43,7 +42,7 @@ function PosterMosaic({ posters }: { posters: string[] }) {
|
|||||||
<div className="relative grid grid-cols-2 gap-0.5 overflow-hidden rounded-xl border border-line bg-surface-2">
|
<div className="relative grid grid-cols-2 gap-0.5 overflow-hidden rounded-xl border border-line bg-surface-2">
|
||||||
{[0, 1, 2, 3].map((i) =>
|
{[0, 1, 2, 3].map((i) =>
|
||||||
posters[i] ? (
|
posters[i] ? (
|
||||||
<img key={i} src={posters[i]} crossOrigin={imgCors(posters[i])} alt="" loading="lazy" className="aspect-[2/3] w-full object-cover" />
|
<img key={i} src={posters[i]} alt="" loading="lazy" className="aspect-[2/3] w-full object-cover" />
|
||||||
) : (
|
) : (
|
||||||
<div key={i} className="aspect-[2/3] w-full bg-surface-2" />
|
<div key={i} className="aspect-[2/3] w-full bg-surface-2" />
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { Check, Loader2, PenLine, Search, X } from 'lucide-react'
|
import { Check, Loader2, PenLine, Search, X } from 'lucide-react'
|
||||||
import { imgCors } from '../../lib/tmdbImage'
|
|
||||||
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
import { useEffect, useRef, useState, type ReactNode } from 'react'
|
||||||
import { t } from '../../i18n'
|
import { t } from '../../i18n'
|
||||||
import { useBackToClose } from '../../lib/backNav'
|
import { useBackToClose } from '../../lib/backNav'
|
||||||
@@ -101,7 +100,7 @@ export default function AddTitle({
|
|||||||
<li key={r.externalId}>
|
<li key={r.externalId}>
|
||||||
<button data-prefetch={r.externalId} onClick={() => (mine ? onOpenItem(mine) : onPick(r))} className="flex w-full items-center gap-3 py-3 text-start active:bg-surface lg:border-b lg:border-line">
|
<button data-prefetch={r.externalId} onClick={() => (mine ? onOpenItem(mine) : onPick(r))} className="flex w-full items-center gap-3 py-3 text-start active:bg-surface lg:border-b lg:border-line">
|
||||||
{r.thumb ? (
|
{r.thumb ? (
|
||||||
<img src={r.thumb} crossOrigin={imgCors(r.thumb)} alt="" loading="lazy" className="h-[5.25rem] w-14 shrink-0 rounded-lg border border-line bg-surface-2 object-cover" />
|
<img src={r.thumb} alt="" loading="lazy" className="h-[5.25rem] w-14 shrink-0 rounded-lg border border-line bg-surface-2 object-cover" />
|
||||||
) : (
|
) : (
|
||||||
<span className="grid h-[5.25rem] w-14 shrink-0 place-items-center rounded-lg border border-line bg-surface-2 font-semibold text-ink-3">{r.title.charAt(0)}</span>
|
<span className="grid h-[5.25rem] w-14 shrink-0 place-items-center rounded-lg border border-line bg-surface-2 font-semibold text-ink-3">{r.title.charAt(0)}</span>
|
||||||
)}
|
)}
|
||||||
@@ -129,7 +128,7 @@ export default function AddTitle({
|
|||||||
<li key={p.id}>
|
<li key={p.id}>
|
||||||
<button onClick={() => onOpenPerson(p)} className="flex w-full items-center gap-3 py-2.5 text-start active:bg-surface lg:border-b lg:border-line">
|
<button onClick={() => onOpenPerson(p)} className="flex w-full items-center gap-3 py-2.5 text-start active:bg-surface lg:border-b lg:border-line">
|
||||||
{p.photo ? (
|
{p.photo ? (
|
||||||
<img src={p.photo} crossOrigin={imgCors(p.photo)} alt="" loading="lazy" className="size-14 shrink-0 rounded-full border border-line bg-surface-2 object-cover" />
|
<img src={p.photo} alt="" loading="lazy" className="size-14 shrink-0 rounded-full border border-line bg-surface-2 object-cover" />
|
||||||
) : (
|
) : (
|
||||||
<span className="grid size-14 shrink-0 place-items-center rounded-full border border-line bg-surface-2 text-lg font-semibold text-ink-3">{p.name.charAt(0)}</span>
|
<span className="grid size-14 shrink-0 place-items-center rounded-full border border-line bg-surface-2 text-lg font-semibold text-ink-3">{p.name.charAt(0)}</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { useEscape } from '../../lib/escape'
|
|||||||
import { episodeCap, seasonPosition } from '../../lib/franchise'
|
import { episodeCap, seasonPosition } from '../../lib/franchise'
|
||||||
import { episodesPatch } from '../../lib/progress'
|
import { episodesPatch } from '../../lib/progress'
|
||||||
import { useScrollLock } from '../../lib/scrollLock'
|
import { useScrollLock } from '../../lib/scrollLock'
|
||||||
import { backdropSrcSet, tmdbSized, imgCors } from '../../lib/tmdbImage'
|
import { backdropSrcSet, tmdbSized } from '../../lib/tmdbImage'
|
||||||
import { cx, formatDate, formatDuration, formatRating, todayISO } from '../../lib/utils'
|
import { cx, formatDate, formatDuration, formatRating, todayISO } from '../../lib/utils'
|
||||||
import { GuestError, useMedia } from '../../store'
|
import { GuestError, useMedia } from '../../store'
|
||||||
import { allTags, cleanTag } from '../../lib/bulk'
|
import { allTags, cleanTag } from '../../lib/bulk'
|
||||||
@@ -385,7 +385,6 @@ export default function TitleSheet({ item: initial, seed, onClose, onOpenPerson,
|
|||||||
{heroImage ? (
|
{heroImage ? (
|
||||||
<img
|
<img
|
||||||
src={tmdbSized(heroImage, 'w1280')}
|
src={tmdbSized(heroImage, 'w1280')}
|
||||||
crossOrigin={imgCors(tmdbSized(heroImage, 'w1280'))}
|
|
||||||
srcSet={backdropSrcSet(heroImage)}
|
srcSet={backdropSrcSet(heroImage)}
|
||||||
sizes="100vw"
|
sizes="100vw"
|
||||||
alt=""
|
alt=""
|
||||||
@@ -659,7 +658,7 @@ export default function TitleSheet({ item: initial, seed, onClose, onOpenPerson,
|
|||||||
className="group w-[5.5rem] shrink-0 text-center"
|
className="group w-[5.5rem] shrink-0 text-center"
|
||||||
>
|
>
|
||||||
{c.photo ? (
|
{c.photo ? (
|
||||||
<img src={c.photo} crossOrigin={imgCors(c.photo)} alt="" loading="lazy" className="mx-auto size-20 rounded-full border border-line bg-surface-2 object-cover transition-colors group-hover:border-accent" />
|
<img src={c.photo} alt="" loading="lazy" className="mx-auto size-20 rounded-full border border-line bg-surface-2 object-cover transition-colors group-hover:border-accent" />
|
||||||
) : (
|
) : (
|
||||||
<span className="mx-auto grid size-20 place-items-center rounded-full border border-line bg-surface-2 text-lg font-semibold text-ink-3 transition-colors group-hover:border-accent">{c.name.charAt(0)}</span>
|
<span className="mx-auto grid size-20 place-items-center rounded-full border border-line bg-surface-2 text-lg font-semibold text-ink-3 transition-colors group-hover:border-accent">{c.name.charAt(0)}</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ChevronDown, ExternalLink, Globe } from 'lucide-react'
|
|||||||
import { useMemo, type ReactNode } from 'react'
|
import { useMemo, type ReactNode } from 'react'
|
||||||
import { t } from '../../i18n'
|
import { t } from '../../i18n'
|
||||||
import type { TitleExtras } from '../../lib/catalogApi'
|
import type { TitleExtras } from '../../lib/catalogApi'
|
||||||
import { tmdbSized, imgCors } from '../../lib/tmdbImage'
|
import { tmdbSized } from '../../lib/tmdbImage'
|
||||||
import { countryName, defaultWatchRegion, OFFER_KINDS, setWatchRegion, useWatchRegion, type StreamLink, type WatchProvider } from '../../lib/watchProviders'
|
import { countryName, defaultWatchRegion, OFFER_KINDS, setWatchRegion, useWatchRegion, type StreamLink, type WatchProvider } from '../../lib/watchProviders'
|
||||||
|
|
||||||
const JUSTWATCH = 'https://www.justwatch.com'
|
const JUSTWATCH = 'https://www.justwatch.com'
|
||||||
@@ -96,7 +96,6 @@ function ProviderLogo({ provider, href }: { provider: WatchProvider; href?: stri
|
|||||||
const logo = provider.logo ? (
|
const logo = provider.logo ? (
|
||||||
<img
|
<img
|
||||||
src={provider.logo}
|
src={provider.logo}
|
||||||
crossOrigin={imgCors(provider.logo)}
|
|
||||||
srcSet={`${provider.logo} 1x, ${tmdbSized(provider.logo, 'w154')} 2x`}
|
srcSet={`${provider.logo} 1x, ${tmdbSized(provider.logo, 'w154')} 2x`}
|
||||||
alt={provider.name}
|
alt={provider.name}
|
||||||
title={provider.name}
|
title={provider.name}
|
||||||
@@ -133,7 +132,7 @@ function StreamLinks({ links }: { links: StreamLink[] }) {
|
|||||||
>
|
>
|
||||||
{l.icon ? (
|
{l.icon ? (
|
||||||
<span className="grid size-7 shrink-0 place-items-center rounded-full bg-surface-2" style={l.color ? { backgroundColor: l.color } : undefined}>
|
<span className="grid size-7 shrink-0 place-items-center rounded-full bg-surface-2" style={l.color ? { backgroundColor: l.color } : undefined}>
|
||||||
<img src={l.icon} crossOrigin={imgCors(l.icon)} alt="" loading="lazy" className="size-4 object-contain" />
|
<img src={l.icon} alt="" loading="lazy" className="size-4 object-contain" />
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<span className="grid size-7 shrink-0 place-items-center rounded-full bg-surface-2 text-xs font-semibold text-ink-2" aria-hidden>
|
<span className="grid size-7 shrink-0 place-items-center rounded-full bg-surface-2 text-xs font-semibold text-ink-2" aria-hidden>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import type { MediaInput, MediaType } from '../types'
|
import type { MediaInput, MediaType } from '../types'
|
||||||
import { imgCors } from './tmdbImage'
|
|
||||||
import { region, t, tmdbLanguage } from '../i18n'
|
import { region, t, tmdbLanguage } from '../i18n'
|
||||||
import { ratingsViaCloud, tmdbViaCloud } from './cloud/api'
|
import { ratingsViaCloud, tmdbViaCloud } from './cloud/api'
|
||||||
import { TYPE_BY_VALUE } from './constants'
|
import { TYPE_BY_VALUE } from './constants'
|
||||||
@@ -447,8 +446,6 @@ export function preloadImages(urls: (string | undefined)[]): void {
|
|||||||
const img = new Image()
|
const img = new Image()
|
||||||
img.decoding = 'async'
|
img.decoding = 'async'
|
||||||
img.referrerPolicy = 'no-referrer'
|
img.referrerPolicy = 'no-referrer'
|
||||||
const cors = imgCors(url) // même mode que l'image affichée ensuite (sinon deux téléchargements)
|
|
||||||
if (cors) img.crossOrigin = cors
|
|
||||||
img.src = url
|
img.src = url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,3 @@ export function backdropSrcSet(url: string | undefined): string | undefined {
|
|||||||
if (!url || !TMDB_SIZED.test(url)) return undefined
|
if (!url || !TMDB_SIZED.test(url)) return undefined
|
||||||
return `${tmdbSized(url, 'w780')} 780w, ${tmdbSized(url, 'w1280')} 1280w, ${tmdbSized(url, 'original')} 1920w`
|
return `${tmdbSized(url, 'w780')} 780w, ${tmdbSized(url, 'w1280')} 1280w, ${tmdbSized(url, 'original')} 1920w`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Images TMDB et AniList demandées en mode CORS (ces deux serveurs l'autorisent). Sans cela, la copie gardée
|
|
||||||
* hors-ligne est « opaque » : Chrome la compte pour ~7 Mo de quota chacune, et des centaines d'affiches
|
|
||||||
* finissaient par dépasser l'espace de l'app (au risque d'effacer aussi la bibliothèque enregistrée sur l'appareil).
|
|
||||||
*/
|
|
||||||
export const imgCors = (src: string | undefined): 'anonymous' | undefined =>
|
|
||||||
src && /^https:\/\/(image\.tmdb\.org|s4\.anilist\.co)\//.test(src) ? 'anonymous' : undefined
|
|
||||||
+2
-2
@@ -23,9 +23,9 @@ installFriendlyNetworkErrors()
|
|||||||
|
|
||||||
// Service worker : cache l'app pour un fonctionnement hors-ligne et la met à jour automatiquement.
|
// Service worker : cache l'app pour un fonctionnement hors-ligne et la met à jour automatiquement.
|
||||||
registerSW({ immediate: true })
|
registerSW({ immediate: true })
|
||||||
// Anciennes copies d'images « opaques » (~7 Mo de quota chacune) : remplacées par posters-v2 / backdrops-v2
|
// Caches d'images d'un essai abandonné (images en mode CORS, cassées sur iPhone) : supprimés
|
||||||
try {
|
try {
|
||||||
for (const name of ['posters', 'backdrops']) void caches.delete(name).catch(() => {})
|
for (const name of ['posters-v2', 'backdrops-v2']) void caches.delete(name).catch(() => {})
|
||||||
} catch {
|
} catch {
|
||||||
/* Cache API indisponible */
|
/* Cache API indisponible */
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -154,12 +154,12 @@ export default defineConfig(({ mode }) => {
|
|||||||
{
|
{
|
||||||
urlPattern: /^https:\/\/(s4\.anilist\.co\/|image\.tmdb\.org\/t\/p\/(w92|w154|w185|w300|w342|w500)\/)/,
|
urlPattern: /^https:\/\/(s4\.anilist\.co\/|image\.tmdb\.org\/t\/p\/(w92|w154|w185|w300|w342|w500)\/)/,
|
||||||
handler: 'CacheFirst',
|
handler: 'CacheFirst',
|
||||||
// Images demandées en mode CORS (imgCors) : seules les vraies réponses (200) sont gardées. Les réponses
|
// Réponses « opaques » (statut 0) acceptées : les images ne sont PAS demandées en mode CORS. Essayé le
|
||||||
// « opaques » (statut 0) comptaient ~7 Mo de quota chacune ; l'ancien cache « posters » est supprimé (main.tsx).
|
// 29/11/2026 (crossOrigin) : sur iPhone, les affiches déjà en mémoire (sans en-tête CORS) ne s'affichaient plus.
|
||||||
options: {
|
options: {
|
||||||
cacheName: 'posters-v2',
|
cacheName: 'posters',
|
||||||
expiration: { maxEntries: 1500, maxAgeSeconds: 60 * 60 * 24 * 365, purgeOnQuotaError: true },
|
expiration: { maxEntries: 1500, maxAgeSeconds: 60 * 60 * 24 * 365, purgeOnQuotaError: true },
|
||||||
cacheableResponse: { statuses: [200] },
|
cacheableResponse: { statuses: [0, 200] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Grandes images de fond : lourdes (~200 Ko), on n'en garde que quelques-unes pour ne pas chasser les affiches
|
// Grandes images de fond : lourdes (~200 Ko), on n'en garde que quelques-unes pour ne pas chasser les affiches
|
||||||
@@ -167,9 +167,9 @@ export default defineConfig(({ mode }) => {
|
|||||||
urlPattern: /^https:\/\/image\.tmdb\.org\/t\/p\/(w780|w1280|original)\//,
|
urlPattern: /^https:\/\/image\.tmdb\.org\/t\/p\/(w780|w1280|original)\//,
|
||||||
handler: 'CacheFirst',
|
handler: 'CacheFirst',
|
||||||
options: {
|
options: {
|
||||||
cacheName: 'backdrops-v2',
|
cacheName: 'backdrops',
|
||||||
expiration: { maxEntries: 80, maxAgeSeconds: 60 * 60 * 24 * 60, purgeOnQuotaError: true },
|
expiration: { maxEntries: 80, maxAgeSeconds: 60 * 60 * 24 * 60, purgeOnQuotaError: true },
|
||||||
cacheableResponse: { statuses: [200] },
|
cacheableResponse: { statuses: [0, 200] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...(supabaseUrl
|
...(supabaseUrl
|
||||||
|
|||||||
Reference in new issue
Block a user