Profil public : lien bobinoo.org/@pseudo visible sans compte (au choix)
deploy / deploy (push) Successful in 1m5s

Nouveau réglage « Profil visible sans compte » dans Modifier le profil,
désactivé par défaut et sans effet sur un compte privé. Une fois activé,
le lien bobinoo.org/@pseudo s'ouvre pour tout le monde : photo, bio,
Top 5, titres en cours et derniers vus, avec les notes. Les avis et la
bibliothèque complète restent réservés aux membres.

Côté base, public_profile() est la seule fonction ouverte sans compte :
elle renvoie null pour un profil non public, privé, suspendu ou inconnu
(pas moyen de deviner si un pseudo existe) et ne renvoie que le strict
nécessaire de chaque fiche. Le lien n'est pas indexé par les moteurs de
recherche. Un membre connecté qui ouvre le lien voit le profil comme
avant ; un visiteur peut s'abonner ou rejoindre Bobinoo depuis la page.

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-12-02 11:14:33 +00:00
1 parent e161930e82
commit 116efa4a30
31 files changed
+486 -39

No files matched your search

+1
View File
@@ -95,3 +95,4 @@ npm run build # build de prod
- **Langue automatique (2 déc. 2026)** : `detectLang()` (`src/i18n/index.ts`) suit la langue du téléphone si Bobinoo la parle (parmi plusieurs, celle du pays du fuseau horaire), sinon l'anglais. Le pays ne s'impose plus (un anglophone à Paris lit en anglais). Le pays sert toujours aux plateformes de streaming et aux sorties (`detectRegion`). Un choix fait à la main dans Réglages → Langue reste prioritaire. - **Langue automatique (2 déc. 2026)** : `detectLang()` (`src/i18n/index.ts`) suit la langue du téléphone si Bobinoo la parle (parmi plusieurs, celle du pays du fuseau horaire), sinon l'anglais. Le pays ne s'impose plus (un anglophone à Paris lit en anglais). Le pays sert toujours aux plateformes de streaming et aux sorties (`detectRegion`). Un choix fait à la main dans Réglages → Langue reste prioritaire.
- **Recadrage photo de profil / bannière (2 déc. 2026)** : `components/social/ImageCropper.tsx` (glisser, pincer, molette, curseur, flèches du clavier ; l'image couvre toujours le cadre), sortie JPEG sans métadonnées via `cropToJpeg` (`lib/image.ts`) : 400 × 400 pour la photo, 1500 × 500 pour la bannière. Ouvert par `EditProfile` après le choix d'une photo. - **Recadrage photo de profil / bannière (2 déc. 2026)** : `components/social/ImageCropper.tsx` (glisser, pincer, molette, curseur, flèches du clavier ; l'image couvre toujours le cadre), sortie JPEG sans métadonnées via `cropToJpeg` (`lib/image.ts`) : 400 × 400 pour la photo, 1500 × 500 pour la bannière. Ouvert par `EditProfile` après le choix d'une photo.
- **Bilan de l'année (2 déc. 2026)** : calcul dans `lib/recap.ts` (`yearRecap`, tout sur l'appareil, mêmes chiffres que la page Stats pour l'année), pages type story dans `components/YearRecap.tsx`, entrées dans `components/RecapEntry.tsx` : bouton « Mon année » sur la page Stats (année filtrée, sinon l'année en cours) et carte sur l'accueil en décembre (année en cours) et janvier (année passée) dès 3 titres terminés, masquable (clé `azuucine:recap-hint-<année>`). Image à partager : `renderRecapCard` dans `lib/shareCard.ts`. - **Bilan de l'année (2 déc. 2026)** : calcul dans `lib/recap.ts` (`yearRecap`, tout sur l'appareil, mêmes chiffres que la page Stats pour l'année), pages type story dans `components/YearRecap.tsx`, entrées dans `components/RecapEntry.tsx` : bouton « Mon année » sur la page Stats (année filtrée, sinon l'année en cours) et carte sur l'accueil en décembre (année en cours) et janvier (année passée) dès 3 titres terminés, masquable (clé `azuucine:recap-hint-<année>`). Image à partager : `renderRecapCard` dans `lib/shareCard.ts`.
- **Profil public (2 déc. 2026)** : lien `bobinoo.org/@pseudo` (`profileLink`, `profileFromPath` dans `lib/cloud/social.ts`). Connecté : le profil s'ouvre normalement. Sans compte : mode découverte le temps de la visite (`Root.tsx`, rien n'est retenu) et `ProfileView` en mode `guest`, qui lit `public_profile` (seule fonction ouverte à `anon`, voir `docs/database.md`) ; pas de bibliothèque complète, « S'abonner » et « Rejoindre Bobinoo » ouvrent la demande de compte. Opt-in : `profiles.public_link`, interrupteur « Profil visible sans compte » dans `EditProfile` (sans effet si le compte est privé). nginx sert `index.html` pour `/@pseudo` avec `X-Robots-Tag: noindex` (`deploy/nginx/site.conf`), le service worker aussi (`navigateFallbackAllowlist`). Les anciens liens `#/u/pseudo` marchent toujours.
+9
View File
@@ -38,6 +38,15 @@ server {
try_files $uri =404; try_files $uri =404;
} }
# Lien de profil (bobinoo.org/@pseudo) : c'est l'app qui l'affiche. Pas d'indexation par les moteurs de recherche :
# un profil rendu public sert à être partagé par lien, pas à sortir dans Google.
location ~ "^/@[A-Za-z0-9_]{3,20}/?$" {
include /srv/bobinoo/current/nginx/security-headers.conf;
add_header Cache-Control "public, max-age=0, must-revalidate" always;
add_header X-Robots-Tag "noindex, nofollow" always;
try_files /index.html =404;
}
location / { location / {
include /srv/bobinoo/current/nginx/security-headers.conf; include /srv/bobinoo/current/nginx/security-headers.conf;
add_header Cache-Control "public, max-age=0, must-revalidate" always; add_header Cache-Control "public, max-age=0, must-revalidate" always;
+5
View File
@@ -19,6 +19,11 @@ système de Postgres et de Supabase. Les fiches (`items`) pèsent ~0,5 Mo pour 2
(`20261201130000_mfa_everywhere.sql` : bloquer, supprimer un commentaire, gérer une liste partagée, `get_profile`, (`20261201130000_mfa_everywhere.sql` : bloquer, supprimer un commentaire, gérer une liste partagée, `get_profile`,
photos de profil dans le stockage). Toute nouvelle fonction appelable par l'app doit vérifier `azuu_mfa_ok()` photos de profil dans le stockage). Toute nouvelle fonction appelable par l'app doit vérifier `azuu_mfa_ok()`
(directement ou via `can_view`, `azuu_me_active`, `azuu_sl_member`, `azuu_sl_owner`). (directement ou via `can_view`, `azuu_me_active`, `azuu_sl_member`, `azuu_sl_owner`).
**Seule exception** : `public_profile(p_username)`, ouverte sans compte (rôle `anon`) pour le lien
bobinoo.org/@pseudo. Elle ne renvoie un profil que si la personne a activé `profiles.public_link` (désactivé par
défaut) et que le compte n'est ni privé ni suspendu, réduit au strict nécessaire (`azuu_public_item_min` : titre,
affiche, type, année, note, genres, Top 5 ; ni avis, ni dates, ni notes perso). Sinon `null`, que le pseudo
existe ou non (`20261202120000_public_profile_link.sql`).
## Tables ## Tables
+2 -1
View File
@@ -35,6 +35,7 @@
<ul> <ul>
<li>Ton adresse e-mail n'est jamais visible par les autres utilisateurs.</li> <li>Ton adresse e-mail n'est jamais visible par les autres utilisateurs.</li>
<li>Ton profil (pseudo, nom, photo, bannière, bio, titres vus, notes, avis) est visible par les utilisateurs connectés. Si tu passes ton compte en <strong>privé</strong> (Modifier le profil → Compte privé), seules les personnes que tu acceptes peuvent le voir.</li> <li>Ton profil (pseudo, nom, photo, bannière, bio, titres vus, notes, avis) est visible par les utilisateurs connectés. Si tu passes ton compte en <strong>privé</strong> (Modifier le profil → Compte privé), seules les personnes que tu acceptes peuvent le voir.</li>
<li>Si tu actives <strong>Profil visible sans compte</strong> (Modifier le profil), ton lien bobinoo.org/@pseudo s'ouvre aussi pour les personnes sans compte : photo, bannière, nom, bio, top 5, titres en cours, derniers titres vus et leurs notes. Tes avis et ta bibliothèque complète restent réservés aux membres. Ce lien n'est pas indexé par les moteurs de recherche. C'est désactivé par défaut, et sans effet sur un compte privé.</li>
<li>Tes listes personnelles et tes réglages restent privés.</li> <li>Tes listes personnelles et tes réglages restent privés.</li>
<li>L'éditeur, en tant qu'administrateur, peut retirer un contenu ou suspendre un compte qui ne respecte pas les <a href="/legal.html#conditions">conditions d'utilisation</a>.</li> <li>L'éditeur, en tant qu'administrateur, peut retirer un contenu ou suspendre un compte qui ne respecte pas les <a href="/legal.html#conditions">conditions d'utilisation</a>.</li>
</ul> </ul>
@@ -80,7 +81,7 @@
<section class="en" lang="en"> <section class="en" lang="en">
<h2>Privacy policy (English summary)</h2> <h2>Privacy policy (English summary)</h2>
<p>Bobinoo is a free, ad-free personal watch journal published by Romain Dacet (data controller, contact: <a href="mailto:contact@bobinoo.org">contact@bobinoo.org</a>). It works without an account (everything stays on your device). With an account, it stores your email (and your name if you sign in with Google), your library, ratings, reviews, profile, follows and emoji reactions, to provide the service (contract). Your email is never shown to other users; your profile is visible to signed-in users unless you make your account private. Data is hosted by Supabase in the EU (Ireland); the site files are served, and account emails (address confirmation, password reset) sent from bobinoo.org, by OVH (France). Title data and posters come from TMDB and AniList, which see your IP address when your browser loads their images, but never your account data. No cookies, no trackers, no ads, no marketing emails, nothing sold; on-device storage is strictly necessary. Data is kept while your account exists and deleted immediately and completely when you delete it. You must be 13 or older, with a parent's consent if under 15. You can access, correct, export or delete your data from Settings, contact the publisher for any other request, and complain to the CNIL.</p> <p>Bobinoo is a free, ad-free personal watch journal published by Romain Dacet (data controller, contact: <a href="mailto:contact@bobinoo.org">contact@bobinoo.org</a>). It works without an account (everything stays on your device). With an account, it stores your email (and your name if you sign in with Google), your library, ratings, reviews, profile, follows and emoji reactions, to provide the service (contract). Your email is never shown to other users; your profile is visible to signed-in users unless you make your account private, and to anyone with your bobinoo.org/@username link only if you turn on “Profile visible without an account” (off by default; your reviews and full library stay members-only). Data is hosted by Supabase in the EU (Ireland); the site files are served, and account emails (address confirmation, password reset) sent from bobinoo.org, by OVH (France). Title data and posters come from TMDB and AniList, which see your IP address when your browser loads their images, but never your account data. No cookies, no trackers, no ads, no marketing emails, nothing sold; on-device storage is strictly necessary. Data is kept while your account exists and deleted immediately and completely when you delete it. You must be 13 or older, with a parent's consent if under 15. You can access, correct, export or delete your data from Settings, contact the publisher for any other request, and complain to the CNIL.</p>
</section> </section>
<footer><a href="/">← Retour à Bobinoo</a></footer> <footer><a href="/">← Retour à Bobinoo</a></footer>
+4 -1
View File
@@ -4,6 +4,7 @@ import AuthScreen, { MfaScreen, NewPasswordScreen } from './components/AuthScree
import GuestPrompt, { GuestBanner } from './components/guest/GuestPrompt' import GuestPrompt, { GuestBanner } from './components/guest/GuestPrompt'
import { consumeAuthRedirect, getSession, hasOAuthRedirect, knownMfa, onSessionChange, pendingMfaFactor, sessionAal, type Session } from './lib/cloud/auth' import { consumeAuthRedirect, getSession, hasOAuthRedirect, knownMfa, onSessionChange, pendingMfaFactor, sessionAal, type Session } from './lib/cloud/auth'
import { cloudEnabled } from './lib/cloud/config' import { cloudEnabled } from './lib/cloud/config'
import { profileFromPath } from './lib/cloud/social'
import { setScope } from './lib/scope' import { setScope } from './lib/scope'
import { MediaProvider } from './store' import { MediaProvider } from './store'
@@ -36,7 +37,9 @@ export default function Root() {
cloudEnabled && (/(^#|&)(access_token|error)=/.test(location.hash) || hasOAuthRedirect()) ? 'checking' : 'none', cloudEnabled && (/(^#|&)(access_token|error)=/.test(location.hash) || hasOAuthRedirect()) ? 'checking' : 'none',
) )
const [notice, setNotice] = useState<string>() const [notice, setNotice] = useState<string>()
const [guest, setGuest] = useState(readGuest) // Lien de profil (bobinoo.org/@pseudo) ouvert sans être connecté : mode découverte, le temps de la visite
// (rien n'est retenu : au prochain lancement, l'écran de connexion revient)
const [guest, setGuest] = useState(() => readGuest() || (cloudEnabled && !getSession() && !!profileFromPath()))
const [ask, setAsk] = useState(false) const [ask, setAsk] = useState(false)
// Écran de connexion demandé depuis le mode découverte (« Se connecter » / « Créer un compte ») // Écran de connexion demandé depuis le mode découverte (« Se connecter » / « Créer un compte »)
const [authMode, setAuthMode] = useState<'login' | 'signup'>('login') const [authMode, setAuthMode] = useState<'login' | 'signup'>('login')
+2 -1
View File
@@ -90,7 +90,8 @@ export default function TopFive({ onOpen, items: others }: { onOpen: (item: Medi
) )
} }
> >
{t('top.title')} <span className="text-accent">5</span> {/* « Mes Top 5 » pour le mien ; « Top 5 » pour celui d'un autre profil */}
{readOnly ? t('social.top5') : <>{t('top.title')} <span className="text-accent">5</span></>}
</SectionTitle> </SectionTitle>
{/* Choix de la catégorie */} {/* Choix de la catégorie */}
+25 -2
View File
@@ -1,4 +1,4 @@
import { Camera, ImagePlus, Loader2, Lock, Trash2 } from 'lucide-react' import { Camera, Globe, ImagePlus, Loader2, Lock, Trash2 } from 'lucide-react'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { t } from '../../i18n' import { t } from '../../i18n'
import { deleteProfileImage, updateProfile, uploadProfileImage, USERNAME_RE, type ProfilePatch } from '../../lib/cloud/social' import { deleteProfileImage, updateProfile, uploadProfileImage, USERNAME_RE, type ProfilePatch } from '../../lib/cloud/social'
@@ -9,13 +9,14 @@ import ImageCropper from './ImageCropper'
import Sheet from './Sheet' import Sheet from './Sheet'
import { useSocial } from './SocialProvider' import { useSocial } from './SocialProvider'
/** Modifier mon profil : photo, bannière, nom, pseudo, bio, compte privé. */ /** Modifier mon profil : photo, bannière, nom, pseudo, bio, compte privé, lien public. */
export default function EditProfile({ onClose }: { onClose: () => void }) { export default function EditProfile({ onClose }: { onClose: () => void }) {
const { me, refresh } = useSocial() const { me, refresh } = useSocial()
const [displayName, setDisplayName] = useState(me?.displayName ?? '') const [displayName, setDisplayName] = useState(me?.displayName ?? '')
const [username, setUsername] = useState(me?.username ?? '') const [username, setUsername] = useState(me?.username ?? '')
const [bio, setBio] = useState(me?.bio ?? '') const [bio, setBio] = useState(me?.bio ?? '')
const [isPrivate, setIsPrivate] = useState(me?.isPrivate ?? false) const [isPrivate, setIsPrivate] = useState(me?.isPrivate ?? false)
const [publicLink, setPublicLink] = useState(me?.publicLink ?? false)
const [avatar, setAvatar] = useState<{ blob?: Blob; preview?: string; removed?: boolean }>({ preview: me?.avatarUrl }) const [avatar, setAvatar] = useState<{ blob?: Blob; preview?: string; removed?: boolean }>({ preview: me?.avatarUrl })
const [banner, setBanner] = useState<{ blob?: Blob; preview?: string; removed?: boolean }>({ preview: me?.bannerUrl }) const [banner, setBanner] = useState<{ blob?: Blob; preview?: string; removed?: boolean }>({ preview: me?.bannerUrl })
const [saving, setSaving] = useState(false) const [saving, setSaving] = useState(false)
@@ -73,6 +74,7 @@ export default function EditProfile({ onClose }: { onClose: () => void }) {
if (cleanUsername !== me.username) patch.username = cleanUsername if (cleanUsername !== me.username) patch.username = cleanUsername
if (bio.trim() !== me.bio) patch.bio = bio.trim() if (bio.trim() !== me.bio) patch.bio = bio.trim()
if (isPrivate !== me.isPrivate) patch.is_private = isPrivate if (isPrivate !== me.isPrivate) patch.is_private = isPrivate
if (publicLink !== !!me.publicLink) patch.public_link = publicLink
if (avatar.blob) { if (avatar.blob) {
patch.avatar_url = await uploadProfileImage('avatar', avatar.blob) patch.avatar_url = await uploadProfileImage('avatar', avatar.blob)
uploaded.push(patch.avatar_url) uploaded.push(patch.avatar_url)
@@ -186,6 +188,27 @@ export default function EditProfile({ onClose }: { onClose: () => void }) {
</span> </span>
</button> </button>
{/* Lien bobinoo.org/@pseudo ouvert sans compte : sans effet tant que le compte est privé */}
<button
type="button"
role="switch"
aria-checked={publicLink && !isPrivate}
disabled={isPrivate}
onClick={() => setPublicLink((v) => !v)}
className="flex w-full items-center gap-3 rounded-2xl border border-line px-4 py-3.5 text-start disabled:opacity-60"
>
<Globe size={18} className="shrink-0 text-ink-2" />
<span className="flex-1">
<span className="block text-sm font-medium">{t('social.publicLink')}</span>
<span className="mt-0.5 block text-xs text-ink-3">
{isPrivate ? t('social.publicLinkPrivate') : t('social.publicLinkHint', { link: `bobinoo.org/@${usernameOk ? cleanUsername : me.username}` })}
</span>
</span>
<span className={cx('relative h-6 w-11 shrink-0 rounded-full transition-colors', publicLink && !isPrivate ? 'bg-accent-fill' : 'bg-surface-2 border border-line-strong')}>
<span className={cx('absolute top-0.5 size-5 rounded-full bg-ink transition-all', publicLink && !isPrivate ? 'start-[22px] bg-on-accent' : 'start-0.5')} />
</span>
</button>
{error && ( {error && (
<p role="alert" className="rounded-xl border border-accent px-3 py-2.5 text-sm"> <p role="alert" className="rounded-xl border border-accent px-3 py-2.5 text-sm">
{error} {error}
+50 -16
View File
@@ -1,7 +1,7 @@
import { Ban, Check, Loader2, Lock, Share2, Star, UserCheck, UserPlus } from 'lucide-react' import { Ban, Check, Loader2, Lock, Share2, Star, UserCheck, UserPlus } from 'lucide-react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { fmtNumber, t } from '../../i18n' import { fmtNumber, t } from '../../i18n'
import { follow, getProfile, getProfileItems, PROFILE_ITEMS_PAGE, profileLink, unfollow, type Profile } from '../../lib/cloud/social' import { follow, getProfile, getProfileItems, getPublicProfile, PROFILE_ITEMS_PAGE, profileLink, unfollow, type Profile } from '../../lib/cloud/social'
import { STATUSES, TOP_CATEGORIES } from '../../lib/constants' import { STATUSES, TOP_CATEGORIES } from '../../lib/constants'
import { cx, formatRating } from '../../lib/utils' import { cx, formatRating } from '../../lib/utils'
import { useMedia } from '../../store' import { useMedia } from '../../store'
@@ -50,10 +50,14 @@ function Stat({ value, label, onClick }: { value?: number; label: string; onClic
) )
} }
/** Page de profil (la mienne ou celle d'un autre). */ /**
export default function ProfileView({ username, onClose }: { username: string; onClose: () => void }) { * Page de profil (la mienne ou celle d'un autre).
* `guest` : ouverte sans compte depuis un lien bobinoo.org/@pseudo. Seulement la version publique du profil
* (si la personne l'a activée), et chaque geste (suivre, voir la bibliothèque) propose de créer un compte.
*/
export default function ProfileView({ username, onClose, guest = false }: { username: string; onClose: () => void; guest?: boolean }) {
const social = useSocial() const social = useSocial()
const { settings, items: myItems } = useMedia() const { settings, items: myItems, requestAccount } = useMedia()
// Mon profil : affiché tout de suite avec ce qu'on a déjà, puis rechargé // Mon profil : affiché tout de suite avec ce qu'on a déjà, puis rechargé
const [profile, setProfile] = useState<Profile | null | undefined>(() => (social.me?.username === username ? social.me : undefined)) const [profile, setProfile] = useState<Profile | null | undefined>(() => (social.me?.username === username ? social.me : undefined))
const [error, setError] = useState<string>() const [error, setError] = useState<string>()
@@ -62,7 +66,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
const [confirmUnfollow, setConfirmUnfollow] = useState(false) const [confirmUnfollow, setConfirmUnfollow] = useState(false)
const [toast, setToast] = useState<string>() const [toast, setToast] = useState<string>()
const [confirmBlock, setConfirmBlock] = useState(false) const [confirmBlock, setConfirmBlock] = useState(false)
const { isBlocked } = useBlocked(!!profile && !profile.isMe) const { isBlocked } = useBlocked(!guest && !!profile && !profile.isMe)
const blocked = !!profile && !profile.isMe && isBlocked(profile.id) const blocked = !!profile && !profile.isMe && isBlocked(profile.id)
/** `reload` : rechargement après une action (s'abonner, bloquer…) — en cas d'échec, on garde le profil affiché. */ /** `reload` : rechargement après une action (s'abonner, bloquer…) — en cas d'échec, on garde le profil affiché. */
@@ -70,7 +74,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
async (reload = false) => { async (reload = false) => {
if (!reload) setError(undefined) if (!reload) setError(undefined)
try { try {
const next = await getProfile(username) const next = await (guest ? getPublicProfile(username) : getProfile(username))
if (reload) setError(undefined) if (reload) setError(undefined)
setProfile(next) setProfile(next)
} catch (e) { } catch (e) {
@@ -79,7 +83,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
setProfile(null) setProfile(null)
} }
}, },
[username], [username, guest],
) )
useEffect(() => { useEffect(() => {
@@ -104,11 +108,15 @@ export default function ProfileView({ username, onClose }: { username: string; o
const share = async () => { const share = async () => {
if (!profile) return if (!profile) return
const url = profileLink(profile.username) const url = profileLink(profile.username)
// Mon lien, pas encore public : il ne s'ouvrira que pour les membres connectés (on le dit, sans bloquer le partage)
const membersOnly = profile.isMe && !profile.publicLink
try { try {
if (navigator.share && window.matchMedia?.('(pointer: coarse)').matches) await navigator.share({ title: profile.displayName, url }) if (navigator.share && window.matchMedia?.('(pointer: coarse)').matches) {
else { await navigator.share({ title: profile.displayName, url })
if (membersOnly) setToast(t('social.linkMembersOnly'))
} else {
await navigator.clipboard.writeText(url) await navigator.clipboard.writeText(url)
setToast(t('social.linkCopied')) setToast(membersOnly ? `${t('social.linkCopied')} ${t('social.linkMembersOnly')}` : t('social.linkCopied'))
} }
} catch { } catch {
/* partage annulé */ /* partage annulé */
@@ -190,6 +198,8 @@ export default function ProfileView({ username, onClose }: { username: string; o
// Mon profil : l'onglet Top 5 est toujours là (c'est ici qu'on le modifie) ; un autre : seulement s'il en a un // Mon profil : l'onglet Top 5 est toujours là (c'est ici qu'on le modifie) ; un autre : seulement s'il en a un
const showTop = !!profile && (profile.isMe ? settings.topCategories.length > 0 : topByCategory.length > 0) const showTop = !!profile && (profile.isMe ? settings.topCategories.length > 0 : topByCategory.length > 0)
// Sans compte : pas de bibliothèque complète (réservée aux membres)
const tabs = (['profile', ...(showTop ? ['top'] : []), ...(guest ? [] : ['library'])] as ('profile' | 'top' | 'library')[])
return ( return (
<Sheet <Sheet
@@ -211,7 +221,16 @@ export default function ProfileView({ username, onClose }: { username: string; o
</p> </p>
) : profile === null ? ( ) : profile === null ? (
<div className="px-4"> <div className="px-4">
<EmptyState title={error ? t('social.loadError') : t('social.notFound')} text={error ?? t('social.notFoundHint', { username })} /> {guest && !error ? (
<>
<EmptyState title={t('social.publicNotFound')} text={t('social.publicNotFoundHint')} />
<button onClick={requestAccount} className="btn btn-primary mx-auto mt-5 flex px-5 py-2.5">
{t('social.publicJoin')}
</button>
</>
) : (
<EmptyState title={error ? t('social.loadError') : t('social.notFound')} text={error ?? t('social.notFoundHint', { username })} />
)}
</div> </div>
) : ( ) : (
<> <>
@@ -227,6 +246,10 @@ export default function ProfileView({ username, onClose }: { username: string; o
<button onClick={social.openEdit} className="btn btn-ghost mt-[3.5rem] px-4 py-2 text-sm lg:mt-[4.25rem]"> <button onClick={social.openEdit} className="btn btn-ghost mt-[3.5rem] px-4 py-2 text-sm lg:mt-[4.25rem]">
{t('social.editProfile')} {t('social.editProfile')}
</button> </button>
) : guest ? (
<button onClick={requestAccount} className="btn btn-primary mt-[3.5rem] px-4 py-2 text-sm lg:mt-[4.25rem]">
<UserPlus size={15} /> {t('social.follow')}
</button>
) : ( ) : (
<div className="mt-[3.5rem] flex items-center gap-1 lg:mt-[4.25rem]"> <div className="mt-[3.5rem] flex items-center gap-1 lg:mt-[4.25rem]">
{blocked ? ( {blocked ? (
@@ -288,8 +311,8 @@ export default function ProfileView({ username, onClose }: { username: string; o
<div className="mt-5 flex divide-x divide-line rounded-2xl border border-line py-3 lg:max-w-2xl"> <div className="mt-5 flex divide-x divide-line rounded-2xl border border-line py-3 lg:max-w-2xl">
<Stat value={profile.visible ? (profile.seen ?? 0) : undefined} label={t('social.seen')} /> <Stat value={profile.visible ? (profile.seen ?? 0) : undefined} label={t('social.seen')} />
<Stat value={profile.followers} label={t('social.followers', { count: profile.followers })} onClick={profile.visible ? () => social.openFollowList(profile, 'followers') : undefined} /> <Stat value={profile.followers} label={t('social.followers', { count: profile.followers })} onClick={profile.visible && !guest ? () => social.openFollowList(profile, 'followers') : undefined} />
<Stat value={profile.following} label={t('social.followingCount', { count: profile.following })} onClick={profile.visible ? () => social.openFollowList(profile, 'following') : undefined} /> <Stat value={profile.following} label={t('social.followingCount', { count: profile.following })} onClick={profile.visible && !guest ? () => social.openFollowList(profile, 'following') : undefined} />
</div> </div>
{profile.isMe && social.requests.length > 0 && ( {profile.isMe && social.requests.length > 0 && (
@@ -307,8 +330,8 @@ export default function ProfileView({ username, onClose }: { username: string; o
</div> </div>
) : ( ) : (
<> <>
<div className={cx('mt-6 grid gap-1 rounded-md border border-line p-1 lg:max-w-md', showTop ? 'grid-cols-3' : 'grid-cols-2')}> <div className={cx('mt-6 grid gap-1 rounded-md border border-line p-1 lg:max-w-md', tabs.length === 3 ? 'grid-cols-3' : 'grid-cols-2')}>
{(showTop ? (['profile', 'top', 'library'] as const) : (['profile', 'library'] as const)).map((v) => ( {tabs.map((v) => (
<button <button
key={v} key={v}
onClick={() => setTab(v)} onClick={() => setTab(v)}
@@ -319,7 +342,18 @@ export default function ProfileView({ username, onClose }: { username: string; o
))} ))}
</div> </div>
{tab === 'profile' ? ( {tab === 'profile' ? (
<ProfileTab profile={profile} topByCategory={topByCategory} onOpen={openItem} /> <>
<ProfileTab profile={profile} topByCategory={topByCategory} onOpen={openItem} />
{guest && (
<div className="mt-10 rounded-2xl border border-line px-5 py-6 text-center lg:max-w-2xl">
<p className="font-semibold">{t('social.publicCtaTitle')}</p>
<p className="mx-auto mt-1 max-w-sm text-sm text-ink-3">{t('social.publicCtaText', { name: profile.displayName })}</p>
<button onClick={requestAccount} className="btn btn-primary mx-auto mt-4 flex px-5 py-2.5">
{t('social.publicJoin')}
</button>
</div>
)}
</>
) : tab === 'top' ? ( ) : tab === 'top' ? (
<TopTab profile={profile} onOpen={openItem} /> <TopTab profile={profile} onOpen={openItem} />
) : ( ) : (
+21 -14
View File
@@ -1,6 +1,6 @@
import { createContext, Suspense, useCallback, useContext, useEffect, useMemo, useState, type ReactNode } from 'react' import { createContext, Suspense, useCallback, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { lazyPreload } from '../../lib/lazyPreload' import { lazyPreload } from '../../lib/lazyPreload'
import { cachedMyProfile, getFollowRequests, getMyProfile, unreadNotifications, type Profile, type ProfileCard } from '../../lib/cloud/social' import { cachedMyProfile, getFollowRequests, getMyProfile, profileFromPath, unreadNotifications, type Profile, type ProfileCard } from '../../lib/cloud/social'
import { useMedia } from '../../store' import { useMedia } from '../../store'
import type { MediaItem } from '../../types' import type { MediaItem } from '../../types'
import type { PeekOwner } from './ItemPeek' import type { PeekOwner } from './ItemPeek'
@@ -97,7 +97,7 @@ export function SocialProvider({
/** Ouvre la fiche d'un titre pas encore dans ma bibliothèque */ /** Ouvre la fiche d'un titre pas encore dans ma bibliothèque */
onOpenSeed?: (seed: SearchResult) => void onOpenSeed?: (seed: SearchResult) => void
}) { }) {
const { account, items } = useMedia() const { account, items, guest } = useMedia()
const enabled = !!account const enabled = !!account
// Profil gardé sur l'appareil : photo et pseudo tout de suite, sans attendre le serveur // Profil gardé sur l'appareil : photo et pseudo tout de suite, sans attendre le serveur
const [me, setMe] = useState<Profile | null>(() => (enabled ? cachedMyProfile() : null)) const [me, setMe] = useState<Profile | null>(() => (enabled ? cachedMyProfile() : null))
@@ -161,28 +161,34 @@ export function SocialProvider({
const push = useCallback((o: Overlay) => setStack((s) => [...s.slice(-8), { ...o, uid: ++overlayUid }]), []) const push = useCallback((o: Overlay) => setStack((s) => [...s.slice(-8), { ...o, uid: ++overlayUid }]), [])
const close = useCallback((uid: number) => setStack((s) => s.filter((x) => x.uid !== uid)), []) const close = useCallback((uid: number) => setStack((s) => s.filter((x) => x.uid !== uid)), [])
// Lien partagé « #/u/pseudo » // Lien partagé « bobinoo.org/@pseudo » (ou l'ancien « #/u/pseudo ») : le profil s'ouvre par-dessus l'accueil.
// Sans compte (mode découverte), c'est la version publique, si la personne l'a activée.
useEffect(() => { useEffect(() => {
if (!enabled) return if (!enabled && !guest) return
const check = () => { const check = () => {
const m = location.hash.match(/^#\/u\/([a-z0-9_]{3,20})$/i) const name = profileFromPath() ?? location.hash.match(/^#\/u\/([a-z0-9_]{3,20})$/i)?.[1].toLowerCase()
if (!m) return if (!name) return
history.replaceState(null, '', `${location.pathname}${location.search}#/home`) history.replaceState(null, '', `/${location.search}#/home`)
push({ kind: 'profile', username: m[1].toLowerCase() }) push({ kind: 'profile', username: name })
} }
check() check()
window.addEventListener('hashchange', check) window.addEventListener('hashchange', check)
return () => window.removeEventListener('hashchange', check) return () => window.removeEventListener('hashchange', check)
}, [enabled, push]) }, [enabled, guest, push])
const openItem = useCallback( const openItem = useCallback(
(item: MediaItem, owner?: PeekOwner) => { (item: MediaItem, owner?: PeekOwner) => {
// Sans compte (profil public) : la fiche du catalogue, en lecture seule
if (!enabled) {
if (item.externalId) void openTitleRef.current({ externalId: item.externalId, title: item.title, poster: item.poster, type: item.type, year: item.year, addedAt: '', addedBy: null })
return
}
const mine = !owner || owner.username === me?.username const mine = !owner || owner.username === me?.username
const local = mine ? items.find((i) => i.id === item.id) : undefined const local = mine ? items.find((i) => i.id === item.id) : undefined
if (local) onOpenOwnItem(local) if (local) onOpenOwnItem(local)
else setPeeked({ item, owner }) else setPeeked({ item, owner })
}, },
[items, me?.username, onOpenOwnItem], [enabled, items, me?.username, onOpenOwnItem],
) )
const openTitle = useCallback( const openTitle = useCallback(
@@ -208,6 +214,8 @@ export function SocialProvider({
}, },
[items, onOpenOwnItem, onOpenSeed], [items, onOpenOwnItem, onOpenSeed],
) )
const openTitleRef = useRef(openTitle)
openTitleRef.current = openTitle
const api = useMemo<SocialApi>( const api = useMemo<SocialApi>(
() => ({ () => ({
@@ -235,11 +243,10 @@ export function SocialProvider({
return ( return (
<SocialContext.Provider value={api}> <SocialContext.Provider value={api}>
{/* Les écrans sociaux sont placés avant l'app : une fiche ouverte depuis un profil passe au-dessus */} {/* Les écrans sociaux sont placés avant l'app : une fiche ouverte depuis un profil passe au-dessus */}
{enabled && {(enabled ? stack : guest ? stack.filter((o) => o.kind === 'profile') : []).map((o) => (
stack.map((o) => (
<Suspense key={o.uid} fallback={null}> <Suspense key={o.uid} fallback={null}>
{o.kind === 'profile' ? ( {o.kind === 'profile' ? (
<ProfileView key={o.uid} username={o.username} onClose={() => close(o.uid)} /> <ProfileView key={o.uid} username={o.username} guest={!enabled} onClose={() => close(o.uid)} />
) : o.kind === 'search' ? ( ) : o.kind === 'search' ? (
<PeopleSearch key={o.uid} onClose={() => close(o.uid)} /> <PeopleSearch key={o.uid} onClose={() => close(o.uid)} />
) : o.kind === 'edit' ? ( ) : o.kind === 'edit' ? (
+9
View File
@@ -1226,6 +1226,15 @@ const dict: Translations = {
"recap.prev": "السابق", "recap.prev": "السابق",
"recap.cardTitle": "سنتي", "recap.cardTitle": "سنتي",
"recap.shareTitle": "سنتي {year} على Bobinoo", "recap.shareTitle": "سنتي {year} على Bobinoo",
"social.publicLink": "ملف ظاهر بدون حساب",
"social.publicLinkHint": "رابطك {link} يُفتح أيضًا بدون حساب: الصورة والنبذة وأفضل 5 وما تشاهده الآن وآخر ما شاهدته، مع تقييماتك. آراؤك ومكتبتك الكاملة تبقى للأعضاء فقط.",
"social.publicLinkPrivate": "حسابك خاص: حتى مع الرابط، لا يرى ملفك إلا متابعوك.",
"social.linkMembersOnly": "حاليًا يُفتح فقط للأعضاء المسجّلين دخولهم. لمشاركته مع الجميع، فعّل «ملف ظاهر بدون حساب» في «تعديل الملف الشخصي».",
"social.publicNotFound": "لم يُعثر على الملف",
"social.publicNotFoundHint": "هذا الملف غير موجود، أو لا يراه إلا الأعضاء المسجّلون دخولهم.",
"social.publicJoin": "انضم إلى Bobinoo",
"social.publicCtaTitle": "تريد رؤية مكتبته كاملة؟",
"social.publicCtaText": "أنشئ حسابك لمتابعة {name} ورؤية كل عناوينه وتنظيم قائمتك الخاصة. مجانًا.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Zurück", "recap.prev": "Zurück",
"recap.cardTitle": "Mein Jahr", "recap.cardTitle": "Mein Jahr",
"recap.shareTitle": "Mein Jahr {year} auf Bobinoo", "recap.shareTitle": "Mein Jahr {year} auf Bobinoo",
"social.publicLink": "Profil ohne Konto sichtbar",
"social.publicLinkHint": "Dein Link {link} öffnet sich auch ohne Konto: Foto, Bio, Top 5, was du gerade schaust und deine zuletzt gesehenen Titel, mit deinen Bewertungen. Deine Meinungen und deine ganze Bibliothek bleiben Mitgliedern vorbehalten.",
"social.publicLinkPrivate": "Dein Konto ist privat: Auch mit dem Link sehen nur deine Follower dein Profil.",
"social.linkMembersOnly": "Im Moment öffnet er sich nur für angemeldete Mitglieder. Um ihn mit allen zu teilen, aktiviere „Profil ohne Konto sichtbar“ unter „Profil bearbeiten“.",
"social.publicNotFound": "Profil nicht gefunden",
"social.publicNotFoundHint": "Dieses Profil gibt es nicht, oder nur angemeldete Mitglieder können es sehen.",
"social.publicJoin": "Bobinoo beitreten",
"social.publicCtaTitle": "Lust, die ganze Bibliothek zu sehen?",
"social.publicCtaText": "Erstelle dein Konto, um {name} zu folgen, alle Titel zu sehen und deine eigene Liste zu führen. Es ist kostenlos.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Previous", "recap.prev": "Previous",
"recap.cardTitle": "My year", "recap.cardTitle": "My year",
"recap.shareTitle": "My {year} on Bobinoo", "recap.shareTitle": "My {year} on Bobinoo",
"social.publicLink": "Profile visible without an account",
"social.publicLinkHint": "Your link {link} also opens without an account: photo, bio, Top 5, what you’re watching and your latest titles, with your ratings. Your reviews and full library stay members-only.",
"social.publicLinkPrivate": "Your account is private: even with the link, only your followers can see your profile.",
"social.linkMembersOnly": "For now, it only opens for signed-in members. To share it with everyone, turn on “Profile visible without an account” in “Edit profile”.",
"social.publicNotFound": "Profile not found",
"social.publicNotFoundHint": "This profile doesn’t exist, or only signed-in members can see it.",
"social.publicJoin": "Join Bobinoo",
"social.publicCtaTitle": "Want to see their whole library?",
"social.publicCtaText": "Create your account to follow {name}, see all their titles and keep your own list. It’s free.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Anterior", "recap.prev": "Anterior",
"recap.cardTitle": "Mi año", "recap.cardTitle": "Mi año",
"recap.shareTitle": "Mi {year} en Bobinoo", "recap.shareTitle": "Mi {year} en Bobinoo",
"social.publicLink": "Perfil visible sin cuenta",
"social.publicLinkHint": "Tu enlace {link} también se abre sin cuenta: foto, bio, Top 5, lo que estás viendo y tus últimos títulos vistos, con tus notas. Tus opiniones y tu biblioteca completa siguen siendo solo para miembros.",
"social.publicLinkPrivate": "Tu cuenta es privada: aunque tengan el enlace, solo tus seguidores ven tu perfil.",
"social.linkMembersOnly": "Por ahora solo se abre para miembros con sesión iniciada. Para compartirlo con todo el mundo, activa «Perfil visible sin cuenta» en «Editar perfil».",
"social.publicNotFound": "Perfil no encontrado",
"social.publicNotFoundHint": "Este perfil no existe, o solo pueden verlo los miembros con sesión iniciada.",
"social.publicJoin": "Unirme a Bobinoo",
"social.publicCtaTitle": "¿Quieres ver toda su biblioteca?",
"social.publicCtaText": "Crea tu cuenta para seguir a {name}, ver todos sus títulos y llevar tu propia lista. Es gratis.",
} }
export default dict export default dict
+9
View File
@@ -1073,6 +1073,15 @@ const dict = {
"recap.prev": "Précédent", "recap.prev": "Précédent",
"recap.cardTitle": "Mon année", "recap.cardTitle": "Mon année",
"recap.shareTitle": "Mon année {year} sur Bobinoo", "recap.shareTitle": "Mon année {year} sur Bobinoo",
"social.publicLink": "Profil visible sans compte",
"social.publicLinkHint": "Ton lien {link} s’ouvre aussi sans compte : photo, bio, Top 5, ce que tu regardes et tes derniers titres vus, avec tes notes. Tes avis et ta bibliothèque complète restent réservés aux membres.",
"social.publicLinkPrivate": "Ton compte est privé : même avec le lien, seuls tes abonnés voient ton profil.",
"social.linkMembersOnly": "Pour l’instant, il ne s’ouvre que pour les membres connectés. Pour le partager à tout le monde, active « Profil visible sans compte » dans « Modifier le profil ».",
"social.publicNotFound": "Profil introuvable",
"social.publicNotFoundHint": "Ce profil n’existe pas, ou il n’est visible que par les membres connectés.",
"social.publicJoin": "Rejoindre Bobinoo",
"social.publicCtaTitle": "Envie de voir toute sa bibliothèque ?",
"social.publicCtaText": "Crée ton compte pour suivre {name}, voir tous ses titres et tenir ta propre liste. C’est gratuit.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "पीछे", "recap.prev": "पीछे",
"recap.cardTitle": "मेरा साल", "recap.cardTitle": "मेरा साल",
"recap.shareTitle": "Bobinoo पर मेरा {year}", "recap.shareTitle": "Bobinoo पर मेरा {year}",
"social.publicLink": "बिना अकाउंट के दिखने वाली प्रोफ़ाइल",
"social.publicLinkHint": "आपका लिंक {link} बिना अकाउंट के भी खुलता है: फ़ोटो, बायो, टॉप 5, आप अभी क्या देख रहे हैं और हाल में देखे टाइटल, आपकी रेटिंग के साथ। आपके रिव्यू और पूरी लाइब्रेरी सिर्फ़ सदस्यों के लिए रहती है।",
"social.publicLinkPrivate": "आपका अकाउंट प्राइवेट है: लिंक होने पर भी आपकी प्रोफ़ाइल सिर्फ़ आपके फ़ॉलोअर देख सकते हैं।",
"social.linkMembersOnly": "अभी यह सिर्फ़ लॉग इन किए सदस्यों के लिए खुलता है। सबके साथ शेयर करने के लिए “प्रोफ़ाइल एडिट करें” में “बिना अकाउंट के दिखने वाली प्रोफ़ाइल” चालू करें।",
"social.publicNotFound": "प्रोफ़ाइल नहीं मिली",
"social.publicNotFoundHint": "यह प्रोफ़ाइल मौजूद नहीं है, या इसे सिर्फ़ लॉग इन किए सदस्य देख सकते हैं।",
"social.publicJoin": "Bobinoo से जुड़ें",
"social.publicCtaTitle": "पूरी लाइब्रेरी देखनी है?",
"social.publicCtaText": "{name} को फ़ॉलो करने, सारे टाइटल देखने और अपनी लिस्ट बनाने के लिए अपना अकाउंट बनाएँ। यह मुफ़्त है।",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Sebelumnya", "recap.prev": "Sebelumnya",
"recap.cardTitle": "Tahunku", "recap.cardTitle": "Tahunku",
"recap.shareTitle": "Tahun {year}-ku di Bobinoo", "recap.shareTitle": "Tahun {year}-ku di Bobinoo",
"social.publicLink": "Profil terlihat tanpa akun",
"social.publicLinkHint": "Tautanmu {link} juga bisa dibuka tanpa akun: foto, bio, Top 5, yang sedang kamu tonton, dan judul terakhir yang kamu tonton, lengkap dengan nilaimu. Ulasan dan seluruh koleksimu tetap hanya untuk anggota.",
"social.publicLinkPrivate": "Akunmu privat: meski punya tautannya, hanya pengikutmu yang bisa melihat profilmu.",
"social.linkMembersOnly": "Untuk sekarang, tautan ini hanya terbuka bagi anggota yang sudah masuk. Agar bisa dibagikan ke semua orang, aktifkan “Profil terlihat tanpa akun” di “Edit profil”.",
"social.publicNotFound": "Profil tidak ditemukan",
"social.publicNotFoundHint": "Profil ini tidak ada, atau hanya bisa dilihat anggota yang sudah masuk.",
"social.publicJoin": "Gabung ke Bobinoo",
"social.publicCtaTitle": "Mau lihat seluruh koleksinya?",
"social.publicCtaText": "Buat akunmu untuk mengikuti {name}, melihat semua judulnya, dan menyusun daftarmu sendiri. Gratis.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Indietro", "recap.prev": "Indietro",
"recap.cardTitle": "Il mio anno", "recap.cardTitle": "Il mio anno",
"recap.shareTitle": "Il mio {year} su Bobinoo", "recap.shareTitle": "Il mio {year} su Bobinoo",
"social.publicLink": "Profilo visibile senza account",
"social.publicLinkHint": "Il tuo link {link} si apre anche senza account: foto, bio, Top 5, cosa stai guardando e gli ultimi titoli visti, con i tuoi voti. Le tue opinioni e la libreria completa restano riservate ai membri.",
"social.publicLinkPrivate": "Il tuo account è privato: anche con il link, solo i tuoi follower vedono il tuo profilo.",
"social.linkMembersOnly": "Per ora si apre solo per i membri che hanno effettuato l’accesso. Per condividerlo con tutti, attiva «Profilo visibile senza account» in «Modifica profilo».",
"social.publicNotFound": "Profilo non trovato",
"social.publicNotFoundHint": "Questo profilo non esiste, oppure è visibile solo ai membri che hanno effettuato l’accesso.",
"social.publicJoin": "Unisciti a Bobinoo",
"social.publicCtaTitle": "Vuoi vedere tutta la sua libreria?",
"social.publicCtaText": "Crea il tuo account per seguire {name}, vedere tutti i suoi titoli e tenere la tua lista. È gratis.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "前へ", "recap.prev": "前へ",
"recap.cardTitle": "わたしの1年", "recap.cardTitle": "わたしの1年",
"recap.shareTitle": "Bobinoo でふり返る{year}年", "recap.shareTitle": "Bobinoo でふり返る{year}年",
"social.publicLink": "アカウントなしでも見られるプロフィール",
"social.publicLinkHint": "リンク {link} はアカウントがなくても開けます。表示されるのは写真、自己紹介、トップ5、視聴中の作品、最近見た作品と評価です。レビューとライブラリ全体はメンバーだけに公開されます。",
"social.publicLinkPrivate": "アカウントが非公開です。リンクがあっても、プロフィールを見られるのはフォロワーだけです。",
"social.linkMembersOnly": "今はログインしたメンバーだけが開けます。誰にでも共有するには、「プロフィールを編集」で「アカウントなしでも見られるプロフィール」をオンにしてください。",
"social.publicNotFound": "プロフィールが見つかりません",
"social.publicNotFoundHint": "このプロフィールは存在しないか、ログインしたメンバーだけが見られます。",
"social.publicJoin": "Bobinoo に参加",
"social.publicCtaTitle": "ライブラリ全体を見てみる?",
"social.publicCtaText": "アカウントを作ると、{name} さんをフォローして全作品を見たり、自分のリストを作ったりできます。無料です。",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "이전", "recap.prev": "이전",
"recap.cardTitle": "나의 한 해", "recap.cardTitle": "나의 한 해",
"recap.shareTitle": "Bobinoo로 돌아본 나의 {year}년", "recap.shareTitle": "Bobinoo로 돌아본 나의 {year}년",
"social.publicLink": "계정 없이 볼 수 있는 프로필",
"social.publicLinkHint": "{link} 링크는 계정이 없어도 열려요. 사진, 소개, 탑 5, 지금 보는 작품, 최근에 본 작품과 평점이 보여요. 감상과 전체 라이브러리는 회원만 볼 수 있어요.",
"social.publicLinkPrivate": "계정이 비공개예요. 링크가 있어도 프로필은 팔로워만 볼 수 있어요.",
"social.linkMembersOnly": "지금은 로그인한 회원만 열 수 있어요. 모두에게 공유하려면 ‘프로필 수정’에서 ‘계정 없이 볼 수 있는 프로필’을 켜세요.",
"social.publicNotFound": "프로필을 찾을 수 없어요",
"social.publicNotFoundHint": "이 프로필이 없거나, 로그인한 회원만 볼 수 있어요.",
"social.publicJoin": "Bobinoo 가입하기",
"social.publicCtaTitle": "라이브러리 전체를 보고 싶나요?",
"social.publicCtaText": "계정을 만들면 {name} 님을 팔로우하고, 모든 작품을 보고, 나만의 리스트를 만들 수 있어요. 무료예요.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Vorige", "recap.prev": "Vorige",
"recap.cardTitle": "Mijn jaar", "recap.cardTitle": "Mijn jaar",
"recap.shareTitle": "Mijn {year} op Bobinoo", "recap.shareTitle": "Mijn {year} op Bobinoo",
"social.publicLink": "Profiel zichtbaar zonder account",
"social.publicLinkHint": "Je link {link} opent ook zonder account: foto, bio, Top 5, wat je nu kijkt en je laatst geziene titels, met je scores. Je reviews en je volledige bibliotheek blijven alleen voor leden.",
"social.publicLinkPrivate": "Je account is privé: ook met de link zien alleen je volgers je profiel.",
"social.linkMembersOnly": "Voorlopig opent hij alleen voor ingelogde leden. Wil je hem met iedereen delen, zet dan “Profiel zichtbaar zonder account” aan bij “Profiel bewerken”.",
"social.publicNotFound": "Profiel niet gevonden",
"social.publicNotFoundHint": "Dit profiel bestaat niet, of alleen ingelogde leden kunnen het zien.",
"social.publicJoin": "Word lid van Bobinoo",
"social.publicCtaTitle": "Zin om de hele bibliotheek te zien?",
"social.publicCtaText": "Maak een account om {name} te volgen, alle titels te zien en je eigen lijst bij te houden. Het is gratis.",
} }
export default dict export default dict
+9
View File
@@ -1173,6 +1173,15 @@ const dict: Translations = {
"recap.prev": "Wstecz", "recap.prev": "Wstecz",
"recap.cardTitle": "Mój rok", "recap.cardTitle": "Mój rok",
"recap.shareTitle": "Mój rok {year} w Bobinoo", "recap.shareTitle": "Mój rok {year} w Bobinoo",
"social.publicLink": "Profil widoczny bez konta",
"social.publicLinkHint": "Twój link {link} otwiera się też bez konta: zdjęcie, bio, Top 5, to, co teraz oglądasz, i ostatnio obejrzane tytuły, razem z ocenami. Twoje recenzje i cała biblioteka pozostają tylko dla użytkowników.",
"social.publicLinkPrivate": "Twoje konto jest prywatne: nawet z linkiem twój profil widzą tylko twoi obserwujący.",
"social.linkMembersOnly": "Na razie otwiera się tylko dla zalogowanych użytkowników. Aby udostępnić go wszystkim, włącz „Profil widoczny bez konta” w „Edytuj profil”.",
"social.publicNotFound": "Nie znaleziono profilu",
"social.publicNotFoundHint": "Ten profil nie istnieje albo widzą go tylko zalogowani użytkownicy.",
"social.publicJoin": "Dołącz do Bobinoo",
"social.publicCtaTitle": "Chcesz zobaczyć całą bibliotekę?",
"social.publicCtaText": "Załóż konto, aby obserwować {name}, widzieć wszystkie tytuły i prowadzić własną listę. To nic nie kosztuje.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Anterior", "recap.prev": "Anterior",
"recap.cardTitle": "Meu ano", "recap.cardTitle": "Meu ano",
"recap.shareTitle": "Meu {year} no Bobinoo", "recap.shareTitle": "Meu {year} no Bobinoo",
"social.publicLink": "Perfil visível sem conta",
"social.publicLinkHint": "Seu link {link} também abre sem conta: foto, bio, Top 5, o que você está assistindo e seus últimos títulos vistos, com suas notas. Suas opiniões e sua biblioteca completa continuam só para membros.",
"social.publicLinkPrivate": "Sua conta é privada: mesmo com o link, só seus seguidores veem seu perfil.",
"social.linkMembersOnly": "Por enquanto, ele só abre para membros conectados. Para compartilhar com todo mundo, ative “Perfil visível sem conta” em “Editar perfil”.",
"social.publicNotFound": "Perfil não encontrado",
"social.publicNotFoundHint": "Este perfil não existe, ou só membros conectados podem vê-lo.",
"social.publicJoin": "Entrar no Bobinoo",
"social.publicCtaTitle": "Quer ver toda a biblioteca?",
"social.publicCtaText": "Crie sua conta para seguir {name}, ver todos os títulos e montar sua própria lista. É grátis.",
} }
export default dict export default dict
+9
View File
@@ -1173,6 +1173,15 @@ const dict: Translations = {
"recap.prev": "Назад", "recap.prev": "Назад",
"recap.cardTitle": "Мой год", "recap.cardTitle": "Мой год",
"recap.shareTitle": "Мой {year} год в Bobinoo", "recap.shareTitle": "Мой {year} год в Bobinoo",
"social.publicLink": "Профиль виден без аккаунта",
"social.publicLinkHint": "Твоя ссылка {link} открывается и без аккаунта: фото, описание, Топ 5, что ты смотришь сейчас и последние просмотренные тайтлы, с твоими оценками. Отзывы и вся библиотека доступны только участникам.",
"social.publicLinkPrivate": "Твой аккаунт закрыт: даже по ссылке профиль видят только твои подписчики.",
"social.linkMembersOnly": "Пока она открывается только для вошедших участников. Чтобы поделиться ею со всеми, включи «Профиль виден без аккаунта» в разделе «Изменить профиль».",
"social.publicNotFound": "Профиль не найден",
"social.publicNotFoundHint": "Такого профиля нет, или его видят только вошедшие участники.",
"social.publicJoin": "Присоединиться к Bobinoo",
"social.publicCtaTitle": "Хочешь увидеть всю библиотеку?",
"social.publicCtaText": "Создай аккаунт, чтобы подписаться на {name}, видеть все тайтлы и вести свой список. Это бесплатно.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "ก่อนหน้า", "recap.prev": "ก่อนหน้า",
"recap.cardTitle": "ปีของฉัน", "recap.cardTitle": "ปีของฉัน",
"recap.shareTitle": "ปี {year} ของฉันบน Bobinoo", "recap.shareTitle": "ปี {year} ของฉันบน Bobinoo",
"social.publicLink": "โปรไฟล์ที่ดูได้โดยไม่ต้องมีบัญชี",
"social.publicLinkHint": "ลิงก์ {link} ของคุณเปิดได้แม้ไม่มีบัญชี: รูป ไบโอ ท็อป 5 เรื่องที่กำลังดู และเรื่องที่ดูล่าสุด พร้อมคะแนนของคุณ ส่วนรีวิวและคลังทั้งหมดของคุณยังเห็นได้เฉพาะสมาชิก",
"social.publicLinkPrivate": "บัญชีของคุณเป็นส่วนตัว: แม้มีลิงก์ ก็มีแค่ผู้ติดตามของคุณที่เห็นโปรไฟล์",
"social.linkMembersOnly": "ตอนนี้ลิงก์เปิดได้เฉพาะสมาชิกที่เข้าสู่ระบบ หากต้องการแชร์ให้ทุกคน ให้เปิด “โปรไฟล์ที่ดูได้โดยไม่ต้องมีบัญชี” ใน “แก้ไขโปรไฟล์”",
"social.publicNotFound": "ไม่พบโปรไฟล์",
"social.publicNotFoundHint": "ไม่มีโปรไฟล์นี้ หรือมีแค่สมาชิกที่เข้าสู่ระบบที่ดูได้",
"social.publicJoin": "เข้าร่วม Bobinoo",
"social.publicCtaTitle": "อยากดูคลังทั้งหมดไหม?",
"social.publicCtaText": "สร้างบัญชีเพื่อติดตาม {name} ดูทุกเรื่อง และจดรายการของคุณเอง ใช้ฟรี",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Geri", "recap.prev": "Geri",
"recap.cardTitle": "Yılım", "recap.cardTitle": "Yılım",
"recap.shareTitle": "Bobinoo’da {year} yılım", "recap.shareTitle": "Bobinoo’da {year} yılım",
"social.publicLink": "Hesapsız görünen profil",
"social.publicLinkHint": "{link} bağlantın hesabı olmayanlar için de açılır: fotoğraf, biyografi, Top 5, şu an izlediklerin ve son izlediğin yapımlar, puanlarınla birlikte. Yorumların ve kütüphanenin tamamı yalnızca üyelere açık kalır.",
"social.publicLinkPrivate": "Hesabın gizli: bağlantıyla bile profilini yalnızca takipçilerin görür.",
"social.linkMembersOnly": "Şimdilik yalnızca giriş yapmış üyeler için açılıyor. Herkesle paylaşmak için “Profili düzenle” bölümünde “Hesapsız görünen profil” seçeneğini aç.",
"social.publicNotFound": "Profil bulunamadı",
"social.publicNotFoundHint": "Bu profil yok ya da yalnızca giriş yapmış üyeler görebiliyor.",
"social.publicJoin": "Bobinoo’ya katıl",
"social.publicCtaTitle": "Kütüphanenin tamamını görmek ister misin?",
"social.publicCtaText": "{name} kişisini takip etmek, tüm yapımlarını görmek ve kendi listeni tutmak için hesabını oluştur. Ücretsiz.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "Trước", "recap.prev": "Trước",
"recap.cardTitle": "Năm của tôi", "recap.cardTitle": "Năm của tôi",
"recap.shareTitle": "Năm {year} của tôi trên Bobinoo", "recap.shareTitle": "Năm {year} của tôi trên Bobinoo",
"social.publicLink": "Hồ sơ xem được khi không có tài khoản",
"social.publicLinkHint": "Liên kết {link} của bạn mở được cả khi không có tài khoản: ảnh, giới thiệu, Top 5, phim bạn đang xem và những phim xem gần đây, kèm điểm của bạn. Nhận xét và toàn bộ thư viện vẫn chỉ dành cho thành viên.",
"social.publicLinkPrivate": "Tài khoản của bạn đang riêng tư: dù có liên kết, chỉ người theo dõi của bạn mới xem được hồ sơ.",
"social.linkMembersOnly": "Hiện liên kết chỉ mở được với thành viên đã đăng nhập. Để chia sẻ với mọi người, hãy bật “Hồ sơ xem được khi không có tài khoản” trong “Sửa hồ sơ”.",
"social.publicNotFound": "Không tìm thấy hồ sơ",
"social.publicNotFoundHint": "Hồ sơ này không tồn tại, hoặc chỉ thành viên đã đăng nhập mới xem được.",
"social.publicJoin": "Tham gia Bobinoo",
"social.publicCtaTitle": "Muốn xem toàn bộ thư viện?",
"social.publicCtaText": "Tạo tài khoản để theo dõi {name}, xem mọi phim và tự lập danh sách của riêng bạn. Miễn phí.",
} }
export default dict export default dict
+9
View File
@@ -1071,6 +1071,15 @@ const dict: Translations = {
"recap.prev": "上一页", "recap.prev": "上一页",
"recap.cardTitle": "我的一年", "recap.cardTitle": "我的一年",
"recap.shareTitle": "我在 Bobinoo 的 {year} 年", "recap.shareTitle": "我在 Bobinoo 的 {year} 年",
"social.publicLink": "无需账号即可查看主页",
"social.publicLinkHint": "你的链接 {link} 无需账号也能打开:头像、简介、Top 5、正在看的和最近看完的作品,以及你的评分。你的短评和完整片库仍只对用户可见。",
"social.publicLinkPrivate": "你的账号是私密的:即使有链接,也只有你的关注者能看到你的主页。",
"social.linkMembersOnly": "目前只有已登录的用户能打开。想分享给所有人,请在“编辑主页”中开启“无需账号即可查看主页”。",
"social.publicNotFound": "找不到主页",
"social.publicNotFoundHint": "这个主页不存在,或只对已登录的用户可见。",
"social.publicJoin": "加入 Bobinoo",
"social.publicCtaTitle": "想看完整片库?",
"social.publicCtaText": "创建账号即可关注 {name}、查看全部作品并管理你自己的片单。免费使用。",
} }
export default dict export default dict
+13
View File
@@ -36,6 +36,19 @@ export async function cloudFetch(path: string, init: RequestInit = {}): Promise<
throw new AuthError(t('auth.err.session')) throw new AuthError(t('auth.err.session'))
} }
/** Fonction de la base ouverte sans compte (profil public) : clé publique seulement, jamais de jeton. */
export async function anonRpc(name: string, args: Record<string, unknown>): Promise<unknown> {
const res = await timedFetch(`${SUPABASE_URL}/rest/v1/rpc/${name}`, {
method: 'POST',
headers: { apikey: SUPABASE_ANON_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify(args),
credentials: 'omit',
referrerPolicy: 'no-referrer',
})
if (!res.ok) throw new Error(t('social.err.server', { status: res.status }))
return res.json()
}
/** /**
* Données publiques (catalogue TMDB, notes Trakt) : requête « simple », sans aucun en-tête. * Données publiques (catalogue TMDB, notes Trakt) : requête « simple », sans aucun en-tête.
* Avec un en-tête (jeton, apikey), le navigateur envoie d'abord une pré-requête CORS, adresse par adresse : * Avec un en-tête (jeton, apikey), le navigateur envoie d'abord une pré-requête CORS, adresse par adresse :
+25 -3
View File
@@ -2,7 +2,7 @@ import { t } from '../../i18n'
import type { MediaItem } from '../../types' import type { MediaItem } from '../../types'
import { normalizeItem } from '../backup' import { normalizeItem } from '../backup'
import { cleanText, isPlainObject, safeIso } from '../security' import { cleanText, isPlainObject, safeIso } from '../security'
import { cloudFetch } from './api' import { anonRpc, cloudFetch } from './api'
import { getSession } from './auth' import { getSession } from './auth'
import { SUPABASE_URL } from './config' import { SUPABASE_URL } from './config'
@@ -36,6 +36,8 @@ export interface Profile extends ProfileCard {
top: MediaItem[] top: MediaItem[]
recent: MediaItem[] recent: MediaItem[]
watching: MediaItem[] watching: MediaItem[]
/** Mon profil seulement : le lien bobinoo.org/@pseudo s'ouvre aussi sans compte */
publicLink?: boolean
} }
export interface FeedEntry { export interface FeedEntry {
@@ -106,6 +108,7 @@ function toProfile(raw: unknown): Profile | null {
top: toItems(raw.top), top: toItems(raw.top),
recent: toItems(raw.recent), recent: toItems(raw.recent),
watching: toItems(raw.watching), watching: toItems(raw.watching),
publicLink: raw.is_me === true ? raw.public_link === true : undefined,
} }
} }
@@ -133,6 +136,19 @@ export async function getProfile(name: string): Promise<Profile | null> {
return toProfile(await rpc('get_profile', { p_username: clean })) return toProfile(await rpc('get_profile', { p_username: clean }))
} }
/**
* Profil ouvert sans compte (lien bobinoo.org/@pseudo) : seulement si la personne a rendu son lien public.
* null aussi bien pour un pseudo inconnu que pour un profil réservé aux membres.
*/
export async function getPublicProfile(name: string): Promise<Profile | null> {
const clean = name.trim().toLowerCase().replace(/^@/, '')
if (!USERNAME_RE.test(clean)) return null
const raw = await anonRpc('public_profile', { p_username: clean })
if (!isPlainObject(raw)) return null
// Vu de l'extérieur : jamais « moi », aucune relation, tout ce qui est renvoyé est visible
return toProfile({ ...raw, is_me: false, follows_me: false, relation: 'none', is_private: false, visible: true })
}
// Mon profil gardé sur l'appareil : affiché dès le lancement, puis rafraîchi en arrière-plan // Mon profil gardé sur l'appareil : affiché dès le lancement, puis rafraîchi en arrière-plan
const meKey = (userId: string) => `azuucine:${userId}:me` const meKey = (userId: string) => `azuucine:${userId}:me`
@@ -348,6 +364,7 @@ export interface ProfilePatch {
display_name?: string display_name?: string
bio?: string bio?: string
is_private?: boolean is_private?: boolean
public_link?: boolean
avatar_url?: string | null avatar_url?: string | null
banner_url?: string | null banner_url?: string | null
} }
@@ -388,5 +405,10 @@ export async function deleteProfileImage(url?: string) {
await cloudFetch(`/storage/v1/object/profile-media/${path}`, { method: 'DELETE' }).catch(() => undefined) await cloudFetch(`/storage/v1/object/profile-media/${path}`, { method: 'DELETE' }).catch(() => undefined)
} }
/** Lien public vers un profil. */ /** Lien vers un profil : bobinoo.org/@pseudo (ouvert sans compte seulement si la personne l'a rendu public). */
export const profileLink = (name: string) => `${location.origin}${location.pathname}#/u/${name}` export const profileLink = (name: string) => `${location.origin}/@${name}`
/** Pseudo d'un lien de profil ouvert (« /@pseudo »), sinon undefined. */
export function profileFromPath(path = location.pathname): string | undefined {
return path.match(/^\/@([a-z0-9_]{3,20})\/?$/i)?.[1].toLowerCase()
}
@@ -0,0 +1,165 @@
-- Profil public : le lien bobinoo.org/@pseudo s'ouvre sans compte, seulement si la personne l'a activé.
--
-- Par défaut, rien ne change : un profil n'est visible que des membres connectés (et de ses abonnés s'il est privé).
-- Avec « Profil visible sans compte » activé (et un profil non privé, non suspendu), public_profile() renvoie
-- la carte du profil, ses Top 5, ce qu'il regarde et ses derniers titres vus, réduits au strict nécessaire
-- (titre, affiche, type, année, note) : ni avis, ni dates, ni notes perso. La bibliothèque complète reste
-- réservée aux membres (get_profile_items passe toujours par can_view).
--
-- Pas de contrôle de double authentification dans public_profile : elle ne renvoie que ce que la personne a choisi
-- de montrer à tout le monde, et rien de plus à un compte connecté. Un profil non public, privé, suspendu ou
-- inexistant donne la même réponse (null) : impossible de savoir si un pseudo existe. Idempotent.
alter table public.profiles add column if not exists public_link boolean not null default false;
comment on column public.profiles.public_link is 'Lien bobinoo.org/@pseudo ouvert sans compte (choix de la personne, désactivé par défaut)';
grant select (public_link) on public.profiles to authenticated;
grant update (public_link) on public.profiles to authenticated;
-- Fiche réduite pour les visiteurs sans compte
create or replace function public.azuu_public_item_min(d jsonb)
returns jsonb language sql immutable set search_path = '' as $$
select jsonb_strip_nulls(jsonb_build_object(
'id', d->'id',
'title', d->'title',
'type', d->'type',
'subtype', d->'subtype',
'year', d->'year',
'status', d->'status',
'rating', d->'rating',
'poster', case when length(coalesce(d->>'poster', '')) <= 150000 then d->'poster' end,
'externalId', d->'externalId',
'genres', d->'genres',
'top', d->'top'
))
$$;
revoke all on function public.azuu_public_item_min(jsonb) from public, anon, authenticated;
create or replace function public.public_profile(p_username text)
returns jsonb language plpgsql stable security definer set search_path = '' as $$
declare
name text := lower(trim(coalesce(p_username, '')));
p public.profiles;
begin
if name !~ '^[a-z0-9_]{3,20}$' then
return null;
end if;
select * into p from public.profiles
where username = name and public_link and not is_private and not suspended;
if not found then
return null;
end if;
return jsonb_build_object(
'id', p.id,
'username', p.username,
'display_name', p.display_name,
'avatar_url', p.avatar_url,
'banner_url', p.banner_url,
'bio', p.bio,
'followers', (select count(*) from public.follows where following_id = p.id and status = 'accepted'),
'following', (select count(*) from public.follows where follower_id = p.id and status = 'accepted'),
'stats', jsonb_build_object(
'finished', (select count(*) from public.items where user_id = p.id and not deleted and data->>'status' = 'termine')
),
'top', (
select coalesce(jsonb_agg(public.azuu_public_item_min(data) order by data->'top'->>'category', (data->'top'->>'rank')), '[]'::jsonb)
from public.items i
where i.user_id = p.id and not i.deleted and jsonb_typeof(i.data->'top') = 'object'
and coalesce(
(select s.data->'topCategories' ? (i.data->'top'->>'category')
from public.settings s where s.user_id = p.id and jsonb_typeof(s.data->'topCategories') = 'array'),
true)
),
'recent', (
select coalesce(jsonb_agg(public.azuu_public_item_min(s.data) order by s.k desc nulls last), '[]'::jsonb)
from (
select data, coalesce(data->>'endDate', data->>'startDate') as k
from public.items
where user_id = p.id and not deleted and data->>'status' = 'termine'
order by k desc nulls last limit 5
) s
),
'watching', (
select coalesce(jsonb_agg(public.azuu_public_item_min(s.data) order by s.k desc nulls last), '[]'::jsonb)
from (
select data, coalesce(data->>'startDate', left(data->>'updatedAt', 10)) as k
from public.items
where user_id = p.id and not deleted and data->>'status' = 'en_cours'
order by k desc nulls last limit 8
) s
)
);
end;
$$;
revoke all on function public.public_profile(text) from public;
grant execute on function public.public_profile(text) to anon, authenticated;
-- get_profile : renvoie aussi le réglage du lien public, seulement à la personne elle-même (redéfinie à l'identique sinon)
create or replace function public.get_profile(p_username text)
returns jsonb language plpgsql stable security definer set search_path = '' as $$
declare
p public.profiles;
me uuid := auth.uid();
res jsonb;
begin
if me is null or not public.azuu_mfa_ok() then
return null;
end if;
select * into p from public.profiles where username = lower(trim(p_username));
if not found then
return null;
end if;
if p.suspended and p.id <> me then
return null;
end if;
if p.id <> me and exists (select 1 from public.blocks b where b.blocker_id = p.id and b.blocked_id = me) then
return null;
end if;
res := public.profile_card(p) || jsonb_build_object(
'bio', p.bio,
'banner_url', p.banner_url,
'is_me', p.id = me,
'follows_me', exists (select 1 from public.follows where follower_id = p.id and following_id = me and status = 'accepted'),
'followers', (select count(*) from public.follows where following_id = p.id and status = 'accepted'),
'following', (select count(*) from public.follows where follower_id = p.id and status = 'accepted'),
'visible', public.can_view(p.id)
);
if p.id = me then
res := res || jsonb_build_object('public_link', p.public_link);
end if;
if public.can_view(p.id) then
res := res || jsonb_build_object(
'stats', jsonb_build_object(
'finished', (select count(*) from public.items where user_id = p.id and not deleted and data->>'status' = 'termine')
),
'top', (
select coalesce(jsonb_agg(public.public_item(data) order by data->'top'->>'category', (data->'top'->>'rank')), '[]'::jsonb)
from public.items i
where i.user_id = p.id and not i.deleted and jsonb_typeof(i.data->'top') = 'object'
and coalesce(
(select s.data->'topCategories' ? (i.data->'top'->>'category')
from public.settings s where s.user_id = p.id and jsonb_typeof(s.data->'topCategories') = 'array'),
true)
),
'recent', (
select coalesce(jsonb_agg(public.public_item(s.data) order by s.k desc nulls last), '[]'::jsonb)
from (
select data, coalesce(data->>'endDate', data->>'startDate') as k
from public.items
where user_id = p.id and not deleted and data->>'status' = 'termine'
order by k desc nulls last limit 5
) s
),
'watching', (
select coalesce(jsonb_agg(public.public_item(s.data) order by s.k desc nulls last), '[]'::jsonb)
from (
select data, coalesce(data->>'startDate', left(data->>'updatedAt', 10)) as k
from public.items
where user_id = p.id and not deleted and data->>'status' = 'en_cours'
order by k desc nulls last limit 8
) s
)
);
end if;
return res;
end;
$$;
+2 -1
View File
@@ -137,7 +137,8 @@ export default defineConfig(({ mode }) => {
'**/icons/icon-maskable-512.png', '**/icons/icon-maskable-512.png',
], ],
// L'app vit entièrement sur « / » (routes après le #) : toute autre adresse reçoit la page 404 du serveur // L'app vit entièrement sur « / » (routes après le #) : toute autre adresse reçoit la page 404 du serveur
navigateFallbackAllowlist: [/^\/(?:index\.html)?(?:\?.*)?$/], // L'accueil, et les liens de profil (bobinoo.org/@pseudo) : même hors-ligne, c'est l'app qui s'ouvre
navigateFallbackAllowlist: [/^\/(?:index\.html)?(?:\?.*)?$/, /^\/@[A-Za-z0-9_]{3,20}\/?(?:\?.*)?$/],
// Les pages légales sont de vraies pages, pas l'app // Les pages légales sont de vraies pages, pas l'app
navigateFallbackDenylist: [/^\/privacy/, /^\/legal/, /^\/terms/, /^\/credits/, /^\/supprimer-compte/], navigateFallbackDenylist: [/^\/privacy/, /^\/legal/, /^\/terms/, /^\/credits/, /^\/supprimer-compte/],
runtimeCaching: [ runtimeCaching: [