function formatDate(dateStr) { const d = new Date(dateStr); return d.toLocaleDateString('fr-FR', { year: 'numeric', month: 'long', day: 'numeric' }); } function showError(message) { document.getElementById('error').innerHTML = `
${escapeHtml(message)}
`; } function statTile(value, label) { return `
${value}
${escapeHtml(label)}
`; } (async function init() { await initNav(null); try { const profile = await api.get('/api/users/me/profile'); const container = document.getElementById('content'); container.innerHTML = `
${avatarHtml(profile, 'avatar-lg')}

${escapeHtml(profile.name)}${profile.isAdmin ? ' admin' : ''}

${profile.username ? `
@${escapeHtml(profile.username)}
` : ''} ${profile.email ? `
${escapeHtml(profile.email)}
` : ''}
Membre depuis ${formatDate(profile.createdAt)}
${profile.groups && profile.groups.length ? `

Groupes Authentik

${profile.groups.map((g) => `${escapeHtml(g)}`).join('')}
` : ''}

Votre activité

${statTile(profile.stats.songsAdded, 'Morceaux ajoutés')} ${statTile(profile.stats.suggestionsProposed, 'Suggestions proposées')} ${statTile(profile.stats.votesCast, 'Votes exprimés')}

Identité gérée par Authentik — pour changer votre nom, email ou mot de passe, rendez-vous sur votre compte Authentik.

`; } catch (err) { showError(err.message); } })();