Commit Graph
48 Commits
Author SHA1 Message Date
thePR0M3TH3AN 88c906fd34 Add BitLogin as the primary sign-in method (gated, unstable)
The login modal now shows <bitlogin-auth> -- a portable Nostr identity
behind a login name and password -- as the default sign-in path,
styled with bitvid's own brand tokens (accent-strong, surfaces, radii).
The existing NIP-07 extension, nsec, and NIP-46 remote-signer options
still work exactly as before, just collapsed under a new "Other login
options" fold instead of a flat "Available methods" grid; nip07 no
longer carries the stale "Recommended" eyebrow now that BitLogin has
that role.

BitLogin isn't a single button-click-then-await-a-promise flow like
the other providers -- it's a whole multi-screen sign-in/create/recover
UI -- so it gets a permanent, statically-declared widget in
components/login-modal.html (js/ui/bitloginModalIntegration.js relocates
it, never destroys and recreates it, since removal tears down its crypto
Web Worker) instead of a grid button. It still goes through the exact
same session-establishment path as every other signer: a new "bitlogin"
provider (js/services/authProviders/bitlogin.js) lets AuthService
resolve and activate it via the normal requestLogin -> handleAuthLogin
path, while providersForModal excludes it from the grid so it isn't
rendered twice.

Two things this needed beyond the wiring itself:
- js/app.js is one line from its lint/file-size ceiling, so the only
  change there is renaming an import binding (providers -> providersForModal),
  a net-zero line change. The actual widget/event wiring lives in a new,
  unconstrained module instead.
- The login modal's HTML (including the permanent widget element) loads
  asynchronously after bootstrap runs, so wireBitloginLogin() waits via
  MutationObserver rather than assuming a specific call order.

Vendored via scripts/build-bitlogin-widget.mjs (mirrors the existing
Bitcoin Connect/Blossom vendor steps): BitLogin isn't published to npm,
so the widget build is copied verbatim from the sibling ../bitlogin
checkout into committed vendor/bitlogin/, then lazy-imported (like
Bitcoin Connect) so its ~350KB never weighs on visitors who never open
the login modal.

Gated behind FEATURE_BITLOGIN (config/instance-config.js), default on
for this unstable-branch experiment per AGENTS.md §1 -- reset to false
before this reaches main until verified end-to-end against production
relays.

Verified: npm run lint (clean), the full auth/login test suite (43/43,
including new coverage for the provider + adapter), and a manual
Chrome pass against the built dist/ -- widget renders themed correctly,
"Other login options" still shows the original four methods unchanged.
2026-07-21 20:56:01 -04:00
thePR0M3TH3ANandClaude Opus 4.8 d23cfa6697 feat(blossom): P2P for Blossom videos via a WebTorrent-metadata companion event (#30)
Blossom servers reject a .torrent (415), so a Blossom video's magnet is webseed-only and can't bootstrap WebTorrent. This restores P2P without hosting a .torrent:

- Upload hardening: correct Content-Type (overrides empty/generic application/octet-stream), HTTP status surfaced in errors, and best-effort .torrent sidecar so a rejected sidecar no longer sinks the upload (URL-first fallback).

- Publish: when the .torrent can't be hosted, publish the piece-map as an infohash-keyed companion event (kind 30078, d=bitvid:torrent:<infohash>) and ship a ws= magnet. Gated by FEATURE_BLOSSOM_TORRENT_METADATA (default off = no trace); size-capped.

- Playback: torrentMetadataService lazily fetches the companion, VERIFIES the reconstructed infohash === the magnet's btih (untrusted content), sources the webseed from the video event, and hands the .torrent buffer to WebTorrent so it streams with zero peers. Relay reads go through the subscription manager.

Inherited by any upload-based media (shorts, audio-publish); excludes ingest/live. See docs/blossom-torrent-metadata-plan.md. Includes a Prettier reflow in css/tailwind.source.css.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-11 14:08:53 -04:00
thePR0M3TH3ANandClaude Opus 4.8 02e60f1842 feat(storage): Blossom Phase 0 — flag + vendored SDK + service skeleton (#30)
Phase 0 of docs/blossom-plan.md. No UX; off-by-default ("off = no trace").

- Vendored: pinned [email protected] bundled by scripts/build-blossom-sdk.mjs
  → vendor/blossom-client-sdk.bundle.min.js (esbuild, browser ESM, ~27KB). The
  optional @cashu/cashu-ts peer dep (BUD-07 payments, only reached on a lazy 402
  branch bitvid never hits) is aliased to a throwing stub. `npm run build:blossom-sdk`.
- Flag: FEATURE_BLOSSOM_STORAGE wired like FEATURE_AUDIO_INGEST / _BITCOIN_CONNECT
  (instance-config → config → constants), default FALSE.
- Service: js/services/blossomService.js implements the same
  uploadFile({…}) → {url,key} contract as s3UploadService (so a later
  isBlossomProvider branch drops into mediaUploader). Lazy-loads the SDK; core
  path = createUploadAuth(signer, sha256) + multiServerUpload (BUD-11 auth via
  bitvid's existing signer, BUD-04 mirror). Torrent parity + result-shape mapping +
  mediaUploader wiring + Storage-pane config land in Phase 1.

Tests: tests/blossom-service.test.mjs (5 — availability gate + input guards).
Lint + build clean. Nothing wired into the app yet.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-09 15:42:19 -04:00
thePR0M3TH3ANandClaude Opus 4.8 69e87c6e15 feat(wallet): Bitcoin Connect NWC "Connect wallet" flow [LOCAL — flag ON, do not push as-is]
Phase 0+1 of docs/bitcoin-connect-plan.md (#61). Adds Alby's Bitcoin Connect as a
one-tap NWC connect front-end that feeds bitvid's EXISTING wallet pipeline; manual
URI entry stays as the backup.

- Vendored: pinned @getalby/[email protected].3 bundled by
  scripts/build-bitcoin-connect.mjs → vendor/bitcoin-connect.bundle.min.js (esbuild,
  browser ESM). crypto-shim aliases the L402-only `import('crypto')` bitvid never
  calls. `npm run build:bitcoin-connect` rebuilds it.
- Flag: FEATURE_BITCOIN_CONNECT wired like FEATURE_AUDIO_INGEST
  (instance-config → config → constants).
- UI: a "Connect wallet" button in the Wallet Connect pane (hidden unless the flag
  is on); the manual URI field stays below as the backup.
- Controller: ProfileWalletController.handleBitcoinConnect() lazy-imports the bundle
  (only on click — the ~700KB never touches the main bundle), inits NWC-only with
  least-privilege requestMethods and persistConnection:false, then on onConnected
  extracts provider.client.nostrWalletConnectUrl → the SAME validate→save path as
  the manual field → disconnect() so bitvid solely holds the spending secret. The
  URI is never logged.

NOTE: config/instance-config.js FEATURE_BITCOIN_CONNECT is TRUE for local testing
only. Reset to false (shipping default) before pushing/deploying. Local commit;
not pushed, not deployed.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-09 14:49:37 -04:00
thePR0M3TH3ANandClaude Opus 4.8 cd556f9c1f feat(config): wire FEATURE_AUDIO_INGEST flag + lock audio-plan decisions
Adds the Audio/Music/Podcast feature flag to the instance config so a deployer
enables/disables it in one place like the other flags. Follows the exact
FEATURE_NIP71_INGEST wiring: export in config/instance-config.js → re-export in
js/config.js → DEFAULT_FLAGS + runtimeFlags snapshot + `export let` in
js/constants.js. Defaults FALSE ("off = no trace") — only an explicit `true`
lights it up; with it off nothing audio renders and the shipped audio guard keeps
audio-only notes out of the video feeds. No consumers yet (build only).

Also locks docs/audio-integration-plan.md decisions D1–D10 to the agreed
recommendations (status → DECISIONS LOCKED).

Verified: constants + config re-export FEATURE_AUDIO_INGEST === false by default.
Lint + build clean. docs/audio-integration-plan.md, TODO #60.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-09 10:19:03 -04:00
thePR0M3TH3ANandClaude Opus 4.8 ccbe8d9bb2 feat(liveness): config-driven card visibility policy + probe prefetch (#5)
Makes the card liveness-visibility behavior switchable so it can be A/B
feel-tested, and probes ahead of the scroll for a snappier result.

- CARD_LIVENESS_POLICY (config/instance-config.js): "show-pending" (default,
  unchanged) | "hide-foreign" (foreign/ingested cards hidden until a source
  verifies; native cards stay show-pending) | "hide-all". Owner's own cards are
  always visible. Flip live for testing without a rebuild:
  window.__BITVID_CARD_LIVENESS_POLICY__ = "hide-foreign" then refresh/scroll.
  Implemented via a data-foreign provenance flag on the card +
  getCardLivenessPolicy() in cardSourceVisibility.js.
- LIVENESS_PROBE_PREFETCH_MARGIN (default 600px): both liveness probes were
  already viewport-gated (IntersectionObserver, on-screen-first, WebTorrent
  priority-queued + concurrency-capped); this expands their rootMargin so cards
  just below the fold verify before the user reaches them.
- Tests: three policy scenarios in tests/video-card-source-visibility.test.mjs;
  also un-broke 3 pre-existing VideoCard tests by adding the missing
  IntersectionObserver JSDOM stub.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-25 09:13:52 -04:00
thePR0M3TH3ANandClaude Opus 4.8 e418e729d6 nip71: add FEATURE_NIP71_INGEST admin toggle (default on)
Foundation for inbound NIP-71 ingest. Adds a single admin switch in the
instance config (config/instance-config.js, default true), re-exported
through config.js and surfaced as a runtime-overridable flag in
constants.js — same pattern as FEATURE_NIP71_MIRROR / ALLOW_NSFW_CONTENT.

A deployer flips one constant to disable all inbound ingest if it ever
causes problems (spam, low-quality content, performance). The ingest
adapter + service (gated on this flag) land in follow-up commits; its
behavioral test will assert the service is inert when the flag is off.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-22 15:00:01 -04:00
google-labs-jules[bot]andPR0M3TH3AN 5ca378bb96 Add ENABLE_NIP17_RELAY_WARNING config to suppress privacy warnings
Added a new configuration variable `ENABLE_NIP17_RELAY_WARNING` to `config/instance-config.js` (defaulting to `false`) to control the display of NIP-17 relay fallback warnings. Updated `js/ui/profileModalController.js` and `js/app.js` to respect this setting.

This change allows instance operators to disable "Privacy warning: direct messages are using your default relays because no NIP-17 relay list is available" and related notifications.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-11 04:05:36 +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
thePR0M3TH3AN 31b5fc5c16 Harden dev mode defaults 2026-01-30 09:13:54 -05:00
google-labs-jules[bot]andPR0M3TH3AN cfbbf78941 chore(ai): add automated PR review report
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-28 23:49:33 +00:00
thePR0M3TH3AN 596e2f472b Preserve NIP-07 permissions on logout 2026-01-28 14:03:43 -05:00
google-labs-jules[bot] 7921ab6a2e feat(playback): add configurable timeout for initial playback start
Introduces a race condition between the primary playback source (URL or Torrent) and a configurable timeout. If the primary source fails to reach the 'playing' state within the timeout window, the system automatically falls back to the alternative source.

- Adds `DEFAULT_PLAYBACK_START_TIMEOUT` to instance config (3000ms).
- Updates `PlaybackService` to implement timeout logic using `withTimeout` wrapper.
- Ensures proper cleanup of stalled attempts (resetting video element, destroying torrent client).
2026-01-26 15:55:11 +00:00
google-labs-jules[bot] c22037a575 feat: make default playback source configurable
- Added `DEFAULT_PLAYBACK_SOURCE` to `config/instance-config.js` to allow choosing between "url" (default) and "torrent" priority.
- Updated `js/constants.js` to derive `URL_FIRST_ENABLED` flag from the configuration.
- Refactored `PlaybackService.execute()` in `js/services/playbackService.js` to robustly support "Torrent First" logic with fallback to URL, while maintaining "URL First" with fallback to Torrent.
- Added unit tests in `tests/services/playbackService_order.test.mjs` to verify playback order and fallback mechanics.
2026-01-26 15:13:56 +00:00
google-labs-jules[bot] ad69548fb7 feat: make lockdown mode title and message configurable
This change introduces `LOCKDOWN_TITLE` and `LOCKDOWN_MESSAGE` constants in `config/instance-config.js` and exposes them via `js/config.js`. It updates `components/lockdown-modal.html` to include IDs for the title and message elements, and modifies `js/index.js` to dynamically populate these elements with the configured text when initializing the lockdown interface. This allows instance operators to customize the maintenance mode appearance.

No new tests were added as this is a configuration and UI text update, but `tests/auth-service.test.mjs` was run to ensure no regressions in auth logic during lockdown.
2026-01-19 21:35:23 +00:00
google-labs-jules[bot] cbd8af42a6 Enforce v=2 tag and mandatory encryption for watch history 2026-01-17 11:32:31 +00: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
google-labs-jules[bot] b3aeb95a0b Fix watch history reliability by migrating to Kind 30003
Migrates watch history persistence from Kind 30078 (Application Data) to Kind 30003 (Bookmark List) to resolve blocking issues on some relays. Updates fetch logic to query both kinds for backward compatibility.
2026-01-06 19:03:03 +00:00
thePR0M3TH3AN 243b768be7 Add Tip Jar link to sidebar more menu 2025-10-27 18:02:32 -04:00
thePR0M3TH3AN 27bafdd3de Add verbose dev mode toggle for COUNT warnings 2025-10-27 14:36:00 -04:00
thePR0M3TH3AN 51fe972d6c Source default trust seeds from instance config 2025-10-24 23:06:25 -04:00
thePR0M3TH3AN c575f48a81 Align moderation defaults with instance config 2025-10-24 21:36:10 -04:00
thePR0M3TH3AN 004652c545 Add lockdown mode flag to config exports 2025-10-20 15:13:01 -04:00
thePR0M3TH3AN 4fee05a447 Add community blacklist federation support 2025-10-20 14:13:48 -04:00
thePR0M3TH3AN 7065075c8b Make sidebar external links configurable 2025-10-18 15:53:01 -04:00
thePR0M3TH3AN f755349e13 Make sidebar blog and community links configurable 2025-10-18 15:36:59 -04:00
thePR0M3TH3AN 8c568af46a Remove local blog view in favor of configurable external link 2025-10-18 15:28:33 -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 2f966e5239 Remove redundant dev mode alias 2025-10-15 10:47:02 -04:00
thePR0M3TH3AN 44a818bba0 Expose dev mode flag via instance config 2025-10-15 10:43:31 -04:00
thePR0M3TH3AN 85258e27ea Respect NSFW flag while letting authors review their uploads 2025-10-09 22:58:07 -04:00
thePR0M3TH3AN 86be0284d9 Add rebroadcast cooldown guard and toast handling 2025-10-08 23:01:05 -04:00
thePR0M3TH3AN dbceaa98df refactor: inject profile modal constants 2025-10-07 17:48:26 -04:00
thePR0M3TH3AN 7672726088 Add platform fee configuration validation 2025-10-04 21:31:12 -04:00
thePR0M3TH3AN f6729b8e35 Fix watch history batch window 2025-10-02 15:59:06 -04:00
thePR0M3TH3AN cd09dbc68d Add dedicated watch history index events 2025-10-01 14:59:04 -04:00
thePR0M3TH3AN 65198c3abe Add view counter configuration knobs 2025-09-30 22:10:05 -04:00
thePR0M3TH3AN 1bcb770556 Extend watch history cache TTL and add tests 2025-09-30 14:42:21 -04:00
thePR0M3TH3AN 034c4c3761 Chunk watch history payloads and rebuild fetch pipeline 2025-09-30 14:34:41 -04:00
thePR0M3TH3AN 57d114aa52 Document watch history configuration defaults 2025-09-30 09:28:29 -04:00
thePR0M3TH3AN d01fa93689 Centralize instance admin settings 2025-09-28 22:16:34 -04:00
thePR0M3TH3AN 84b5ef77c0 Enforce remote admin list storage 2025-09-28 19:38:56 -04:00
thePR0M3TH3AN 875cee4428 Add admin governance roles and UI 2025-09-28 18:38:10 -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