From 573ea00e7e3c7b55ad7c9bdc26d129382fdfec15 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Jan 2026 12:54:59 +0000 Subject: [PATCH] Increase COUNT timeout to 30s and improve window title - Extend per-relay timeout from 10s to 30s for more reliable results - Update count window title to show human-readable kind names instead of command-line format (e.g., "count: Short Note by abc123..." instead of "count -k 1 -a npub...") --- src/components/CountViewer.tsx | 2 +- src/components/DynamicWindowTitle.tsx | 59 ++++++++++++++++++++++----- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/src/components/CountViewer.tsx b/src/components/CountViewer.tsx index e973f42..9c17ead 100644 --- a/src/components/CountViewer.tsx +++ b/src/components/CountViewer.tsx @@ -53,7 +53,7 @@ interface RelayCountResult { error?: string; } -const COUNT_TIMEOUT = 10000; // 10 second timeout per relay +const COUNT_TIMEOUT = 30000; // 30 second timeout per relay /** * Check if relay supports NIP-45 via NIP-11 relay info diff --git a/src/components/DynamicWindowTitle.tsx b/src/components/DynamicWindowTitle.tsx index 17803b1..c21b2aa 100644 --- a/src/components/DynamicWindowTitle.tsx +++ b/src/components/DynamicWindowTitle.tsx @@ -239,24 +239,61 @@ function generateRawCommand(appId: string, props: any): string { return "req"; case "count": - // COUNT command - similar to REQ but for counting + // COUNT command - human-readable summary if (props.filter) { - const parts: string[] = ["count"]; + const parts: string[] = []; + + // Kinds - use human-readable names if (props.filter.kinds?.length) { - parts.push(`-k ${props.filter.kinds.join(",")}`); - } - if (props.filter["#t"]?.length) { - parts.push(`-t ${props.filter["#t"].slice(0, 2).join(",")}`); + if (props.filter.kinds.length === 1) { + parts.push(getKindName(props.filter.kinds[0])); + } else if (props.filter.kinds.length <= 3) { + parts.push(props.filter.kinds.map(getKindName).join(", ")); + } else { + parts.push(`${props.filter.kinds.length} kinds`); + } } + + // Authors if (props.filter.authors?.length) { - const authorDisplay = props.filter.authors.slice(0, 2).join(","); - parts.push(`-a ${authorDisplay}`); + const count = props.filter.authors.length; + if (count === 1) { + const pk = props.filter.authors[0]; + parts.push(`by ${pk.slice(0, 8)}...`); + } else { + parts.push(`by ${count} authors`); + } } + + // Mentions (#p tags) if (props.filter["#p"]?.length) { - const pTagDisplay = props.filter["#p"].slice(0, 2).join(","); - parts.push(`-p ${pTagDisplay}`); + const count = props.filter["#p"].length; + if (count === 1) { + const pk = props.filter["#p"][0]; + parts.push(`@${pk.slice(0, 8)}...`); + } else { + parts.push(`@${count} users`); + } + } + + // Hashtags + if (props.filter["#t"]?.length) { + const tags = props.filter["#t"]; + if (tags.length <= 2) { + parts.push(tags.map((t: string) => `#${t}`).join(" ")); + } else { + parts.push(`#${tags[0]} +${tags.length - 1}`); + } + } + + // Search + if (props.filter.search) { + parts.push(`"${props.filter.search}"`); + } + + if (parts.length > 0) { + return `count: ${parts.join(" ")}`; } - return parts.join(" "); } return "count";