Files
Epicure/apps/web/app/(app)/settings/page.tsx
T
Arnaud a08588cf85 feat: Gravatar opt-in (off by default), configurable in Settings
Previously every account without a custom avatar automatically got
its email MD5-hashed and sent to gravatar.com at signup, with no way
to turn it off. Adds users.useGravatar (default false): removed the
automatic signup-time lookup entirely, and "remove photo" now falls
back to the initials placeholder instead of silently re-deriving a
Gravatar URL. New toggle in Settings -> Profile, off by default,
description explains the MD5-hash-to-third-party tradeoff. Existing
accounts' current avatarUrl is left untouched either way — no
retroactive avatar changes for anyone already using one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-14 09:37:29 +02:00

35 lines
1.2 KiB
TypeScript

import type { Metadata } from "next";
import { headers } from "next/headers";
import { auth } from "@/lib/auth/server";
import { db, users, eq } from "@epicure/db";
import { SettingsForm } from "@/components/settings/settings-form";
export const metadata: Metadata = {};
export default async function SettingsPage() {
const session = await auth.api.getSession({ headers: await headers() });
if (!session) return null;
const dbUser = await db.query.users.findFirst({
where: eq(users.id, session.user.id),
columns: { bio: true, privateBio: true, isPrivate: true, hasCustomAvatar: true, avatarUrl: true, username: true, useGravatar: true },
});
return (
<SettingsForm
user={{
name: session.user.name,
email: session.user.email,
image: dbUser?.avatarUrl ?? null,
locale: (session.user as { locale?: string }).locale ?? "en",
bio: dbUser?.bio ?? null,
privateBio: dbUser?.privateBio ?? null,
isPrivate: dbUser?.isPrivate ?? false,
hasCustomAvatar: dbUser?.hasCustomAvatar ?? false,
username: dbUser?.username ?? null,
useGravatar: dbUser?.useGravatar ?? false,
}}
/>
);
}