Profile pictures from Gravatar or the identity provider, fetched and kept by the server

Both sources are off until switched on under Settings, Sign-in. The server asks only
gravatar.com (by a hash of the email) and the identity provider's own host, accepts only
small PNG/JPEG/WebP/GIF, keeps each picture for a day and serves it from /api/avatars/<id>,
so browsers never contact either. Shown in the user menu and on the Users page, with initials
as the fallback; the Privacy page says when it is on.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 23:47:50 +02:00
1 parent 9782bd3252
commit c05c847d17
26 files changed
+4361 -21

No files matched your search

+3 -2
View File
@@ -8,6 +8,7 @@ import { recordAudit } from "../services/audit.js";
import { asyncHandler } from "../utils/asyncHandler.js";
import { getSettings } from "../services/settingsStore.js";
import { roleFromGroups } from "../auth/groups.js";
import { avatarUrlFor } from "../services/avatars.js";
export const usersRouter = Router();
@@ -26,9 +27,9 @@ export function parseGroups(stored: string | null): string[] | null {
usersRouter.get("/", asyncHandler(async (_req, res) => {
const rows = await db.select().from(users).orderBy(users.createdAt);
const { signIn } = await getSettings();
const { signIn, profilePictures } = await getSettings();
res.json({
users: rows.map((u) => ({ id: u.id, oidcSub: u.oidcSub, email: u.email, name: u.name, role: u.role, createdAt: u.createdAt, lastLoginAt: u.lastLoginAt, groups: parseGroups(u.groups) })),
users: rows.map((u) => ({ id: u.id, oidcSub: u.oidcSub, email: u.email, name: u.name, role: u.role, createdAt: u.createdAt, lastLoginAt: u.lastLoginAt, groups: parseGroups(u.groups), avatarUrl: avatarUrlFor(u, profilePictures) })),
// When roles follow groups, a role set by hand would be undone at the next sign-in, so the page says so instead of offering it.
rolesFollowGroups: signIn.roleFromGroups,
});