mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
View counts inflated. viewCounter.js dedupes locally by (viewer, time-window) correctly, but the published events couldn't be deduped by relays: generateViewEventDedupeTag built the kind-30079 `d` tag with random entropy + exact timestamp, so every view was a UNIQUE event. And exactCountForPointer runs a NIP-45 COUNT (raw event count, no dedupe) and bumped the displayed total up to it (max(deduped, raw)). Net: reloads / multi-device / re-watches each added a view. Make the `d` tag deterministic and window-bucketed (scope:viewer:bucket, no entropy) so kind-30079 view events are genuinely parameterized-replaceable: relays keep one event per (viewer, video, window), so the cheap NIP-45 COUNT becomes accurate AND scalable and the raw count stops inflating. buildViewEvent no longer invents a random `d` tag (the only production caller, publishViewEvent, always supplies the deterministic one). Pre-existing entropy events age out over the backfill horizon. Tests: tests/view-event-dedupe.test.mjs. Co-Authored-By: Claude Opus 4.8 <[email protected]>