From b85a1017491623a14cd2b44b75ac65e740ad8200 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:51:01 -0400 Subject: [PATCH] update --- .github/workflows/ci.yml | 81 + .gitignore | 3 + AGENTS.md | 28 +- CONTRIBUTING.md | 40 + LICENSE | 693 ++++ README.md | 201 +- TRADEMARKS.md | 21 + assets/svg/about-icon.svg | 4 +- assets/svg/beacon-icon.svg | 4 +- assets/svg/beta-icon.svg | 4 +- assets/svg/bitvid-logo-dark-mode.svg | 50 +- assets/svg/bitvid-logo-light-mode.svg | 50 +- assets/svg/blog-icon.svg | 4 +- assets/svg/default-profile.svg | 4 +- assets/svg/dns-icon.svg | 4 +- assets/svg/explore-icon.svg | 4 +- assets/svg/feed-icon.svg | 4 +- assets/svg/filter.svg | 3 + assets/svg/getting-started-icon.svg | 4 +- assets/svg/github-icon.svg | 4 +- assets/svg/guidelines-icon.svg | 4 +- assets/svg/history-icon.svg | 4 +- assets/svg/home-icon.svg | 4 +- assets/svg/hot-icon.svg | 4 +- assets/svg/ipns-icon.svg | 4 +- assets/svg/links-icon.svg | 4 +- assets/svg/mobile-sidebar-menu-icon.svg | 4 +- assets/svg/nostr-icon.svg | 6 +- assets/svg/recent-icon.svg | 4 +- assets/svg/roadmap-icon.svg | 4 +- assets/svg/search.svg | 3 + assets/svg/subscribe-button-icon.svg | 4 +- assets/svg/subscriptions-icon.svg | 4 +- assets/svg/video-settings-gear.svg | 4 +- bitvid_logo/beacon-icon.svg | 10 +- bitvid_logo/bitvid-01.svg | 46 +- bitvid_logo/bitvid-02.svg | 46 +- bitvid_logo/bitvid-03.svg | 50 +- bitvid_logo/bitvid-04.svg | 50 +- bitvid_logo/bitvid-05.svg | 32 +- bitvid_logo/bitvid-06.svg | 32 +- bitvid_logo/bitvid-07.svg | 32 +- bitvid_logo/bitvid-08.svg | 26 +- bitvid_logo/bitvid-09.svg | 26 +- bitvid_logo/bitvid-10.svg | 26 +- bitvid_logo/bitvid-11.svg | 38 +- bitvid_logo/bitvid-12.svg | 38 +- bitvid_logo/bitvid-13.svg | 38 +- bitvid_logo/bitvid-14.svg | 38 +- bitvid_logo/bitvid-15.svg | 38 +- bitvid_logo/bitvid-16.svg | 38 +- bitvid_logo/dns-icon.svg | 6 +- bitvid_logo/guidelines-icon.svg | 6 +- bitvid_logo/home-icon.svg | 6 +- bitvid_logo/ipns-icon.svg | 6 +- components/application-form.html | 144 +- components/bug-fix-form.html | 98 +- components/content-appeals-form.html | 94 +- components/delete-video-modal.html | 71 + components/disclaimer.html | 225 +- components/edit-video-modal.html | 471 ++- components/feature-request-form.html | 96 +- components/general-feedback-form.html | 100 +- .../iframe_forms/iframe-application-form.html | 199 +- .../iframe_forms/iframe-bug-fix-form.html | 210 +- .../iframe-content-appeals-form.html | 173 +- .../iframe_forms/iframe-feedback-form.html | 187 +- .../iframe_forms/iframe-request-form.html | 201 +- components/iframe_forms/theme-sync.js | 192 + components/lockdown-modal.html | 80 + components/login-modal.html | 114 +- components/profile-modal.html | 517 ++- components/revert-video-modal.html | 168 +- components/sidebar.html | 54 +- components/upload-modal.html | 1553 ++++--- components/video-modal.html | 616 +-- config/asset-version.js | 2 +- config/instance-config.js | 141 +- config/validate-config.js | 98 +- content/community-guidelines.md | 45 +- content/getting-started.md | 21 +- content/roadmap.md | 25 +- ...View_Rating_&_Retention_Penalty_Scoring.md | 4 +- ...anced_NIP-35_+_WebRTC_Check_Integration.md | 4 +- css/tailwind.generated.css | 11 +- css/tailwind.source.css | 3679 +++++++++++++++++ css/tokens.css | 700 +++- docs/beacon/css-mapping.md | 43 + docs/deployment-notes.md | 7 + docs/design-system.md | 477 +++ docs/feed-engine.md | 2 +- docs/kitchen-sink.html | 882 +++- docs/logging.md | 68 + docs/menus.md | 174 + docs/moderation/README.md | 47 +- docs/moderation/fixtures/index.html | 624 +++ docs/moderation/nips.md | 2 +- docs/moderation/testing.md | 30 +- docs/moderation/web-of-trust.md | 18 +- docs/nostr-analytics.md | 4 +- docs/nostr-auth.md | 28 +- docs/nostr-event-schemas.md | 10 +- docs/nwc-compliance.md | 2 +- docs/popover-scenarios.html | 252 ++ docs/qa.md | 20 +- docs/watch-history-logging.md | 4 +- index.html | 329 +- js/accessControl.js | 114 +- js/adminListStore.js | 743 +++- js/app.js | 2800 ++++++++++--- js/bootstrap.js | 17 + js/channelProfile.js | 2296 ++++++++-- js/config.js | 34 +- js/constants.js | 148 +- js/designSystem.js | 101 + js/designSystem/dynamicStyles.js | 276 ++ js/designSystem/metrics.js | 247 ++ js/disclaimer.js | 15 +- js/dom/cardObserver.js | 11 +- js/feedEngine/engine.js | 3 +- js/feedEngine/index.js | 1 + js/feedEngine/sorters.js | 11 + js/feedEngine/sources.js | 36 +- js/feedEngine/stages.js | 597 +++ js/gridHealth.js | 50 +- js/healthService.js | 3 +- js/historyView.js | 272 +- js/index.js | 854 +++- js/nostr.js | 2363 +++++++---- js/nostrEventSchemas.js | 51 +- js/nostrPublish.js | 11 +- js/nostrToolsBootstrap.js | 31 +- js/nwcSettings.js | 7 +- js/payments/nwcClient.js | 31 +- js/payments/platformAddress.js | 13 +- js/payments/zapMessages.js | 5 + js/payments/zapNotifications.js | 366 ++ js/payments/zapSplit.js | 5 +- js/r2-quick.js | 36 +- js/r2.js | 11 +- js/relayManager.js | 74 +- js/services/authService.js | 222 +- js/services/discussionCountService.js | 8 +- js/services/moderationService.js | 2146 ++++++++++ js/services/nostrService.js | 425 +- js/services/nwcSettingsService.js | 35 +- js/services/playbackService.js | 3 +- js/services/r2Service.js | 38 +- js/services/watchHistoryTelemetry.js | 109 +- js/sidebar.js | 20 +- js/state/appState.js | 7 +- js/state/cache.js | 626 ++- js/subscriptions.js | 767 +++- js/themeController.js | 372 ++ js/ui/components/DeleteModal.js | 453 ++ js/ui/components/EditModal.js | 160 +- js/ui/components/RevertModal.js | 365 +- js/ui/components/UploadModal.js | 574 ++- js/ui/components/VideoCard.js | 2088 +++++++--- js/ui/components/VideoModal.js | 1034 +++-- js/ui/components/modalAccessibility.js | 210 + js/ui/components/nip71FormManager.js | 3 +- js/ui/components/staticModalAccessibility.js | 167 + js/ui/components/videoMenuRenderers.js | 416 ++ js/ui/moreMenuController.js | 1159 +++++- js/ui/overlay/overlayRoot.js | 63 + js/ui/overlay/popoverEngine.js | 931 +++++ js/ui/profileModalController.js | 1998 ++++++++- js/ui/views/VideoListView.js | 211 +- js/ui/watchHistoryController.js | 56 +- js/ui/zapController.js | 87 +- js/urlHealthObserver.js | 3 +- js/userBlocks.js | 678 ++- js/utils/cardSourceVisibility.js | 90 + js/utils/formatters.js | 22 + js/utils/logger.js | 170 + js/utils/mediaLoader.js | 12 +- js/utils/profileBatchFetcher.js | 173 + js/utils/profileMedia.js | 80 + js/utils/serviceWorkerFallbackMessages.js | 58 + js/utils/storage.js | 7 +- js/videoEventUtils.js | 4 +- js/viewCounter.js | 25 +- js/viewManager.js | 29 +- js/watchHistoryDebug.js | 30 +- js/watchHistoryService.js | 426 +- js/webtorrent-global.js | 16 + js/webtorrent.js | 89 +- package-lock.json | 2757 +++++++++++- package.json | 30 +- playwright.config.ts | 25 + scripts/build-beacon.mjs | 68 + scripts/check-design-tokens.mjs | 401 ++ scripts/check-hex.js | 52 + scripts/check-inline-styles.mjs | 246 ++ scripts/check-tailwind-colors.mjs | 133 + scripts/run-unit-tests.mjs | 77 + scripts/vendor/floating-ui-dom-entry.mjs | 8 + site.webmanifest | 4 +- stylelint.config.cjs | 29 +- tailwind.config.cjs | 411 +- tests/admin-list-store.test.mjs | 535 ++- tests/app-batch-fetch-profiles.test.mjs | 124 + tests/app/moderation-overrides.test.mjs | 72 + tests/auth-service.test.mjs | 47 + tests/design-system-metrics.test.mjs | 61 + tests/e2e/popover.spec.ts | 190 + tests/edit-modal-submit-state.test.mjs | 50 + tests/feed-engine.test.mjs | 26 + tests/helpers/moderation-test-helpers.mjs | 205 + tests/media-loader.test.mjs | 197 + tests/modal-accessibility.test.mjs | 538 +++ tests/moderation-service.test.mjs | 420 ++ tests/moderation-stage.test.mjs | 453 ++ tests/moderation/hide-thresholds.test.mjs | 260 ++ tests/moderation/trust-seeds.test.mjs | 68 + .../moderation/trusted-report-count.test.mjs | 230 ++ tests/moderation/video-card.test.mjs | 260 ++ tests/more-menu-controller.test.mjs | 125 +- tests/nip71-base-event-tags.test.mjs | 13 +- tests/nostr-delete-flow.test.mjs | 472 +++ tests/nostr-ephemeral-dm-tester.html | 138 +- tests/nostr-login-permissions.test.mjs | 209 +- tests/position-floating-panel.test.mjs | 412 ++ tests/profile-modal-controller.test.mjs | 425 +- tests/subscriptions-feed.test.mjs | 172 +- tests/subscriptions-manager.test.mjs | 503 +++ tests/test-helpers/setup-localstorage.mjs | 8 + .../service-worker-fallback-message.test.mjs | 57 + tests/torrent/style-helpers.test.mjs | 41 + tests/torrent/toast-service.test.mjs | 54 + tests/ui/mocks/floating-ui-test-loader.mjs | 28 + tests/ui/popoverEngine.test.mjs | 752 ++++ ...profile-modal-moderation-settings.test.mjs | 310 ++ tests/user-blocks.test.mjs | 327 +- tests/validate-config.test.mjs | 2 +- tests/video-card-source-visibility.test.mjs | 252 ++ tests/video-modal-accessibility.test.mjs | 827 ++++ tests/video-modal-zap.test.mjs | 154 +- tests/video-schema-and-conversion.test.mjs | 78 + tests/view-counter.test.mjs | 13 + tests/visual/baseline-store.ts | 50 + tests/visual/baselines.json | 6 + tests/visual/kitchen-sink.spec.ts | 212 + tests/visual/moderation.spec.ts | 148 + tests/visual/overlay-layers.spec.ts | 260 ++ tests/visual/reduced-motion.spec.ts | 137 + tests/watch-history.test.mjs | 181 +- torrent/app.js | 960 +++-- torrent/beacon.html | 341 +- torrent/dist/beacon.js | 1 + torrent/docs/ui-grid-ng-notify-audit.md | 16 + torrent/js/utils/logger.js | 2 + torrent/src/beacon-vendor.js | 100 + torrent/ui/styleHelpers.js | 7 + torrent/ui/toastService.js | 191 + torrent/ui/torrentTable.js | 266 ++ vendor/floating-ui.LICENSE | 20 + vendor/floating-ui.dom.bundle.min.js | 1 + views/about.html | 104 +- views/channel-profile.html | 251 +- views/community-guidelines.html | 109 +- views/dev/popover-demo.html | 285 ++ views/explore.html | 6 +- views/getting-started.html | 109 +- views/history.html | 51 +- views/ipns.html | 104 +- views/links.html | 106 +- views/most-recent-videos.html | 14 +- views/roadmap.html | 100 +- views/subscriptions.html | 19 +- 271 files changed, 51743 insertions(+), 9272 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 TRADEMARKS.md create mode 100644 assets/svg/filter.svg create mode 100644 assets/svg/search.svg create mode 100644 components/delete-video-modal.html create mode 100644 components/iframe_forms/theme-sync.js create mode 100644 components/lockdown-modal.html create mode 100644 docs/beacon/css-mapping.md create mode 100644 docs/deployment-notes.md create mode 100644 docs/design-system.md create mode 100644 docs/logging.md create mode 100644 docs/menus.md create mode 100644 docs/moderation/fixtures/index.html create mode 100644 docs/popover-scenarios.html create mode 100644 js/designSystem.js create mode 100644 js/designSystem/dynamicStyles.js create mode 100644 js/designSystem/metrics.js create mode 100644 js/payments/zapMessages.js create mode 100644 js/payments/zapNotifications.js create mode 100644 js/services/moderationService.js create mode 100644 js/themeController.js create mode 100644 js/ui/components/DeleteModal.js create mode 100644 js/ui/components/modalAccessibility.js create mode 100644 js/ui/components/staticModalAccessibility.js create mode 100644 js/ui/components/videoMenuRenderers.js create mode 100644 js/ui/overlay/overlayRoot.js create mode 100644 js/ui/overlay/popoverEngine.js create mode 100644 js/utils/cardSourceVisibility.js create mode 100644 js/utils/logger.js create mode 100644 js/utils/profileBatchFetcher.js create mode 100644 js/utils/profileMedia.js create mode 100644 js/utils/serviceWorkerFallbackMessages.js create mode 100644 js/webtorrent-global.js create mode 100644 playwright.config.ts create mode 100755 scripts/build-beacon.mjs create mode 100755 scripts/check-design-tokens.mjs create mode 100755 scripts/check-hex.js create mode 100644 scripts/check-inline-styles.mjs create mode 100755 scripts/check-tailwind-colors.mjs create mode 100644 scripts/run-unit-tests.mjs create mode 100644 scripts/vendor/floating-ui-dom-entry.mjs create mode 100644 tests/app-batch-fetch-profiles.test.mjs create mode 100644 tests/app/moderation-overrides.test.mjs create mode 100644 tests/design-system-metrics.test.mjs create mode 100644 tests/e2e/popover.spec.ts create mode 100644 tests/helpers/moderation-test-helpers.mjs create mode 100644 tests/media-loader.test.mjs create mode 100644 tests/modal-accessibility.test.mjs create mode 100644 tests/moderation-service.test.mjs create mode 100644 tests/moderation-stage.test.mjs create mode 100644 tests/moderation/hide-thresholds.test.mjs create mode 100644 tests/moderation/trust-seeds.test.mjs create mode 100644 tests/moderation/trusted-report-count.test.mjs create mode 100644 tests/moderation/video-card.test.mjs create mode 100644 tests/nostr-delete-flow.test.mjs create mode 100644 tests/position-floating-panel.test.mjs create mode 100644 tests/subscriptions-manager.test.mjs create mode 100644 tests/torrent/service-worker-fallback-message.test.mjs create mode 100644 tests/torrent/style-helpers.test.mjs create mode 100644 tests/torrent/toast-service.test.mjs create mode 100644 tests/ui/mocks/floating-ui-test-loader.mjs create mode 100644 tests/ui/popoverEngine.test.mjs create mode 100644 tests/ui/profile-modal-moderation-settings.test.mjs create mode 100644 tests/video-card-source-visibility.test.mjs create mode 100644 tests/video-modal-accessibility.test.mjs create mode 100644 tests/video-schema-and-conversion.test.mjs create mode 100644 tests/visual/baseline-store.ts create mode 100644 tests/visual/baselines.json create mode 100644 tests/visual/kitchen-sink.spec.ts create mode 100644 tests/visual/moderation.spec.ts create mode 100644 tests/visual/overlay-layers.spec.ts create mode 100644 tests/visual/reduced-motion.spec.ts create mode 100644 torrent/dist/beacon.js create mode 100644 torrent/docs/ui-grid-ng-notify-audit.md create mode 100644 torrent/js/utils/logger.js create mode 100644 torrent/src/beacon-vendor.js create mode 100644 torrent/ui/styleHelpers.js create mode 100644 torrent/ui/toastService.js create mode 100644 torrent/ui/torrentTable.js create mode 100644 vendor/floating-ui.LICENSE create mode 100644 vendor/floating-ui.dom.bundle.min.js create mode 100644 views/dev/popover-demo.html diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..9b50e126 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20] + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache npm directory + uses: actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ matrix.node-version }}-npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-npm- + + - name: Cache node_modules + id: node-modules-cache + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ matrix.node-version }}-modules-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ matrix.node-version }}-modules- + + - name: Install dependencies + if: steps.node-modules-cache.outputs.cache-hit != 'true' + run: npm ci + + - name: Install ripgrep + run: sudo apt-get update && sudo apt-get install -y ripgrep + + - name: Run lint suite + run: npm run lint + + - name: Build CSS + run: npm run build:css + + - name: Install Playwright browsers + run: npx playwright install --with-deps chromium + + - name: Run visual regression tests + id: visual + run: npm run test:visual + continue-on-error: true + + - name: Upload Playwright artifacts + if: steps.visual.outcome == 'failure' + uses: actions/upload-artifact@v4 + with: + name: playwright-visual-diffs + path: | + playwright-report + test-results + if-no-files-found: ignore + + - name: Run unit tests + run: npm run test:unit + + - name: Check CSS artifacts are clean + run: npm run check:css + + - name: Fail if visual regressions detected + if: steps.visual.outcome == 'failure' + run: exit 1 diff --git a/.gitignore b/.gitignore index c26cbea6..a8ebf016 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ saved_config.yaml repo-context.txt node_modules/ src/webtorrent-docs/ +playwright-report/ +test-results/ +tests/visual/__snapshots__/ diff --git a/AGENTS.md b/AGENTS.md index ba606920..78007417 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ -# Bitvid — AI Agent Guide +# bitvid — AI Agent Guide -This guide tells AI agents how to keep Bitvid aligned with the current product direction. Follow it whenever you touch code, content, or documentation inside this repository. +This guide tells AI agents how to keep bitvid aligned with the current product direction. Follow it whenever you touch code, content, or documentation inside this repository. --- @@ -10,13 +10,31 @@ This guide tells AI agents how to keep Bitvid aligned with the current product d * **Unstable** is our experimentation lane. Gate risky behavior behind feature flags defined in `js/constants.js` and document the toggle/rollback plan in PR descriptions. * **Emergency response:** If a change regresses URL-first playback or breaks magnet parsing, revert immediately, call this out in the PR, and annotate the AGENTS.md changelog with remediation tips. **Note:** These regressions usually surface in dev logs and tests around playback/magnet helpers—reference them when triaging so future agents don’t repeat the mistake. +### Browser logging policy + +* Route every browser log through `js/utils/logger.js`. Do **not** call `console.*` directly. +* Use `logger.dev.*` for diagnostics that should disappear in production (flagged by `IS_DEV_MODE`/`isDevMode`). Use `logger.user.*` for operator-facing warnings and errors that must reach production consoles. +* Before promoting a build, flip `IS_DEV_MODE` in `config/instance-config.js` to match the target environment so `window.__BITVID_DEV_MODE__` and the logger channels behave correctly. +* Review and follow [`docs/logging.md`](docs/logging.md) whenever you add new logging or touch inline scripts. + ## 2. Mission: URL‑First Playback with WebTorrent Fallback * **Goal:** Always deliver smooth playback while keeping hosting costs low. * **Primary transport:** A hosted video URL (MP4/WebM/HLS/DASH) that the `