diff --git a/ROADMAP.md b/ROADMAP.md index 9460d281..28224686 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,6 +1,5 @@ # Current -- [ ] Relay detail page, with more information about the relay + tabbed feeds (notes, more?) - [ ] Add customize icon and route with editable custom view cards using "lists" nip - nevent1qqspjcqw2hu5gfcpkrjhs0aqvxuzjgtp50l375mcqjfpmk48cg5hevgpr3mhxue69uhkummnw3ez6un9d3shjtnhd3m8xtnnwpskxegpzamhxue69uhkummnw3ezuendwsh8w6t69e3xj7spramhxue69uhkummnw3ez6un9d3shjtnwdahxxefwv93kzer9d4usz9rhwden5te0wfjkccte9ejxzmt4wvhxjmcpr9mhxue69uhkummnw3ezuer9d3hjuum0ve68wctjv5n8hwfg - [ ] Custom views should combine pubkeys, relays, event ids, and topics @@ -18,6 +17,7 @@ # More +- [ ] Support https://github.com/nostr-protocol/nips/pull/211 as a bech32 entity - [ ] Add new DM button to dms list - [ ] Add suggested relays based on follows or topics - [ ] Combine alerts/messages and any other top-level subscriptions to avoid sub limit diff --git a/src/agent/pool.ts b/src/agent/pool.ts index 19efe9b3..3995f91d 100644 --- a/src/agent/pool.ts +++ b/src/agent/pool.ts @@ -248,6 +248,10 @@ const subscribe = async ( log(`Starting subscription ${id} with ${relays.length} relays`, filter, relays) } + if (relays.length !== new Set(pluck('url', relays)).size) { + error(`Subscribed to non-unique relays`, relays) + } + const promises = relays.map(async relay => { const conn = await connect(relay.url) diff --git a/src/agent/relays.ts b/src/agent/relays.ts index 4c1abb44..017dddf8 100644 --- a/src/agent/relays.ts +++ b/src/agent/relays.ts @@ -157,7 +157,7 @@ export const sampleRelays = (relays, scale = 1) => { ) } - return relays + return uniqByUrl(relays) } export const aggregateScores = relayGroups => { diff --git a/src/util/misc.ts b/src/util/misc.ts index 718aa5aa..47fe342b 100644 --- a/src/util/misc.ts +++ b/src/util/misc.ts @@ -242,14 +242,14 @@ export const where = filters => // https://stackoverflow.com/a/21682946 // -export const stringToColor = (value, saturation = 100, lightness = 50) => { +export const stringToColor = (value, {saturation = 100, lightness = 50, opacity = 1} = {}) => { let hash = 0; for (let i = 0; i < value.length; i++) { hash = value.charCodeAt(i) + ((hash << 5) - hash) hash = hash & hash } - return `hsl(${(hash % 360)}, ${saturation}%, ${lightness}%)`; + return `hsl(${(hash % 360)}, ${saturation}%, ${lightness}%, ${opacity})`; } export const tryJson = f => { diff --git a/src/views/relays/RelayDetail.svelte b/src/views/relays/RelayDetail.svelte index 7fe4a8fa..a566f950 100644 --- a/src/views/relays/RelayDetail.svelte +++ b/src/views/relays/RelayDetail.svelte @@ -1,7 +1,7 @@