From c246b16e7e725431508d854a42df3a69337c2981 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 9 Oct 2026 13:59:28 +0000 Subject: [PATCH] Page 404 : adresse inconnue (nginx + service worker) et route inconnue dans l'app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe --- deploy/nginx/site.conf | 3 +++ public/404.html | 33 +++++++++++++++++++++++++++++++++ src/App.tsx | 14 ++++++++++---- src/i18n/locales/ar.ts | 3 +++ src/i18n/locales/de.ts | 3 +++ src/i18n/locales/en.ts | 3 +++ src/i18n/locales/es.ts | 3 +++ src/i18n/locales/fr.ts | 3 +++ src/i18n/locales/hi.ts | 3 +++ src/i18n/locales/id.ts | 3 +++ src/i18n/locales/it.ts | 3 +++ src/i18n/locales/ja.ts | 3 +++ src/i18n/locales/ko.ts | 3 +++ src/i18n/locales/nl.ts | 3 +++ src/i18n/locales/pl.ts | 3 +++ src/i18n/locales/pt.ts | 3 +++ src/i18n/locales/ru.ts | 3 +++ src/i18n/locales/th.ts | 3 +++ src/i18n/locales/tr.ts | 3 +++ src/i18n/locales/vi.ts | 3 +++ src/i18n/locales/zh.ts | 3 +++ src/pages/NotFoundPage.tsx | 19 +++++++++++++++++++ vite.config.ts | 4 +++- 23 files changed, 122 insertions(+), 5 deletions(-) create mode 100644 public/404.html create mode 100644 src/pages/NotFoundPage.tsx diff --git a/deploy/nginx/site.conf b/deploy/nginx/site.conf index eb2f808..ede513c 100644 --- a/deploy/nginx/site.conf +++ b/deploy/nginx/site.conf @@ -10,6 +10,9 @@ server { root /srv/azuucine/current/dist; index index.html; + # Adresse inconnue : vraie réponse 404 avec une page dédiée + error_page 404 /404.html; + # nginx ne connaît pas .webmanifest : sans cette ligne, le manifest du PWA est servi en octet-stream include /etc/nginx/mime.types; types { application/manifest+json webmanifest; } diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..a14455b --- /dev/null +++ b/public/404.html @@ -0,0 +1,33 @@ + + + + + +AzuuCine — Page introuvable + + + + + +
+ +

Cette scène a été coupée au montage

+

La page que tu cherches n'existe pas ou a été déplacée.

+ Retour à AzuuCine +

Page not found — back to AzuuCine

+
+ + diff --git a/src/App.tsx b/src/App.tsx index aebccac..01a12ce 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -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' && } {route === 'settings' && go('admin')} />} {route === 'admin' && go('settings')} />} + {route === 'notfound' && go('home')} />} diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index 3e4dc2e..f043a88 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -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': 'البريد الإلكتروني أو كلمة المرور غير صحيحة.', diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index f939c47..27a5e64 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -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.', diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index d3485de..485d651 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -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.', diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 3a34d98..7cf4d14 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -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.', diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index 9b0ef43..1898226 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -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.', diff --git a/src/i18n/locales/hi.ts b/src/i18n/locales/hi.ts index ab9a218..db825eb 100644 --- a/src/i18n/locales/hi.ts +++ b/src/i18n/locales/hi.ts @@ -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': 'ईमेल या पासवर्ड गलत है।', diff --git a/src/i18n/locales/id.ts b/src/i18n/locales/id.ts index 9bdbfc0..5da9809 100644 --- a/src/i18n/locales/id.ts +++ b/src/i18n/locales/id.ts @@ -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.', diff --git a/src/i18n/locales/it.ts b/src/i18n/locales/it.ts index 66ed014..df1ce6b 100644 --- a/src/i18n/locales/it.ts +++ b/src/i18n/locales/it.ts @@ -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.', diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index 09c01e5..67b6839 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -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': 'メールアドレスまたはパスワードが違います。', diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index ae6d44f..54d2f0b 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -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': '이메일 또는 비밀번호가 올바르지 않아요.', diff --git a/src/i18n/locales/nl.ts b/src/i18n/locales/nl.ts index 0436942..dd2e4f3 100644 --- a/src/i18n/locales/nl.ts +++ b/src/i18n/locales/nl.ts @@ -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.', diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index 05028f2..8427a4b 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -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.', diff --git a/src/i18n/locales/pt.ts b/src/i18n/locales/pt.ts index abd8a03..dee6d12 100644 --- a/src/i18n/locales/pt.ts +++ b/src/i18n/locales/pt.ts @@ -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.', diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index 932bfe8..c95076d 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -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': 'Неверная почта или пароль.', diff --git a/src/i18n/locales/th.ts b/src/i18n/locales/th.ts index 1f906c3..4551741 100644 --- a/src/i18n/locales/th.ts +++ b/src/i18n/locales/th.ts @@ -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': 'อีเมลหรือรหัสผ่านไม่ถูกต้อง', diff --git a/src/i18n/locales/tr.ts b/src/i18n/locales/tr.ts index c58e574..ea49087 100644 --- a/src/i18n/locales/tr.ts +++ b/src/i18n/locales/tr.ts @@ -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ı.', diff --git a/src/i18n/locales/vi.ts b/src/i18n/locales/vi.ts index 13a64c6..632c8a9 100644 --- a/src/i18n/locales/vi.ts +++ b/src/i18n/locales/vi.ts @@ -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.', diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index ba98458..ad9a6c6 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -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': '邮箱或密码错误。', diff --git a/src/pages/NotFoundPage.tsx b/src/pages/NotFoundPage.tsx new file mode 100644 index 0000000..dfcbb82 --- /dev/null +++ b/src/pages/NotFoundPage.tsx @@ -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 ( +
+
+ +

{t('notFound.title')}

+

{t('notFound.text')}

+ +
+
+ ) +} diff --git a/vite.config.ts b/vite.config.ts index 5382e52..36cb950 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -106,7 +106,9 @@ export default defineConfig(({ mode }) => { }, workbox: { globPatterns: ['**/*.{js,css,html,svg,png,ico,webmanifest,woff2}'], - // La page de confidentialité est une vraie page, pas l'app + // L'app vit entièrement sur « / » (routes après le #) : toute autre adresse reçoit la page 404 du serveur + navigateFallbackAllowlist: [/^\/(?:index\.html)?(?:\?.*)?$/], + // Les pages légales sont de vraies pages, pas l'app navigateFallbackDenylist: [/^\/privacy/, /^\/legal/], // Les affiches AniList ne peuvent pas être copiées dans la base (CORS) : // on les garde en cache après le premier affichage pour les voir hors-ligne.