
* Remove image from session, add /api/me, update Avatar component * Fixed Avatar on Desktop * Added emailMd5 to session + load md5 from props on /settings/profile * Explicitly select which fields to expose in /api/me * Abstracted Gravatar, defaults avatar for /api/me, removed session dep from UserDropdown * Delete md5.js :) Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
11 lines
327 B
TypeScript
11 lines
327 B
TypeScript
import crypto from "crypto";
|
|
|
|
export const defaultAvatarSrc = function ({ email, md5 }: { md5?: string; email?: string }) {
|
|
if (!email && !md5) return "";
|
|
|
|
if (email && !md5) {
|
|
md5 = crypto.createHash("md5").update(email).digest("hex");
|
|
}
|
|
|
|
return `https://www.gravatar.com/avatar/${md5}?s=160&d=identicon&r=PG`;
|
|
};
|