From 5ed5554f51e11f1b433aafbea3fcb26deb04044a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 5 Jan 2026 21:23:32 +0000 Subject: [PATCH] fix(logs): suppress dm sync spam and allow local image paths --- js/ui/applicationBootstrap.js | 2 +- js/ui/profileModalController.js | 13 +++++++++---- js/utils/profileMedia.js | 4 ++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/js/ui/applicationBootstrap.js b/js/ui/applicationBootstrap.js index 1447170e..22910063 100644 --- a/js/ui/applicationBootstrap.js +++ b/js/ui/applicationBootstrap.js @@ -392,7 +392,7 @@ export default class ApplicationBootstrap { app.loginModalController = null; app.currentUserNpub = null; - app.initializeLoginModalController({ logIfMissing: true }); + app.initializeLoginModalController({ logIfMissing: false }); app.profileButton = doc?.getElementById("profileButton") || null; app.profileAvatar = doc?.getElementById("profileAvatar") || null; diff --git a/js/ui/profileModalController.js b/js/ui/profileModalController.js index f30a33a9..793f5c93 100644 --- a/js/ui/profileModalController.js +++ b/js/ui/profileModalController.js @@ -1124,6 +1124,7 @@ export class ProfileModalController { this.directMessagesUnsubscribes = []; this.pendingMessagesRender = null; this.messagesStatusClearTimeout = null; + this.lastDirectMessageErrorTime = 0; this.profileHistoryRenderer = null; this.profileHistoryRendererConfig = null; @@ -2417,10 +2418,14 @@ export class ProfileModalController { handleDirectMessagesError(detail = {}) { const error = detail?.error || detail?.failure || detail; - userLogger.warn( - "[profileModal] Direct message sync issue detected:", - error, - ); + const now = Date.now(); + if (now - this.lastDirectMessageErrorTime > 5000) { + userLogger.warn( + "[profileModal] Direct message sync issue detected:", + error, + ); + this.lastDirectMessageErrorTime = now; + } if (this.activeMessagesRequest) { return; diff --git a/js/utils/profileMedia.js b/js/utils/profileMedia.js index 07cb2dfd..bbb48440 100644 --- a/js/utils/profileMedia.js +++ b/js/utils/profileMedia.js @@ -62,6 +62,10 @@ export function sanitizeProfileMediaUrl(value) { return trimmed; } + if (/^images\//i.test(trimmed)) { + return trimmed; + } + if (!/^https?:\/\//i.test(trimmed)) { if (LOCALHOST_PATTERN.test(trimmed)) { trimmed = `http://${trimmed}`;