mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
HealthLog — personal health-tracking PWA with weight, blood pressure, pulse, mood tracking, medication compliance, Withings integration, doctor report PDF export, and Dracula-themed UI.
13 lines
477 B
TypeScript
13 lines
477 B
TypeScript
import { createHash } from "crypto";
|
|
|
|
/**
|
|
* Generate a Gravatar avatar URL from an email address.
|
|
* Uses SHA-256 hash (supported by Gravatar since 2023).
|
|
* Returns 404 as default so the client can fall back to initials.
|
|
*/
|
|
export function getGravatarUrl(email: string, size = 80): string {
|
|
const trimmed = email.trim().toLowerCase();
|
|
const hash = createHash("sha256").update(trimmed).digest("hex");
|
|
return `https://www.gravatar.com/avatar/${hash}?s=${size}&d=404`;
|
|
}
|