Commit Graph
32 Commits
Author SHA1 Message Date
thePR0M3TH3ANandClaude Opus 4.8 8ab531b241 fix(access): canAccess cross-derives hex+npub so whitelisted authors aren't blocked (#32)
A video from a genuinely whitelisted author refused to play with "not from a
whitelisted author" (the source URL was confirmed healthy — HTTP 200, video/mp4,
range, CORS *). Root cause: accessControl keeps the whitelist in two sets —
whitelistPubkeys (hex) and whitelist (npub) — and canAccess consulted only one
based on the caller's input format without cross-deriving. playbackCoordinator
passes the author's npub, so it checked only the npub set; an entry present in
only the hex representation read as "not allowed."

- canAccess now derives BOTH hex and npub from the candidate and checks both sets
  (only fixes false-negatives; a non-whitelisted author is still denied).
- Dev-gated diagnostic at the playback rejection logs hex/npub, whitelistMode,
  set sizes, and inNpubSet/inHexSet to pinpoint any remaining denial.
- Tests: tests/access-control-canaccess.test.mjs.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-25 10:39:11 -04:00
thePR0M3TH3ANandClaude Opus 4.8 c849969312 nip71: inbound ingest service (whitelist-scoped, default on)
Pulls NIP-71 video events published by other Nostr apps (kinds
21/22/34235/34236), converts them via the ingest adapter, and injects
them into nostrClient.activeMap/allEvents so they flow through the
existing feed pipeline. Gated by FEATURE_NIP71_INGEST.

Mirrors bitvid's whitelist model: since the whitelist is "authors
allowed to publish/render here," ingest scopes its relay subscription to
whitelisted pubkeys while whitelist mode is on (bounded, no firehose) and
re-subscribes when the whitelist changes. When a deployer disables
whitelist mode, ingest opens to all authors (capped by a limit). Foreign
content is still gated by the same render-time filter
(shouldIncludeVideo -> accessControl.canAccess): whitelist, blacklist,
NSFW (content-warning -> isNsfw), private-skip, plus trust/mute/blur from
the feed engine. Native bitvid videos always win a shared root; among
ingested videos newest wins. Refreshes via the existing videos:updated
reactive path.

- accessControl.getWhitelistPubkeys(): hex whitelist for subscription scope.
- Wired in applicationBootstrap (start on init, stop on teardown).
- nostrService untouched (at its size cap); logic is a standalone service.

Mutation-verified: native-wins, whitelist scoping, feature gate.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-22 15:26:06 -04:00
thePR0M3TH3ANandClaude Opus 4.8 122d806ad2 perf(feed): don't block fresh load on remote admin-list fetch
loadVideos awaited ensureAccessControlReady -> waitForReady -> _performRefresh
-> loadAdminState, which awaits a remote admin-list fetch. On a cold load that
waits for relays to connect (~5s) plus the fetch, stalling the feed ~10s before
any video renders. The cached admin state IS hydrated synchronously at
construction, but with markLoaded:false, so waitForReady blocked on a full
remote refresh even when a usable cache existed ("refresh fixes it").

ensureAccessControlReady now blocks only on a first-ever cold load WITH whitelist
mode (where showing non-whitelisted content before the whitelist arrives would be
wrong). In every other case — admin state hydrated from the localStorage cache,
already loaded, or blacklist-only mode — it kicks the refresh off in the
background (ensureReady) and renders immediately; the reactive
onWhitelist/onBlacklistChange handlers re-filter the grid once fresh lists land.

Adds accessControl.isHydrated() and a branching test
(nostr-service-access-control-ready.test.mjs).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-12 14:31:38 -04:00
google-labs-jules[bot]andPR0M3TH3AN aaab4cb52e Fix E2E test access control failures and improve test coverage
- Add localhost-restricted bypass for Access Control and Lockdown Mode in `AuthService` and `AccessControl` to allow E2E tests to run against the app.
- Update `scripts/check-file-size.mjs` to reflect increased size of `js/services/authService.js`.
- (Previous steps) Added `tests/e2e/dm-scenarios.spec.ts`, updated `bitvidTestFixture.ts`, and `testHarness.js`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-22 04:35:05 +00:00
google-labs-jules[bot]andPR0M3TH3AN 667d7cb1dc Fix: E2E test robustness (lockdown bypass, feed visibility, login state)
- Add `s` tag to seeded video events in `bitvidTestFixture.ts` to pass schema validation and appear in feeds.
- Update `js/testHarness.js` `loginWithNsec` to call `app.authService.login()`, ensuring UI state reflects login.
- Update `js/testHarness.js` `logout` to be async and use `app.requestLogout()`.
- Fix TypeScript error in `tests/e2e/dm-scenarios.spec.ts`.
- Update `js/accessControl.js` to bypass lockdown mode when `__test__` URL param or `__bitvidTestMode__` localStorage item is present, allowing E2E tests to run against a lockdown environment.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-22 04:16:13 +00:00
google-labs-jules[bot] ad3375ed09 fix: ensure access control lists are loaded before playback
Introduced `waitForReady` in `AccessControl` to block until moderation lists are fetched, and updated `playVideoByEventId` and `trustBootstrap` to use it, preventing false "not whitelisted" errors in private tabs.
2026-01-23 04:39:18 +00:00
google-labs-jules[bot] 29857dc36c Optimize application startup speed by parallelizing initialization 2026-01-13 04:21:13 +00:00
thePR0M3TH3AN 40490afac2 Allow overlapping admin lists 2026-01-11 09:33:06 -05:00
thePR0M3TH3AN 1211f1a25d Adjust blacklist precedence for access control 2026-01-11 09:14:35 -05:00
google-labs-jules[bot] 8aaa2f69ee Fix: Ensure trust seed mutes are loaded for session actors
- Fixed `ModerationService.reconcileTrustedMuteSubscriptions` to always force re-subscription to trusted seeds, bypassing previous state comparisons.
- Enhanced `ModerationService` to filter trusted seeds against the global admin blacklist.
- Added blacklist change event support to `AccessControl` and `TrustBootstrap` to dynamically update seeds when the blacklist changes.
- Added detailed logging to `ModerationService`, `TrustBootstrap`, and `AccessControl` to trace trust seed initialization and application.
2026-01-10 03:36:19 +00:00
google-labs-jules[bot] 1c366a4a78 Fix: Ensure trust seed mutes are loaded for session actors
- Fixed `ModerationService.clearTrustedMuteTracking` to properly force re-subscription to trusted seeds by passing an empty previous state.
- Enhanced `ModerationService` to filter trusted seeds against the global admin blacklist.
- Added blacklist change event support to `AccessControl` and `TrustBootstrap` to dynamically update seeds when the blacklist changes.
2026-01-10 01:29:04 +00:00
thePR0M3TH3AN 5d31366c79 Restore comment bootstrap and guard admin cache hydration 2025-11-03 20:19:45 -05:00
thePR0M3TH3AN c1186510e1 Ensure access control hydrates cache synchronously 2025-10-27 17:49:34 -04:00
thePR0M3TH3AN eb1dfc194f Restore default accessControl export 2025-10-27 12:59:56 -04:00
thePR0M3TH3AN d525788994 Handle hex pubkeys in access control 2025-10-26 15:33:09 -04:00
thePR0M3TH3AN 2daffd0354 Fix admin cache hydration timing and video moderation handler 2025-10-25 17:46:57 -04:00
thePR0M3TH3AN 3fa40c6961 Add editor change listener to access control 2025-10-24 23:15:12 -04:00
thePR0M3TH3AN 1fc4624596 Include whitelist in trusted seed bootstrap 2025-10-24 23:01:24 -04:00
thePR0M3TH3AN 48d6f51ab6 Add caching for admin list state and hydrate access control 2025-10-20 21:03:07 -04:00
thePR0M3TH3AN bae9b29f49 Enforce lockdown restrictions on login 2025-10-20 15:38:29 -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 ff30678afc Delay access control refresh until nostr pool ready 2025-10-01 22:07: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
thePR0M3TH3AN 875cee4428 Add admin governance roles and UI 2025-09-28 18:38:10 -04:00
thePR0M3TH3AN fe0245e30c Improve access control list initialization 2025-09-22 09:54:19 -04:00
Keep Creating Online b6b61e4e15 updated directory structure to fix root Service Worker issues and performance improvements 2025-02-05 16:54:40 -05:00