41 Commits
Author SHA1 Message Date
thePR0M3TH3ANandClaude Opus 4.8 c48083dfcc [admin] fix whitelist/blacklist edits with nsec & NIP-46; loosen file-size limits
Admin list edits worked with a NIP-07 extension but silently failed with nsec and
NIP-46 (Amber). persistNostrState signed with window.nostr.signEvent directly (and
required requestDefaultExtensionPermissions), so non-extension logins threw
"nostr-extension-missing".

Fix: sign with the ACTIVE signer (getActiveSigner() from the registry — extension/nsec/
NIP-46 all expose signEvent), and only run the extension-permission prompt when the
signer is an extension (type extension/nip07). Regression test in
tests/admin-list-store.test.mjs (nsec signer used while window.nostr.signEvent throws).

Also (per maintainer request): raise the file-size lint margins to stop churning on an
arbitrary cap — THRESHOLD 1000→1200 (new files), GROWTH_MARGIN 50→200 (grandfathered).

TODOs added: #42 follow-up audit of every signing path (must use the active signer, not
window.nostr); #43 logged-in profile card at the top of the profile modal (half-on/half-
off); #44 in-modal storage selector + unlock for the upload modal.

Build + lint clean; admin-list suite green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-30 17:00:57 -04:00
thePR0M3TH3ANandClaude Opus 4.8 3e57ab2ea9 [moderation] #25: per-video admin block list (hide a single video, not the author)
Admin moderation was author/community-level only. Admins (any editor — same gate as
the author blacklist) can now hide a SINGLE offending video.

- Record: a published kind-30000 NIP-51 list under d-tag bitvid:admin:event-blacklist,
  carrying blocked event ids as `e` tags (NOTE_TYPES.ADMIN_EVENT_BLACKLIST schema).
  Loaded/persisted through the existing admin-list machinery (adminListStore) and cached
  like whitelist/blacklist.
- accessControl: eventBlacklist Set + getEventBlacklist/isEventBlacklisted/
  addToEventBlacklist/removeFromEventBlacklist (editor-gated; normalizes hex or
  nevent/note) + onEventBlacklistChange.
- Render filter already existed (app.blacklistedEventIds, honored by every feed/grid/
  search/playback path) but was fed only by the static ADMIN_INITIAL_EVENT_BLACKLIST
  config. app._rebuildBlacklistedEventIds() now merges that static base with the dynamic
  admin list, and an onEventBlacklistChange listener rebuilds + refreshes grids on change.
- UI: a "Block this video" item in the per-video ⋯ menu (editor-only), handled by
  handleBlacklistEventAction (js/ui/moreMenu/blacklistEventAction.js).

Helpers extracted to js/adminEventBlacklistHelpers.js to keep adminListStore /
accessControl / moreMenuController under their size caps. Tests:
tests/admin-event-blacklist.test.mjs (9). Build + lint clean; admin/access/moderation
suites 56/56.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-30 15:19:34 -04:00
thePR0M3TH3ANandClaude Opus 4.8 a8e9f5202a adminLists: batch community-blacklist fetch (kill cold-start kind-30000 storm)
Cold-start fired one kind-30000 REQ per community-blacklist curator
(loadCommunityBlacklistEntries did Promise.all over references, each a
fetchLatestListEvent) — ~28-32 parallel REQs that dominated the login
relay-REQ spike and starved the feed.

A Nostr filter ORs `authors` and `#d`, so all curators collapse into ONE
batched REQ. New js/adminListBatch.js (pure, mutation-tested):
buildBatchedReferenceFilter + selectNewestEventsForReferences (newest per
author:d-tag, discards author×d-tag cross-products) +
fetchBatchedReferenceEvents (routes through the subscription manager's
list — health-gated/timeout-bounded, not raw pool). Helpers extracted to
their own module so adminListStore stays under its size cap.

Best-effort: on batch failure we return nothing and the cached admin
state carries over (readCachedAdminState).

Addresses pre-launch TODO #9 (cold-login REQ storm). Tests + mutation-
verified (newest selection, cross-product discard). 1249/1250 unit
(known UploadModal flake).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-22 18:47:00 -04:00
thePR0M3TH3ANandClaude Opus 4.8 3f19294a8e fix(admin-lists): force full fetch so persisted lastSeen can't hide current list
fetchLatestListEvent fetched admin lists via fetchListIncrementally without an
explicit `since`, so it relied on the persisted per-relay lastSeen. Admin lists
are replaceable events with a single current version whose created_at does not
advance, so once lastSeen == that created_at, every later load queries
since=lastSeen+1 and the relay returns nothing — perpetually hiding the current
list and dropping admin lists whenever the local cache is absent.

Pass since: 0 to force a full fetch of the (tiny) current event each time. Other
list callers anchor an explicit since to their own cached state; admin lists
have no comparable per-list timestamp, so always re-fetching current is both
correct and cheap.

Adds tests/nostr/relayBatchFetcherReplaceable.test.mjs documenting the
replaceable-event since-gate at the fetcher boundary: relying on persisted
lastSeen hides the current event; since: 0 returns it.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-12 09:44:36 -04:00
thePR0M3TH3AN 820a810ee4 Merge branch 'unstable' into agents/weekly/race-condition-2026-02-22-4789629545643517997 2026-02-22 15:51:22 -05:00
google-labs-jules[bot]andPR0M3TH3AN 7a8c738a09 fix(ci): install firefox in e2e-headless and fix admin list race condition
- Update .github/workflows/ci.yml to install firefox for e2e-headless job
- Update js/adminListStore.js to await nostrClient.initPromise if pool is not ready, preventing race conditions during app startup

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-22 19:05:27 +00:00
google-labs-jules[bot]andPR0M3TH3AN 8257a94925 fix(ci): resolve e2e timeouts and add app init safeguards
- Add `firefox` to `npx playwright install` in CI workflow to fix headless execution failures.
- Implement 15s safeguard timeout in `js/app.js` for `_initAccessControl` to prevent app hang during startup.
- Add `SHORT_TIMEOUT_MS` (5s) to `fetchLatestListEvent` in `js/adminListStore.js` to prevent indefinite hanging on relay queries.
- Update `tests/admin-list-store.test.mjs` to force dev mode for warning assertions.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-22 18:33:41 +00:00
thePR0M3TH3AN ceccd34681 Revert "Dead Code Cleanup" 2026-01-30 16:51:01 -05:00
google-labs-jules[bot]andPR0M3TH3AN 60fa6c4282 chore(ai): remove dead code (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 20:54:52 +00:00
google-labs-jules[bot]andPR0M3TH3AN e993046d60 fix(admin): exclude whitelisted users from blacklist in admin state and fix unit tests
- Modified `sanitizeAdminState` in `js/adminListStore.js` to ensure whitelisted users are automatically excluded from the blacklist.
- Updated `tests/admin-list-store.test.mjs` to use `throw-community` failure mode in the mock pool, fixing a flaky test case that incorrectly assumed base lists would load when `throw-authors` was active.
- Updated `tests/ui/tag-pill-list.test.mjs` to expect `#` prefixed tags, aligning with recent UI changes.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-27 18:02:01 +00:00
google-labs-jules[bot]andPR0M3TH3AN 9d820c27e9 fix(nostr): prevent list data loss on fetch failure and optimize login timeout
- Update `fetchListIncrementally` in `js/nostr/client.js` to throw an error if all relays fail, preventing empty returns from being interpreted as data loss.
- Update `HashtagPreferencesService`, `UserBlockListManager`, and `SubscriptionsManager` to handle fetch errors gracefully without wiping local state.
- Update `js/nostr/nip07Permissions.js` to use a short timeout (3s) for experimental permission requests, fixing "clunky" login issues while preserving user interaction time for standard login.
- Remove `try/catch` in `adminListStore.js` fetch logic to allow error propagation to the fallback cache logic.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-26 20:16:08 +00:00
google-labs-jules[bot] a731ef6887 fix(ai): frontend console error — fix missing build artifact and admin list fetch warning (agent)
- Added `start` script to `package.json` to ensure `npm run build` is executed before serving, preventing 404 errors for `css/tailwind.generated.css`.
- Updated `js/adminListStore.js` to include the super admin pubkey (decoded from `ADMIN_SUPER_NPUB`) in the filter when fetching admin lists. This resolves the warning: `[adminListStore] Cannot use incremental fetch for editors without author.`
- Added `scripts/agent/debug_frontend.py` to diagnose frontend errors using Playwright.
- Verified fixes by running the debug script and confirming warnings are gone.
2026-01-23 18:45:36 +00:00
google-labs-jules[bot] 9d06f43321 feat: implement incremental fetching for Nostr lists
Implements a `SyncMetadataStore` to persist last-seen timestamps for replaceable lists (Kind 10000, 30000, 30002, 30015).
Adds `fetchListIncrementally` helper to `NostrClient` which performs per-relay `since` queries.
Updates `SubscriptionsManager`, `UserBlockListManager`, `HashtagPreferencesService`, and `adminListStore` to utilize incremental fetching.
Prevents local cache wipes when incremental fetches return empty results (indicating "no updates").
2026-01-17 21:11:48 +00:00
google-labs-jules[bot] 86ffb8cb2a Define centralized cache policies and wire them into fetchers 2026-01-17 19:12:09 +00:00
google-labs-jules[bot] d6882fb5bb Fix CI, environment, linting, and unit test issues
- Fix circular dependency in `js/adminListStore.js` by importing from `js/nostrClientRegistry.js`.
- Update `js/services/hashtagPreferencesService.js` to include legacy kind 30005 in filters.
- Fix JSDOM mocking in `tests/modal-accessibility.test.mjs` (navigator getter) and `UploadModal` selectors.
- Add `getRoot()` to `js/ui/components/UploadModal.js` for API consistency.
- Update `tests/magnet-utils.test.mjs` expectations to reflect removed default tracker.
- Mock `ensureActiveSignerForPubkey` in `tests/moderation/submit-report.test.mjs`.
- Fix mock loader path in `tests/moderation/trust-seeds.test.mjs` to target `trustBootstrap.js`.
- Fix duplicate pointer tags in `js/nostrEventSchemas.js`'s `buildCommentEvent`.
- Update `tests/nostr/comment-events.test.mjs` and `tests/comment-event-builder.test.mjs` to match current code behavior (legacy kinds, unique tags).
2026-01-13 20:32:06 +00:00
thePR0M3TH3AN 40490afac2 Allow overlapping admin lists 2026-01-11 09:33:06 -05:00
google-labs-jules[bot] 1b577d3326 Refactor: remove legacy compatibility systems
- Removed `WATCH_HISTORY_LEGACY_KIND` (30078) support from watch history fetch and config.
- Removed `WATCH_HISTORY_LEGACY_LIST_IDENTIFIERS` from config.
- Removed `LEGACY_EVENTS_STORAGE_KEY` (bitvidEvents) migration logic from client.
- Removed `loadLegacyAdminState` and `LEGACY_STORAGE_KEYS` from admin list store.
- Updated tests to remove references to legacy kinds.
2026-01-06 19:48:55 +00:00
thePR0M3TH3AN 5d31366c79 Restore comment bootstrap and guard admin cache hydration 2025-11-03 20:19:45 -05:00
thePR0M3TH3AN 5536180682 refactor: centralize nostr client bootstrap 2025-10-22 21:09:18 -04:00
thePR0M3TH3AN 6d7d5fc7ff Fix admin cache hydration cycle and guard QR code Android detection 2025-10-21 19:47:05 -04:00
thePR0M3TH3AN 48d6f51ab6 Add caching for admin list state and hydrate access control 2025-10-20 21:03:07 -04:00
thePR0M3TH3AN 4fee05a447 Add community blacklist federation support 2025-10-20 14:13:48 -04:00
thePR0M3TH3AN 7703dd13ae Optimize admin list publish acceptance 2025-10-20 13:05:36 -04:00
thePR0M3TH3AN ab4b80470f Optimize admin list publish flow 2025-10-20 12:52:24 -04:00
thePR0M3TH3AN 2905bbea64 Refactor admin list relay publishing 2025-10-20 12:43:22 -04:00
thePR0M3TH3AN 32367a0bb3 Improve admin list npub handling 2025-10-18 16:21:39 -04:00
thePR0M3TH3AN deffbf7670 Ensure NIP-07 permissions are granted before signing and encrypting 2025-10-15 22:36:57 -04:00
thePR0M3TH3AN 0a2a2c4e78 Fix syntax errors blocking app bootstrap 2025-10-15 15:08:55 -04:00
thePR0M3TH3AN 7ae07b1369 refactor: migrate console usage to shared loggers 2025-10-15 14:37:25 -04:00
thePR0M3TH3AN d705cf176b Revert "Refactor logging to centralized logger" 2025-10-15 11:14:10 -04:00
thePR0M3TH3AN 37ba57aa37 Refactor logging to centralized logger 2025-10-15 11:11:14 -04:00
thePR0M3TH3AN 0bf0c1be5c Fix admin list npub parsing 2025-10-09 09:30:03 -04:00
thePR0M3TH3AN c87d9d96a4 Guard admin list relay publish listeners 2025-10-01 19:47:52 -04:00
thePR0M3TH3AN 0e29b07d5b refactor: centralize nostr event schemas 2025-10-01 13:21:59 -04:00
thePR0M3TH3AN 713e4eeab6 Revert "Handle nostr readiness and count fallback" 2025-10-01 12:52:42 -04:00
thePR0M3TH3AN 434f5c3fa5 Handle nostr readiness and count fallback 2025-10-01 11:55:31 -04:00
thePR0M3TH3AN 169f0c952c Prevent moderators from blacklisting themselves 2025-09-28 21:23:33 -04:00
thePR0M3TH3AN 84b5ef77c0 Enforce remote admin list storage 2025-09-28 19:38:56 -04:00
thePR0M3TH3AN c6c297e16b Clear legacy admin defaults and trust adapter state 2025-09-28 19:21:51 -04:00
thePR0M3TH3AN 66595edaf6 Enforce admin list invariants 2025-09-28 19:17:31 -04:00
thePR0M3TH3AN 014b1369b0 feat: add async admin list adapters 2025-09-28 19:04:28 -04:00