Page 404 : adresse inconnue (nginx + service worker) et route inconnue dans l'app

- public/404.html servie par nginx (error_page 404) avec un vrai code 404.
- Service worker : le fallback vers l'app ne s'applique plus qu'à « / »,
  les autres adresses reçoivent la 404 du serveur.
- #/route-inconnue affiche un écran 404 (18 langues) au lieu de l'accueil.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
Claude committed 2026-10-09 13:59:28 +00:00
1 parent 3cfc6fe1b6
commit c246b16e7e
23 files changed
+122 -5

No files matched your search

+10 -4
View File
@@ -12,18 +12,23 @@ import CatalogPage from './pages/CatalogPage'
import StatsPage from './pages/StatsPage'
import SettingsPage from './pages/SettingsPage'
import AdminPage from './pages/AdminPage'
import NotFoundPage from './pages/NotFoundPage'
import { useMedia } from './store'
import type { SearchResult } from './lib/catalogApi'
import type { MediaItem } from './types'
const TABS: Tab[] = ['home', 'catalog', 'stats', 'settings']
// L'administration a sa propre route (#/admin), hors de la navigation principale
type Route = Tab | 'admin'
type Route = Tab | 'admin' | 'notfound'
function routeFromHash(): Route {
const h = window.location.hash.replace('#/', '')
const hash = window.location.hash
// Pas de route (ou retour de connexion « #access_token=… ») : accueil
if (!hash.startsWith('#/')) return 'home'
const h = hash.slice(2)
if (h === '' || h.startsWith('u/')) return 'home'
if (h === 'admin') return 'admin'
return (TABS as string[]).includes(h) ? (h as Tab) : 'home'
return (TABS as string[]).includes(h) ? (h as Tab) : 'notfound'
}
/** Fiche ouverte : un titre de ma bibliothèque, ou un résultat de recherche pas encore ajouté. */
@@ -49,7 +54,7 @@ export default function App() {
window.scrollTo({ top: 0 })
}
// Dans la barre de navigation, l'administration reste rattachée à « Réglages »
const navTab: Tab = route === 'admin' ? 'settings' : route
const navTab: Tab = route === 'admin' ? 'settings' : route === 'notfound' ? 'home' : route
const openItem = (item: MediaItem) => setOpened({ item })
const openNew = () => setAdding(true)
@@ -72,6 +77,7 @@ export default function App() {
{route === 'stats' && <StatsPage />}
{route === 'settings' && <SettingsPage onOpenAdmin={() => go('admin')} />}
{route === 'admin' && <AdminPage onBack={() => go('settings')} />}
{route === 'notfound' && <NotFoundPage onHome={() => go('home')} />}
</main>
<BottomNav current={navTab} onChange={go} onAdd={openNew} />
+3
View File
@@ -190,6 +190,9 @@ const dict: Translations = {
'legal.notice': "الإشعار القانوني",
'legal.credits': "الاعتمادات",
'legal.tmdb': "يستخدم هذا المنتج واجهة TMDB البرمجية لكنه غير معتمد أو مصادق عليه من TMDB.",
'notFound.title': "حُذف هذا المشهد أثناء المونتاج",
'notFound.text': "الصفحة التي تبحث عنها غير موجودة أو تم نقلها.",
'notFound.back': "العودة إلى الرئيسية",
'auth.newPasswordTitle': 'اختر كلمة المرور الجديدة.',
'auth.newPassword': 'كلمة المرور الجديدة',
'auth.err.credentials': 'البريد الإلكتروني أو كلمة المرور غير صحيحة.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Impressum",
'legal.credits': "Credits",
'legal.tmdb': "Dieses Produkt nutzt die TMDB-API, ist aber nicht von TMDB unterstützt oder zertifiziert.",
'notFound.title': "Diese Szene ist im Schnitt gelandet",
'notFound.text': "Die gesuchte Seite existiert nicht oder wurde verschoben.",
'notFound.back': "Zur Startseite",
'auth.newPasswordTitle': 'Wähl dein neues Passwort.',
'auth.newPassword': 'Neues Passwort',
'auth.err.credentials': 'E-Mail oder Passwort falsch.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Legal notice",
'legal.credits': "Credits",
'legal.tmdb': "This product uses the TMDB API but is not endorsed or certified by TMDB.",
'notFound.title': "This scene was cut in editing",
'notFound.text': "The page you're looking for doesn't exist or has moved.",
'notFound.back': "Back to home",
'auth.newPasswordTitle': 'Pick your new password.',
'auth.newPassword': 'New password',
'auth.err.credentials': 'Wrong email or password.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Aviso legal",
'legal.credits': "Créditos",
'legal.tmdb': "Este producto usa la API de TMDB pero no está respaldado ni certificado por TMDB.",
'notFound.title': "Esta escena se quedó en la sala de montaje",
'notFound.text': "La página que buscas no existe o se ha movido.",
'notFound.back': "Volver al inicio",
'auth.newPasswordTitle': 'Elige tu nueva contraseña.',
'auth.newPassword': 'Nueva contraseña',
'auth.err.credentials': 'Correo o contraseña incorrectos.',
+3
View File
@@ -189,6 +189,9 @@ const dict = {
'legal.notice': "Mentions légales",
'legal.credits': "Crédits",
'legal.tmdb': "Cette application utilise l'API TMDB mais n'est ni approuvée ni certifiée par TMDB.",
'notFound.title': "Cette scène a été coupée au montage",
'notFound.text': "La page que tu cherches n'existe pas ou a été déplacée.",
'notFound.back': "Retour à l'accueil",
'auth.newPasswordTitle': 'Choisis ton nouveau mot de passe.',
'auth.newPassword': 'Nouveau mot de passe',
'auth.err.credentials': 'Email ou mot de passe incorrect.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "कानूनी सूचना",
'legal.credits': "श्रेय",
'legal.tmdb': "यह उत्पाद TMDB API का उपयोग करता है, लेकिन TMDB द्वारा समर्थित या प्रमाणित नहीं है।",
'notFound.title': "यह सीन एडिटिंग में कट गया",
'notFound.text': "आप जो पेज ढूंढ रहे हैं वह मौजूद नहीं है या हटा दिया गया है।",
'notFound.back': "होम पर लौटें",
'auth.newPasswordTitle': 'अपना नया पासवर्ड चुनें।',
'auth.newPassword': 'नया पासवर्ड',
'auth.err.credentials': 'ईमेल या पासवर्ड गलत है।',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Informasi hukum",
'legal.credits': "Kredit",
'legal.tmdb': "Produk ini menggunakan API TMDB tetapi tidak didukung atau disertifikasi oleh TMDB.",
'notFound.title': "Adegan ini terpotong saat penyuntingan",
'notFound.text': "Halaman yang kamu cari tidak ada atau sudah dipindahkan.",
'notFound.back': "Kembali ke beranda",
'auth.newPasswordTitle': 'Pilih kata sandi barumu.',
'auth.newPassword': 'Kata sandi baru',
'auth.err.credentials': 'Email atau kata sandi salah.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Note legali",
'legal.credits': "Crediti",
'legal.tmdb': "Questo prodotto usa l'API di TMDB ma non è approvato né certificato da TMDB.",
'notFound.title': "Questa scena è stata tagliata al montaggio",
'notFound.text': "La pagina che cerchi non esiste o è stata spostata.",
'notFound.back': "Torna alla home",
'auth.newPasswordTitle': 'Scegli la tua nuova password.',
'auth.newPassword': 'Nuova password',
'auth.err.credentials': 'Email o password errata.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "法的表示",
'legal.credits': "クレジット",
'legal.tmdb': "この製品は TMDB API を使用していますが、TMDB による承認・認定を受けたものではありません。",
'notFound.title': "このシーンは編集でカットされました",
'notFound.text': "お探しのページは存在しないか、移動しました。",
'notFound.back': "ホームに戻る",
'auth.newPasswordTitle': '新しいパスワードを設定してください。',
'auth.newPassword': '新しいパスワード',
'auth.err.credentials': 'メールアドレスまたはパスワードが違います。',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "법적 고지",
'legal.credits': "크레딧",
'legal.tmdb': "이 제품은 TMDB API를 사용하지만 TMDB의 보증이나 인증을 받지 않았습니다.",
'notFound.title': "이 장면은 편집에서 잘렸어요",
'notFound.text': "찾는 페이지가 없거나 이동되었어요.",
'notFound.back': "홈으로 돌아가기",
'auth.newPasswordTitle': '새 비밀번호를 정해 주세요.',
'auth.newPassword': '새 비밀번호',
'auth.err.credentials': '이메일 또는 비밀번호가 올바르지 않아요.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Juridische informatie",
'legal.credits': "Credits",
'legal.tmdb': "Dit product gebruikt de TMDB-API maar wordt niet door TMDB onderschreven of gecertificeerd.",
'notFound.title': "Deze scène is eruit geknipt",
'notFound.text': "De pagina die je zoekt bestaat niet of is verplaatst.",
'notFound.back': "Terug naar start",
'auth.newPasswordTitle': 'Kies je nieuwe wachtwoord.',
'auth.newPassword': 'Nieuw wachtwoord',
'auth.err.credentials': 'Onjuist e-mailadres of wachtwoord.',
+3
View File
@@ -189,6 +189,9 @@ const dict: Translations = {
'legal.notice': "Informacje prawne",
'legal.credits': "Podziękowania",
'legal.tmdb': "Ten produkt korzysta z API TMDB, ale nie jest zatwierdzony ani certyfikowany przez TMDB.",
'notFound.title': "Ta scena wypadła przy montażu",
'notFound.text': "Strona, której szukasz, nie istnieje lub została przeniesiona.",
'notFound.back': "Wróć do strony głównej",
'auth.newPasswordTitle': 'Wybierz nowe hasło.',
'auth.newPassword': 'Nowe hasło',
'auth.err.credentials': 'Nieprawidłowy e-mail lub hasło.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Aviso legal",
'legal.credits': "Créditos",
'legal.tmdb': "Este produto usa a API do TMDB, mas não é endossado nem certificado pelo TMDB.",
'notFound.title': "Esta cena foi cortada na montagem",
'notFound.text': "A página que procuras não existe ou foi movida.",
'notFound.back': "Voltar ao início",
'auth.newPasswordTitle': 'Escolha sua nova senha.',
'auth.newPassword': 'Nova senha',
'auth.err.credentials': 'E-mail ou senha incorretos.',
+3
View File
@@ -189,6 +189,9 @@ const dict: Translations = {
'legal.notice': "Правовая информация",
'legal.credits': "Благодарности",
'legal.tmdb': "Этот продукт использует API TMDB, но не одобрен и не сертифицирован TMDB.",
'notFound.title': "Эту сцену вырезали при монтаже",
'notFound.text': "Страница, которую ты ищешь, не существует или была перемещена.",
'notFound.back': "На главную",
'auth.newPasswordTitle': 'Придумай новый пароль.',
'auth.newPassword': 'Новый пароль',
'auth.err.credentials': 'Неверная почта или пароль.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "ประกาศทางกฎหมาย",
'legal.credits': "เครดิต",
'legal.tmdb': "ผลิตภัณฑ์นี้ใช้ TMDB API แต่ไม่ได้รับการรับรองหรือสนับสนุนจาก TMDB",
'notFound.title': "ฉากนี้ถูกตัดออกตอนตัดต่อ",
'notFound.text': "ไม่พบหน้าที่คุณกำลังหา หรือหน้านั้นถูกย้ายไปแล้ว",
'notFound.back': "กลับหน้าแรก",
'auth.newPasswordTitle': 'ตั้งรหัสผ่านใหม่ของคุณ',
'auth.newPassword': 'รหัสผ่านใหม่',
'auth.err.credentials': 'อีเมลหรือรหัสผ่านไม่ถูกต้อง',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Yasal bilgiler",
'legal.credits': "Katkıda bulunanlar",
'legal.tmdb': "Bu ürün TMDB API'sini kullanır ancak TMDB tarafından onaylanmamış veya sertifikalandırılmamıştır.",
'notFound.title': "Bu sahne kurguda kesildi",
'notFound.text': "Aradığın sayfa yok ya da taşındı.",
'notFound.back': "Ana sayfaya dön",
'auth.newPasswordTitle': 'Yeni şifreni seç.',
'auth.newPassword': 'Yeni şifre',
'auth.err.credentials': 'E-posta veya şifre hatalı.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "Thông tin pháp lý",
'legal.credits': "Ghi công",
'legal.tmdb': "Sản phẩm này sử dụng API của TMDB nhưng không được TMDB xác nhận hay chứng nhận.",
'notFound.title': "Cảnh này đã bị cắt khi dựng phim",
'notFound.text': "Trang bạn tìm không tồn tại hoặc đã được chuyển đi.",
'notFound.back': "Về trang chủ",
'auth.newPasswordTitle': 'Chọn mật khẩu mới của bạn.',
'auth.newPassword': 'Mật khẩu mới',
'auth.err.credentials': 'Email hoặc mật khẩu không đúng.',
+3
View File
@@ -187,6 +187,9 @@ const dict: Translations = {
'legal.notice': "法律声明",
'legal.credits': "致谢",
'legal.tmdb': "本产品使用 TMDB API,但未获得 TMDB 的认可或认证。",
'notFound.title': "这场戏在剪辑时被剪掉了",
'notFound.text': "你要找的页面不存在或已被移动。",
'notFound.back': "返回首页",
'auth.newPasswordTitle': '设置你的新密码。',
'auth.newPassword': '新密码',
'auth.err.credentials': '邮箱或密码错误。',
+19
View File
@@ -0,0 +1,19 @@
import { t } from '../i18n'
/** Route inconnue (#/…) : on le dit, plutôt que d'afficher l'accueil sans explication. */
export default function NotFoundPage({ onHome }: { onHome: () => void }) {
return (
<div className="grid min-h-[70dvh] place-items-center text-center">
<div className="max-w-md px-2">
<p aria-hidden="true" className="text-8xl font-extrabold tracking-tighter text-line-strong lg:text-9xl">
4<span className="text-accent">0</span>4
</p>
<h1 className="mt-5 text-2xl font-bold">{t('notFound.title')}</h1>
<p className="mt-2 text-sm text-ink-2">{t('notFound.text')}</p>
<button onClick={onHome} className="btn btn-primary mt-7 px-6 py-3">
{t('notFound.back')}
</button>
</div>
</div>
)
}