Données et synchro - Import « remplacer » atomique (plus de bibliothèque vidée si l'écriture échoue). - Deux onglets sur le même compte : mise à jour croisée, file d'envoi partagée sans perte. - Réception : une modification locale faite pendant la synchro n'est plus écrasée ; une seule transaction. - Envoi : file vidée paquet par paquet, fiche invalide isolée (quota : gardée en attente), taille en octets réels, délai proportionnel à la taille ; grandes affiches décodées sans fetch (bloqué par la CSP). - Plus d'écriture dans la base d'un autre compte après déconnexion ; base fermée proprement (iOS). - Revisionnages journalisés à part (rewatchLog) : les défis ne sous-estiment plus le 1er visionnage ; décocher des épisodes un autre jour ne gonfle plus les défis. Comptes et social - Renouvellement de session : plus de déconnexion de tous les onglets avec un jeton déjà utilisé, plus de rafale de renouvellements, déconnexion qui révoque bien la session serveur. - Délais maximum sur les appels réseau, écran blanc évité au retour de Google. - Abonnés/abonnements au-delà de 50, pagination du fil et des profils, fil hors-ligne, listes bloquées. - Code mort retiré (CommentsSheet et options jamais utilisées). Interface et logique - Toast qui ne disparaissait plus, focus sur « Annuler » dans les confirmations, Échap pendant la saisie IME. - Demi-étoile en arabe, flèches RTL, fonds d'overlay en jeton de thème, couleur du thème étoilé. - Séries en cours sans total connu : les nouveaux épisodes se cochent à nouveau ; épisodes spéciaux ignorés. - Catalogue, accueil et calendrier plus rapides sur les grosses bibliothèques. Sources externes - Proxy TMDB : les 18 langues acceptées (9 étaient refusées), 429 transmis, délais, paramètres durcis. - Contenus adultes AniList filtrés des recommandations, cache d'import borné, imports plus sûrs. Serveur (migration 20261122140000_audit_hardening.sql, déjà appliquée en ligne) - Fonctions admin et « comptes suspendus » versionnées ; blocage effectif ; avis robustes ; fiches supprimées vidées ; comptes suspendus sans abonnement ni réaction ; objets morts supprimés. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
168 lines
6.6 KiB
TypeScript
168 lines
6.6 KiB
TypeScript
import { Bug, Check, ExternalLink, Loader2 } from 'lucide-react'
|
|
import { useMemo, useState } from 'react'
|
|
import { createPortal } from 'react-dom'
|
|
import { t, type TKey } from '../../i18n'
|
|
import { techInfo } from '../../lib/appInfo'
|
|
import { useBackToClose } from '../../lib/backNav'
|
|
import { BUG_DESCRIPTION_MAX, BUG_DESCRIPTION_MIN, submitBugReport } from '../../lib/cloud/moderation'
|
|
import { useEscape } from '../../lib/escape'
|
|
import { useScrollLock } from '../../lib/scrollLock'
|
|
import { useMedia } from '../../store'
|
|
|
|
/** Contact de l'éditeur (sans compte, le formulaire n'est pas disponible). */
|
|
export const SUPPORT_URL = 'https://rdacet.fr'
|
|
|
|
const INFO_LABEL: Record<string, TKey> = {
|
|
version: 'bug.info.version',
|
|
browser: 'bug.info.browser',
|
|
os: 'bug.info.os',
|
|
lang: 'bug.info.lang',
|
|
theme: 'bug.info.theme',
|
|
screen: 'bug.info.screen',
|
|
viewport: 'bug.info.viewport',
|
|
route: 'bug.info.route',
|
|
standalone: 'bug.info.standalone',
|
|
online: 'bug.info.online',
|
|
}
|
|
|
|
/** Ligne « Signaler un bug » de la section « À propos » des réglages. */
|
|
export function BugReportRow() {
|
|
const { account } = useMedia()
|
|
const [open, setOpen] = useState(false)
|
|
if (!account) {
|
|
return (
|
|
<a href={SUPPORT_URL} target="_blank" rel="noopener" className="flex items-center gap-3.5 px-4 py-4 transition-colors active:bg-surface-2">
|
|
<Bug size={19} className="text-ink-2" />
|
|
<span className="flex-1">
|
|
<span className="block font-medium">{t('bug.title')}</span>
|
|
<span className="mt-0.5 block text-xs text-ink-3">{t('bug.hintLocal')}</span>
|
|
</span>
|
|
<ExternalLink size={16} className="text-ink-3" />
|
|
</a>
|
|
)
|
|
}
|
|
return (
|
|
<>
|
|
<button type="button" onClick={() => setOpen(true)} className="flex w-full items-center gap-3.5 px-4 py-4 text-start transition-colors active:bg-surface-2">
|
|
<Bug size={19} className="text-ink-2" />
|
|
<span className="flex-1">
|
|
<span className="block font-medium">{t('bug.title')}</span>
|
|
<span className="mt-0.5 block text-xs text-ink-3">{t('bug.hint')}</span>
|
|
</span>
|
|
<span className="text-ink-3">→</span>
|
|
</button>
|
|
{open && createPortal(<BugReportDialog onClose={() => setOpen(false)} />, document.body)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
/** Formulaire « Signaler un bug » : description + infos techniques (montrées avant l'envoi, rien de personnel). */
|
|
export default function BugReportDialog({ onClose }: { onClose: () => void }) {
|
|
const { settings } = useMedia()
|
|
const info = useMemo(() => techInfo(settings.themeMode), [settings.themeMode])
|
|
const [text, setText] = useState('')
|
|
const [busy, setBusy] = useState(false)
|
|
const [error, setError] = useState<string>()
|
|
const [done, setDone] = useState(false)
|
|
useScrollLock()
|
|
useEscape(onClose)
|
|
useBackToClose(onClose)
|
|
|
|
const tooShort = text.trim().length < BUG_DESCRIPTION_MIN
|
|
|
|
const submit = async () => {
|
|
if (tooShort || busy) return
|
|
setBusy(true)
|
|
setError(undefined)
|
|
try {
|
|
await submitBugReport(text, info)
|
|
setDone(true)
|
|
} catch (e) {
|
|
setError((e as Error).message)
|
|
} finally {
|
|
setBusy(false)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="fixed inset-0 z-[80] flex touch-none items-end justify-center overscroll-none bg-scrim sm:items-center sm:p-4" onClick={onClose}>
|
|
<div
|
|
role="dialog"
|
|
aria-modal="true"
|
|
aria-labelledby="bug-title"
|
|
className="sheet-in safe-bottom max-h-[92dvh] w-full max-w-lg touch-pan-y overflow-y-auto overscroll-contain rounded-t-3xl border border-line-strong bg-surface p-5 sm:rounded-3xl"
|
|
onClick={(e) => e.stopPropagation()}
|
|
>
|
|
{done ? (
|
|
<div className="flex flex-col items-center py-4 text-center">
|
|
<span className="grid size-12 place-items-center rounded-full border border-line-strong text-accent">
|
|
<Check size={22} />
|
|
</span>
|
|
<h2 id="bug-title" className="mt-4 text-lg font-semibold">
|
|
{t('bug.thanks')}
|
|
</h2>
|
|
<p className="mt-2 text-sm leading-relaxed text-ink-2">{t('bug.thanksText')}</p>
|
|
<button type="button" onClick={onClose} className="btn btn-ghost mt-6 w-full" autoFocus>
|
|
{t('common.close')}
|
|
</button>
|
|
</div>
|
|
) : (
|
|
<>
|
|
<h2 id="bug-title" className="flex items-center gap-2 text-lg font-semibold">
|
|
<Bug size={18} className="text-accent" />
|
|
{t('bug.title')}
|
|
</h2>
|
|
<p className="mt-1.5 text-sm text-ink-3">{t('bug.intro')}</p>
|
|
|
|
<label className="mt-4 block">
|
|
<span className="label">{t('bug.description')}</span>
|
|
<textarea
|
|
className="field min-h-32 resize-y text-sm"
|
|
maxLength={BUG_DESCRIPTION_MAX}
|
|
value={text}
|
|
onChange={(e) => setText(e.target.value)}
|
|
placeholder={t('bug.placeholder')}
|
|
autoFocus
|
|
/>
|
|
<span className="mt-1 block text-end text-[11px] tabular-nums text-ink-3">
|
|
{text.length}/{BUG_DESCRIPTION_MAX}
|
|
</span>
|
|
</label>
|
|
|
|
<details className="mt-2 rounded-xl border border-line px-3.5 py-2.5 text-sm" open>
|
|
<summary className="cursor-pointer font-medium text-ink-2">{t('bug.techTitle')}</summary>
|
|
<dl className="mt-2 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs">
|
|
{Object.entries(info).map(([k, v]) => (
|
|
<div key={k} className="contents">
|
|
<dt className="text-ink-3">{INFO_LABEL[k] ? t(INFO_LABEL[k]) : k}</dt>
|
|
<dd className="min-w-0 break-words text-ink-2" dir="ltr">
|
|
{v}
|
|
</dd>
|
|
</div>
|
|
))}
|
|
</dl>
|
|
<p className="mt-2 text-[11px] leading-relaxed text-ink-3">{t('bug.techPrivacy')}</p>
|
|
</details>
|
|
|
|
{error && (
|
|
<p role="alert" className="mt-3 rounded-xl border border-accent px-3 py-2 text-sm text-ink">
|
|
{error}
|
|
</p>
|
|
)}
|
|
|
|
<div className="mt-4 grid grid-cols-2 gap-2">
|
|
<button type="button" onClick={onClose} className="btn btn-ghost">
|
|
{t('common.cancel')}
|
|
</button>
|
|
<button type="button" onClick={submit} disabled={tooShort || busy} className="btn btn-primary">
|
|
{busy && <Loader2 size={16} className="animate-spin" />}
|
|
{t('bug.send')}
|
|
</button>
|
|
</div>
|
|
</>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|