From 39aaa96a9946b4bbacfe5db1616c051c55b2139e Mon Sep 17 00:00:00 2001 From: Jason Tudisco Date: Sun, 8 Mar 2026 06:41:48 -0600 Subject: [PATCH] feat: add Gravatar avatars with monsterid fallback for user identification - Add avatar_hash (MD5 of email) to MessagePayload for server-side hash computation - Create avatar.js with Gravatar URL generation and client-side MD5 implementation - Show sender names and unique avatars on all messages including own messages - Use monsterid fallback for users without Gravatar, robot icons reserved for AI - LEFT JOIN users table in message history queries for avatar hash lookup Co-Authored-By: Claude Opus 4.6 --- client/src/components/app.riot | 1 + client/src/components/chat-room.riot | 21 +++- client/src/components/chat-sidebar.riot | 25 ++++- client/src/components/message-bubble.riot | 28 ++++-- client/src/services/avatar.js | 116 ++++++++++++++++++++++ server/Cargo.lock | 27 ++--- server/Cargo.toml | 1 + server/src/handlers/rooms.rs | 43 ++++---- server/src/handlers/ws.rs | 10 +- server/src/models/mod.rs | 10 ++ 10 files changed, 239 insertions(+), 43 deletions(-) create mode 100644 client/src/services/avatar.js diff --git a/client/src/components/app.riot b/client/src/components/app.riot index 9fd1dee..6700488 100644 --- a/client/src/components/app.riot +++ b/client/src/components/app.riot @@ -224,6 +224,7 @@ mentions: [], is_ai: true, streaming: true, + avatar_hash: '', }, }) this.scrollToBottom() diff --git a/client/src/components/chat-room.riot b/client/src/components/chat-room.riot index 396751f..d59ceed 100644 --- a/client/src/components/chat-room.riot +++ b/client/src/components/chat-room.riot @@ -54,7 +54,15 @@ AI
-
{member.display_name?.charAt(0).toUpperCase()}
+
+ {member.display_name} +
{member.display_name} Owner
@@ -222,6 +230,14 @@ font-size: var(--text-xs); color: var(--text-secondary); flex-shrink: 0; + overflow: hidden; + } + + .avatar-img { + width: 100%; + height: 100%; + border-radius: var(--radius-full); + object-fit: cover; } .member-item .ai-avatar { @@ -413,8 +429,11 @@ diff --git a/client/src/components/message-bubble.riot b/client/src/components/message-bubble.riot index 32c03e0..54bce77 100644 --- a/client/src/components/message-bubble.riot +++ b/client/src/components/message-bubble.riot @@ -1,6 +1,6 @@
-
+
@@ -9,17 +9,21 @@ - + {props.message?.sender_name}
-
+
{props.message?.sender_name} {formatTime(props.message?.created_at)}
-
- {formatTime(props.message?.created_at)} -