Corrections : faux avis « Réalisation : … », erreurs réseau lisibles, images d'épisodes, date de version
deploy / deploy (push) Successful in 40s
deploy / deploy (push) Successful in 40s
- Import des anciennes sauvegardes : le réalisateur n'est plus collé dans l'avis (public). 123 avis nettoyés en base (copie dans azuu_backup) - Carte de partage : ne lit plus le réalisateur dans l'avis - Erreurs réseau (« Load failed », « Failed to fetch »…) : message traduit dans les 18 langues, au lieu du texte brut du navigateur - Épisodes sans image chez TMDB : vignette de la série assombrie avec le numéro - Réglages : date de la version affichée (pour voir si l'appareil est à jour) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
29 files changed
+80
-14
No files matched your search
+12
-1
@@ -4,6 +4,17 @@ import type { ThemeMode } from '../types'
|
||||
/** Version de l'app (package.json). */
|
||||
export const APP_VERSION = __APP_VERSION__
|
||||
|
||||
/** Date de cette version, courte (« 29/11 12:10 ») : pour voir d'un coup d'œil si l'appareil est à jour. */
|
||||
export function buildLabel(): string {
|
||||
const d = new Date(__APP_BUILD__)
|
||||
if (Number.isNaN(d.getTime())) return ''
|
||||
try {
|
||||
return new Intl.DateTimeFormat(getLang(), { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' }).format(d)
|
||||
} catch {
|
||||
return d.toISOString().slice(0, 16).replace('T', ' ')
|
||||
}
|
||||
}
|
||||
|
||||
/** Navigateur et système, en clair et sans détail identifiant (« Chrome 129 », « Android 14 »). */
|
||||
export function browserInfo(ua = navigator.userAgent): { browser: string; os: string } {
|
||||
const m = (re: RegExp) => ua.match(re)?.[1]?.split('.')[0]
|
||||
@@ -47,7 +58,7 @@ export function techInfo(theme: ThemeMode): Record<string, string> {
|
||||
const { browser, os } = browserInfo()
|
||||
const standalone = window.matchMedia?.('(display-mode: standalone)').matches || (navigator as { standalone?: boolean }).standalone === true
|
||||
return {
|
||||
version: APP_VERSION,
|
||||
version: `${APP_VERSION} (${buildLabel()})`,
|
||||
browser,
|
||||
os,
|
||||
lang: getLang(),
|
||||
|
||||
@@ -48,7 +48,7 @@ function fingerprint(source: ErrorSource, message: string, stack: string): strin
|
||||
/** Erreurs sans intérêt (réseau coupé, extensions du navigateur, bruit connu des navigateurs). */
|
||||
function isNoise(message: string, stack: string): boolean {
|
||||
if (!message || message === 'Script error.' || message === 'Script error') return true
|
||||
if (/ResizeObserver loop|AbortError|The operation was aborted|NetworkError when attempting|Failed to fetch$|Load failed$|cancelled|annulé/i.test(message)) return true
|
||||
if (/ResizeObserver loop|AbortError|The operation was aborted|^NetworkError|NetworkError when attempting|Failed to fetch$|Load failed$|cancelled|annulé/i.test(message)) return true
|
||||
if (/(chrome|moz|safari(-web)?)-extension:\/\//.test(stack)) return true
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -199,12 +199,8 @@ export function convertLegacyBackup(data: LegacyFile): { items: MediaItem[]; ski
|
||||
endDate,
|
||||
genres,
|
||||
tags: tags.length ? tags : undefined,
|
||||
notes: cleanText(
|
||||
[cleanText(r.comment, LIMITS.notes), cleanText(r.director, LIMITS.shortText) ? `Réalisation : ${cleanText(r.director, LIMITS.shortText)}` : '']
|
||||
.filter(Boolean)
|
||||
.join('\n\n'),
|
||||
LIMITS.notes,
|
||||
),
|
||||
// Seul le commentaire devient l'avis (public) : le réalisateur est déjà affiché sur la fiche (TMDB)
|
||||
notes: cleanText(r.comment, LIMITS.notes),
|
||||
poster: isSafeTmdbPath(r.poster_path) ? `https://image.tmdb.org/t/p/w342${r.poster_path}` : undefined,
|
||||
overview: cleanText(r.overview, LIMITS.overview),
|
||||
externalId: (() => {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { t } from '../i18n'
|
||||
|
||||
/**
|
||||
* Demande réseau qui n'aboutit pas (serveur injoignable, connexion coupée, réponse refusée par le navigateur).
|
||||
* Le navigateur donne un texte brut en anglais, différent partout (« Load failed » sur iPhone, « Failed to fetch »
|
||||
* sur Chrome…) : on le remplace par un message traduit. Reste une TypeError, comme l'erreur d'origine.
|
||||
*/
|
||||
export class NetworkError extends TypeError {
|
||||
constructor(cause: unknown) {
|
||||
super(navigator.onLine ? t('common.network') : t('common.offline'), { cause })
|
||||
this.name = 'NetworkError'
|
||||
}
|
||||
}
|
||||
|
||||
/** À appeler une fois au démarrage : toutes les demandes de l'app passent par fetch. */
|
||||
export function installFriendlyNetworkErrors(): void {
|
||||
const native = window.fetch.bind(window)
|
||||
window.fetch = ((input: RequestInfo | URL, init?: RequestInit) =>
|
||||
native(input, init).catch((e: unknown) => {
|
||||
// Seules les erreurs réseau (TypeError) sont traduites : une annulation (AbortError, délai dépassé) reste telle quelle
|
||||
if (e instanceof TypeError && !(e instanceof NetworkError)) throw new NetworkError(e)
|
||||
throw e
|
||||
})) as typeof fetch
|
||||
}
|
||||
@@ -254,8 +254,7 @@ export async function renderItemCard(item: MediaItem, credits?: CardCredits): Pr
|
||||
} else if (!episodic && minutes) {
|
||||
rows.push([t('form.duration'), t('share.minutesLong', { n: minutes })])
|
||||
}
|
||||
const notesDirector = item.notes?.match(/Réalisation\s*:\s*(.+)/)?.[1]
|
||||
const directors = credits?.directors.length ? credits.directors : notesDirector ? [notesDirector.trim()] : []
|
||||
const directors = credits?.directors ?? []
|
||||
if (directors.length) rows.push([episodic ? t('share.createdBy') : t('share.directedBy'), directors.join(' · ')])
|
||||
if (credits?.producers.length) rows.push([t('share.producedBy'), credits.producers.join(' · ')])
|
||||
if (credits?.cast.length) rows.push([t('share.starring'), credits.cast.join(' · ')])
|
||||
|
||||
Reference in new issue
Block a user