diff --git a/config/instance-config.js b/config/instance-config.js index dfa246ec..493e6931 100644 --- a/config/instance-config.js +++ b/config/instance-config.js @@ -23,6 +23,15 @@ */ export const IS_DEV_MODE = true; +/** + * Whether development builds should surface extra verbose diagnostics. + * + * Set this to `true` to keep high-volume development warnings (like COUNT + * request failures) visible in the console. Flip it to `false` when you want + * a quieter dev mode without disabling other development helpers entirely. + */ +export const IS_VERBOSE_DEV_MODE = true; + /** * Whether the current deployment should operate in lockdown mode. * diff --git a/js/config.js b/js/config.js index 7a07c770..2864a36d 100644 --- a/js/config.js +++ b/js/config.js @@ -3,6 +3,7 @@ import { userLogger } from "./utils/logger.js"; import { IS_DEV_MODE, + IS_VERBOSE_DEV_MODE, IS_LOCKDOWN_MODE, ADMIN_SUPER_NPUB, ADMIN_DM_IMAGE_URL, @@ -43,11 +44,15 @@ import { export const isDevMode = Boolean(IS_DEV_MODE); export { IS_DEV_MODE }; +export const isVerboseDevMode = Boolean(IS_VERBOSE_DEV_MODE); +export { IS_VERBOSE_DEV_MODE }; + export const isLockdownMode = Boolean(IS_LOCKDOWN_MODE); export { IS_LOCKDOWN_MODE }; if (typeof window !== "undefined") { window.__BITVID_DEV_MODE__ = isDevMode; + window.__BITVID_VERBOSE_DEV_MODE__ = isVerboseDevMode; window.__BITVID_LOCKDOWN_MODE__ = isLockdownMode; } diff --git a/js/nostr/client.js b/js/nostr/client.js index 27249fc3..822de47f 100644 --- a/js/nostr/client.js +++ b/js/nostr/client.js @@ -1,6 +1,6 @@ // js/nostr/client.js -import { isDevMode } from "../config.js"; +import { isDevMode, isVerboseDevMode } from "../config.js"; import { FEATURE_PUBLISH_NIP71 } from "../constants.js"; import { accessControl } from "../accessControl.js"; // 🔧 merged conflicting changes from codex/update-video-publishing-and-parsing-logic vs unstable @@ -345,7 +345,9 @@ function withRequestTimeout(promise, timeoutMs, onTimeout, message = "Request ti try { onTimeout(); } catch (cleanupError) { - devLogger.warn("[nostr] COUNT timeout cleanup failed:", cleanupError); + if (isVerboseDevMode) { + devLogger.warn("[nostr] COUNT timeout cleanup failed:", cleanupError); + } } } reject(new Error(message)); @@ -5744,10 +5746,12 @@ export class NostrClient { if (isUnsupported) { this.countUnsupportedRelays.add(url); } else { - devLogger.warn( - `[nostr] COUNT request failed on ${url}:`, - error, - ); + if (isVerboseDevMode) { + devLogger.warn( + `[nostr] COUNT request failed on ${url}:`, + error, + ); + } } return { url, ok: false, error, unsupported: isUnsupported }; } diff --git a/js/nostr/publishHelpers.js b/js/nostr/publishHelpers.js index 077dde60..38eea286 100644 --- a/js/nostr/publishHelpers.js +++ b/js/nostr/publishHelpers.js @@ -1,5 +1,6 @@ import { ENSURE_PRESENCE_REBROADCAST_COOLDOWN_SECONDS, + isVerboseDevMode, } from "../config.js"; import { publishEventToRelays, @@ -1023,7 +1024,9 @@ export async function rebroadcastEvent({ client, eventId, options = {} }) { }) : null; } catch (error) { - devLogger.warn("[nostr] COUNT request for rebroadcast failed:", error); + if (isVerboseDevMode) { + devLogger.warn("[nostr] COUNT request for rebroadcast failed:", error); + } } if (countResult?.total && Number(countResult.total) > 0) { diff --git a/js/nostr/viewEvents.js b/js/nostr/viewEvents.js index 723b93b0..e0e50563 100644 --- a/js/nostr/viewEvents.js +++ b/js/nostr/viewEvents.js @@ -1,6 +1,7 @@ import { VIEW_COUNT_DEDUPE_WINDOW_SECONDS, VIEW_COUNT_BACKFILL_MAX_DAYS, + isVerboseDevMode, } from "../config.js"; import { VIEW_FILTER_INCLUDE_LEGACY_VIDEO } from "../constants.js"; import { @@ -590,7 +591,9 @@ export async function countVideoViewEvents(client, pointer, options = {}) { } } catch (error) { if (error?.code !== "count-unsupported") { - devLogger.warn("[nostr] COUNT view request failed:", error); + if (isVerboseDevMode) { + devLogger.warn("[nostr] COUNT view request failed:", error); + } } }