mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 15:02:04 +00:00
feat(avatar): self-hosted avatar storage replacing the Gravatar leak
The previous /me payload carried a gravatarUrl built from
SHA-256(email) and pointed every authenticated page-load at
www.gravatar.com — Automattic could correlate the digest against
its known-email table on each request. This release moves the
avatar in-house: the user uploads through POST /api/user/avatar
(multipart, JPEG/PNG/WebP, 2 MiB / 2048×2048 max), the bytes ride
on the User row alongside a content-type and updatedAt timestamp,
and GET /api/user/avatar/{id} serves them from same-origin with
the cache-busting timestamp on the profile response.
The image-header parsing is hand-rolled in src/lib/avatar.ts so
the standalone image does not gain a native dep just to read width
and height. Validation rejects oversize / wrong content-type at
the multipart parse boundary; DELETE clears the row. The bytes
ride pg_dump alongside the rest of the row so the existing weekly
encrypted backup path already covers them.
The sidebar, the coach panel, the use-auth hook, and the disable-
coach card stop reading gravatarUrl; src/lib/gravatar.ts retires.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e93feaf8d1
commit
ca1c52ffcb
20 files changed
+1470
-46
No files matched your search
@@ -21,7 +21,13 @@ export interface AuthUser {
|
||||
* `<TourLauncher>` component for the gating logic.
|
||||
*/
|
||||
onboardingTourCompleted: boolean;
|
||||
gravatarUrl: string | null;
|
||||
/**
|
||||
* v1.5.5 — relative URL of the user's self-hosted avatar, served
|
||||
* from `/api/user/avatar/{id}?v={updatedAtMs}`. Replaces the
|
||||
* Gravatar leak; null when the user has not uploaded an avatar
|
||||
* yet (clients paint the username-initials fallback).
|
||||
*/
|
||||
avatarUrl: string | null;
|
||||
glucoseUnit: string | null;
|
||||
/**
|
||||
* v1.4.47 W3 — per-user Coach opt-out. When `true`, every Coach
|
||||
|
||||
Reference in new issue
Block a user