feat: download profile images locally in processProfileUpdateEvent

When a profile_update relay arrives with avatar/banner URLs, download
the files to local storage instead of storing remote absolute URLs.
Falls back to absolute URL on any download failure. Cleans up old
local files when replaced.
This commit is contained in:
Jannis Braun
2026-04-08 16:57:06 +02:00
parent fd2254c9c4
commit 0db5e4e453
2 changed files with 47 additions and 10 deletions
@@ -876,7 +876,7 @@ async function runInitialSyncForNewPeers(): Promise<void> {
if (data.events.length === 0) break;
// Process events directly — no HTTP round-trip (FED-005)
processRelayEvents(data.events, peer.origin, peer.origin, db);
await processRelayEvents(data.events, peer.origin, peer.origin, db);
totalEvents += data.events.length;
sinceTimestamp = data.checkpoint;
@@ -907,7 +907,7 @@ async function runInitialSyncForNewPeers(): Promise<void> {
if (friendData.events.length === 0) break;
// Process events directly — no HTTP round-trip (FED-005)
processRelayEvents(friendData.events, peer.origin, peer.origin, db);
await processRelayEvents(friendData.events, peer.origin, peer.origin, db);
totalEvents += friendData.events.length;
friendSinceTimestamp = friendData.checkpoint;