Commit Graph

10 Commits

Author SHA1 Message Date
Benjamin Price
f112ac4819 fix: use stable site hash for install telemetry deduplication (#298)
* fix: use stable site hash for install telemetry deduplication (#297)

generateSiteHash() used Date.now() as the hash seed, producing a different
hash on every call. Since the installs table uses PRIMARY KEY (plugin_id,
site_hash), the same site could insert unlimited rows, inflating install
counts and making "Most Popular" sorting meaningless.

Fix: use the site's request origin as a stable hash seed. The same origin
always produces the same hash, so the marketplace deduplicates correctly.

Also denormalizes install_count on the plugins table to avoid a COUNT(*)
subquery per row in searchPlugins(). The count is recalculated atomically
on each upsertInstall() call.

Fixes #297

* chore: add changeset for install telemetry fix

* fix: address review feedback on install telemetry

- Replace crypto.subtle fallback with FNV-1a hash to avoid origin
  leakage and collisions from truncated seed strings
- Remove duplicate p.install_count from SELECT (p.* already includes it)
- Use explicit p.install_count in ORDER BY clause
- Use db.batch() for atomic upsert + count recomputation instead of
  separate statements with misleading meta.changes check
2026-04-07 22:37:00 +01:00
Matt Kane
ca398cc3f8 format 2026-04-01 15:25:41 +01:00
Matt Kane
bc81ad2280 fix: update database_id in wrangler.jsonc and add README.md 2026-04-01 15:05:11 +01:00
Matt Kane
4bafdb9781 Add publish CI with OIDC trusted publishing and changesets 2026-04-01 12:01:32 +01:00
Matt Kane
ca3c2b77e1 Format 2026-04-01 11:51:57 +01:00
Matt Kane
c2120a4961 Fix repo names 2026-04-01 11:18:28 +01:00
Matt Kane
5e061c3569 Align version numbers 2026-04-01 11:11:34 +01:00
Matt Kane
2e863566b3 Fix scope 2026-04-01 10:58:32 +01:00
Matt Kane
482a442f60 Add readme 2026-04-01 10:46:10 +01:00
Matt Kane
43fcb9a131 first commit 2026-04-01 10:44:22 +01:00