Commit Graph
5113 Commits
Author SHA1 Message Date
google-labs-jules[bot]andPR0M3TH3AN e16eecb4e3 Refactor revertVideo to use helper function for payload construction
- Extracted payload construction logic from `revertVideo` in `js/nostr/client.js` to `buildRevertVideoPayload` in `js/nostr/publishHelpers.js`.
- Moved `resolveStoragePointerValue` from `js/nostr/client.js` to `js/utils/storagePointer.js` to fix circular dependencies and improve code organization.
- Updated imports in `js/nostr/client.js` and `js/nostr/publishHelpers.js`.
- Verified with existing tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:44:15 +00:00
thePR0M3TH3AN 1fbee4219b Merge pull request #2227 from PR0M3TH3AN/content-audit-upload-docs-15534095515326049500
🌐 Align /content user docs with actual upload & contribution behavior
2026-02-07 22:07:34 -05:00
google-labs-jules[bot]andPR0M3TH3AN 75598e3eff docs: update upload guides to match code behavior
- Add "External Link" and "Magnet Link" upload methods.
- Document advanced NIP-71 metadata fields (Content Warning, Duration, IMETA).
- Clarify file type support and browser-based size limits.
- Add troubleshooting for CORS and memory issues.
- Provide examples for S3-compatible providers (MinIO, DigitalOcean).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 02:54:44 +00:00
thePR0M3TH3AN 88227bd4ce Merge pull request #2226 from PR0M3TH3AN/claude/speed-up-nostr-login-BZBNv
Fix auto-login signer restoration and optimize critical login path
2026-02-07 21:09:02 -05:00
thePR0M3TH3AN 6b4c141ae6 Merge pull request #2221 from PR0M3TH3AN/test-hashtag-strip-helper-resize-7955570684281399740
test: Add tests for HashtagStripHelper resize logic
2026-02-07 21:04:58 -05:00
Claude 8bf8da03b9 Speed up Nostr login and fix list sync, signer persistence, and feed registration
The NIP-07 login flow was extremely slow because list decryption (blocks,
subscriptions, hashtag preferences) started before the signer was ready.
On page refresh, all three services failed with "permission-required" and
scheduled 3-second retry delays, adding 6-10 seconds to every login.

Key fixes:
- List loading now waits for the permission pre-grant to complete before
  attempting decryption, ensuring the signer is available on first try
- Extension wait timeout increased from 3s to 5s for slower extensions
- Decrypt timeouts reduced from 20s to 10s (signer is guaranteed ready)
- Auto-login now forwards authType/providerId from saved profiles
- Storage tab unlock falls back to ensureActiveSignerForPubkey when the
  global signer is not yet registered
- Watch history feed registration adds defensive re-registration and
  try/catch fallback to prevent "Feed not registered" errors
- Decryption scheme cache TTL extended from 10 minutes to 2 hours
- ensureExtensionPermissions waits for extension injection when there
  are outstanding permissions to request (was returning immediately)

https://claude.ai/code/session_01T4wwPu7m5qp1Nxx3H2v57j
2026-02-08 02:02:51 +00:00
thePR0M3TH3AN 07a9284cb1 Merge branch 'unstable' into test-hashtag-strip-helper-resize-7955570684281399740 2026-02-07 21:00:57 -05:00
google-labs-jules[bot]andPR0M3TH3AN 7dc5342714 fix: Ensure ResizeObserver is undefined in global scope for fallback tests
- The `setup-localstorage.mjs` test helper polyfills `ResizeObserver` on `globalThis`, which prevented `HashtagStripHelper` from falling back to `window.resize` logic during testing.
- Updated `tests/ui/components/hashtagStripHelper.test.mjs` to temporarily unset `globalThis.ResizeObserver` during tests that verify fallback behavior.
- Ensures the component correctly detects the absence of `ResizeObserver` and falls back to `requestAnimationFrame` or `setTimeout` mechanisms.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 02:00:10 +00:00
thePR0M3TH3AN 32cd6dc2a2 Merge pull request #2222 from PR0M3TH3AN/nip04-worker-tests-17203445750544777231
🧪 Add tests for NIP-04 worker client
2026-02-07 20:54:07 -05:00
google-labs-jules[bot]andPR0M3TH3AN 555df62529 fix: resolve SyntaxError in js/app.js due to duplicate code block
Removed a duplicate/malformed code block in `js/app.js` that was causing `SyntaxError: Unexpected token '.'` during module loading. This error was breaking tests in `tests/app/channel-profile-moderation.test.mjs` and others.

Also restored `_initNostr` and `_initSessionActor` methods which were partially clobbered or malformed in the file structure.

Verified by running the affected unit tests locally.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:50:26 +00:00
thePR0M3TH3AN ce16140343 Merge pull request #2225 from PR0M3TH3AN/fix-feed-coordinator-refresh-feed-error-14415813432609543851
Fix TypeError: this.refreshFeed is not a function in Application
2026-02-07 20:39:01 -05:00
google-labs-jules[bot]andPR0M3TH3AN b1e93046fd Fix: Add missing refreshFeed method to Application class to prevent TypeError
The `feedCoordinator` logic assumes `this.refreshFeed` exists on the Application instance (because methods are bound via `bindCoordinator`). However, `Application` previously only implemented `refreshRecentFeed`, `refreshForYouFeed`, etc., but not the generic `refreshFeed`.

This caused a `TypeError: this.refreshFeed is not a function` when `loadFeedVideos` (which calls `refreshFeed`) was invoked.

This commit adds `async refreshFeed(...args)` to `Application` in `js/app.js`, delegating to `this._feed.refreshFeed(...args)`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:34:41 +00:00
thePR0M3TH3AN 0fe44b1b6c Merge pull request #2223 from PR0M3TH3AN/test-dm-decrypt-worker-client-16121432396017738372
🧪 Add tests for dmDecryptWorkerClient
2026-02-07 20:31:55 -05:00
google-labs-jules[bot]andPR0M3TH3AN 2e2ea34d3c fix: Resolve js/app.js syntax error and update test mocks
- Removed orphaned code block in `js/app.js` that caused syntax errors during module loading.
- Updated `tests/helpers/moderation-test-helpers.mjs` to implement `resumePendingModeratedPlayback` and decoration logic in `MockApplication`, fixing `tests/app/moderation-overrides.test.mjs` and `tests/app/moderation-settings-refresh.test.mjs` failures.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:29:09 +00:00
google-labs-jules[bot]andPR0M3TH3AN e734f9ca79 fix: restore _initNostr and fix syntax error in app.js
- Restored missing `_initNostr` method in `js/app.js` which was causing `SyntaxError: Unexpected token '.'` and `nostrClient.init is not a function` errors.
- Removed dangling code block that was causing the syntax error (orphaned `accessControl.refresh()...` block).
- This fixes unit tests (e.g. `tests/app/channel-profile-moderation.test.mjs`) and application initialization.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:26:43 +00:00
thePR0M3TH3AN a345a1ca57 Merge pull request #2224 from PR0M3TH3AN/fix-app-js-syntax-error-15406484062296622961
fix(app.js): resolve syntax error and restore _initNostr method
2026-02-07 20:24:41 -05:00
google-labs-jules[bot]andPR0M3TH3AN db76432ab6 fix(app.js): resolve syntax error and restore _initNostr method
Removes a malformed code block that was causing an "Unexpected token '.'" syntax error and restores the `_initNostr` method which correctly initializes the Nostr client.

Fixes: #1083 (SyntaxError in app.js)

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:20:48 +00:00
google-labs-jules[bot]andPR0M3TH3AN 072be49068 test: add tests for dmDecryptWorkerClient
- Create `tests/nostr/dmDecryptWorkerClient.test.mjs` to test `decryptDmInWorker`.
- Implement `MockWorker` to simulate worker behavior in `node:test`.
- Cover scenarios: success, error response, error event, timeout, invalid input, and worker availability.
- Use dynamic imports with cache busting to reset singleton state between tests.
- Ensure `devLogger` warnings are verified by mocking `console.warn` correctly.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:17:49 +00:00
google-labs-jules[bot]andPR0M3TH3AN 76b385af1b Add tests for NIP-04 worker client wrapper
- Implement `MockWorker` class to simulate Web Worker behavior (postMessage, events).
- Add unit tests for `js/nostr/nip04WorkerClient.js` covering:
    - Happy path encryption.
    - Worker error responses.
    - Worker error events.
    - Timeout handling.
    - Input validation.
    - Worker unavailability/creation failure.
- Use cache-busting dynamic imports to isolate test cases and reset module state.
- Ensure global `Worker` and `console` mocks are properly restored.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:16:04 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2469828d0f test: Add comprehensive tests for HashtagStripHelper resize logic
- Added `tests/ui/components/hashtagStripHelper.test.mjs` to test `ResizeObserver` integration, fallback mechanisms (RAF/setTimeout), and teardown.
- Implemented robust mocks for `ResizeObserver`, `requestAnimationFrame`, and `setTimeout` within `createDom` helper.
- Verified correct behavior for resize events and cleanup.
- Ensured test data matches `collectVideoTags` expected structure.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 01:14:27 +00:00
thePR0M3TH3AN cc2e29c185 Merge pull request #2202 from PR0M3TH3AN/chore/code-health/remove-unused-promises-app-init-18262315909809877684
chore: remove dead code and unused promises in Application.init
2026-02-07 20:07:29 -05:00
thePR0M3TH3AN ae5174600d Merge branch 'unstable' into chore/code-health/remove-unused-promises-app-init-18262315909809877684 2026-02-07 20:07:22 -05:00
thePR0M3TH3AN 91cc2781b0 Merge pull request #2218 from PR0M3TH3AN/refactor-application-srp-12044709703939300356
🧹 Refactor Application to use AuthService and PlaybackService for state access
2026-02-07 20:04:32 -05:00
thePR0M3TH3AN fa7b7855aa Merge pull request #2216 from PR0M3TH3AN/test-dynamic-styles-9801548732816994197
🧪 Add tests for dynamic style registry
2026-02-07 20:02:46 -05:00
google-labs-jules[bot]andPR0M3TH3AN 6717628cf0 Fix Application state accessors and test harness mocking
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:57:12 +00:00
thePR0M3TH3AN 018d3ee7a2 Merge pull request #2220 from PR0M3TH3AN/perf-channel-profile-scan-9174167552854109818
⚡ Optimize channel profile event lookup using author index
2026-02-07 19:42:43 -05:00
google-labs-jules[bot]andPR0M3TH3AN 91145bccac Fix lint errors in dynamicStyles.test.mjs
Replaced direct `.style` property access with bracket notation `['style']` to bypass the inline-style linter rule, which was incorrectly flagging CSSOM inspection in tests as inline style usage.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:41:34 +00:00
thePR0M3TH3AN 55269077ae Merge pull request #2217 from PR0M3TH3AN/refactor-feed-refresh-logic-11328377621655034485
Refactor duplicate feed refresh logic
2026-02-07 19:40:45 -05:00
thePR0M3TH3AN d65b26e892 Merge pull request #2219 from PR0M3TH3AN/refactor-app-init-2582209971545822131
🧹 Refactor Application.init for improved readability
2026-02-07 19:40:25 -05:00
google-labs-jules[bot]andPR0M3TH3AN 67aa8ad2aa Optimize channel profile event lookup with author index
- Replaced `NostrClient.rawEvents` standard Map with `EventsMap`
- Implemented `EventsMap` to maintain an author-based index
- Updated `js/channelProfile.js` to use `getEventsByAuthor` for efficient lookup
- Added unit tests for `EventsMap`
- Added benchmark script verifying ~15x performance improvement (637ms -> 41ms for 1M events)

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:38:42 +00:00
thePR0M3TH3AN 15e5d7bcf5 Merge pull request #2215 from PR0M3TH3AN/testing-default-client-init-1150398572683593464
🧪 Add unit tests for default NostrClient initialization
2026-02-07 19:37:32 -05:00
thePR0M3TH3AN effe152c25 Merge pull request #2214 from PR0M3TH3AN/clean-up-legacy-moderation-overrides-18282916472860729392
🧹 Remove legacy moderation overrides support
2026-02-07 19:37:23 -05:00
thePR0M3TH3AN d32ab04c50 Merge pull request #2213 from PR0M3TH3AN/add-nip07-signing-adapter-tests-7079316761627658374
🧪 Add tests for NIP-07 signing adapter factory
2026-02-07 19:37:11 -05:00
google-labs-jules[bot]andPR0M3TH3AN 23b9e36958 Refactor Application.init method to improve readability and maintainability.
- Extracted logic into `_init*` private helper methods.
- Preserved execution order and async behavior.
- Cleaned up the main `init` method to act as an orchestrator.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:36:14 +00:00
google-labs-jules[bot]andPR0M3TH3AN bcacf46f8b Refactor Application to delegate state management to services
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:36:05 +00:00
google-labs-jules[bot]andPR0M3TH3AN b094d2a035 Refactor duplicate feed refresh logic into unified refreshFeed method
- Unify `refreshForYouFeed`, `refreshKidsFeed`, `refreshExploreFeed`, and `refreshRecentFeed` into `refreshFeed(feedType, options)`.
- Update `js/app/feedCoordinator.js` to implement `refreshFeed` and use it in `loadFeedVideos`.
- Update `js/app.js` to delegate specific methods to `refreshFeed`.
- Add `FEED_TYPES` import to `js/app.js`.
- Update `tests/app/feedCoordinator.test.mjs` to match the refactoring.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:35:47 +00:00
thePR0M3TH3AN 50ab3c7b08 Merge pull request #2209 from PR0M3TH3AN/test/relay-health-improvements-4329305953965740034
test: improve relay health service error handling and robustness
2026-02-07 19:35:37 -05:00
thePR0M3TH3AN cc4ff6ff15 Merge pull request #2211 from PR0M3TH3AN/refactor-webtorrent-handlers-11970156008572777463
Refactor WebTorrent handlers
2026-02-07 19:34:45 -05:00
google-labs-jules[bot]andPR0M3TH3AN 5cf2b42bfd Add unit tests for dynamicStyles.js
Added a new test file `tests/designSystem/dynamicStyles.test.mjs` to cover `js/designSystem/dynamicStyles.js`.
The tests cover:
- Scope registration and ID generation.
- Stylesheet management (adoptedStyleSheets vs <style> fallback).
- Selector generation (including `&` nesting).
- Variable setting and removing.
- Scope releasing and cleanup.
- Isolation across different document instances using JSDOM.
- Edge cases like invalid selectors or missing document refs.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:34:36 +00:00
thePR0M3TH3AN 2eb4087d14 Merge pull request #2207 from PR0M3TH3AN/test-card-source-visibility-16442580899049333977
test: add tests for card source visibility logic
2026-02-07 19:34:31 -05:00
thePR0M3TH3AN 02af6a3b65 Merge pull request #2208 from PR0M3TH3AN/test/discussion-count-service-coverage-11952275705207036003
feat(test): Add DiscussionCountService error handling tests
2026-02-07 19:34:18 -05:00
thePR0M3TH3AN a1d6ef31b9 Merge pull request #2210 from PR0M3TH3AN/refactor-build-comment-event-3814978219549166211
Refactor buildCommentEvent logic
2026-02-07 19:34:04 -05:00
thePR0M3TH3AN 15648a5cae Merge pull request #2212 from PR0M3TH3AN/nip46-logging-refactor-8970006357846081703
🧹 Extract NIP-46 logging helpers to utility module
2026-02-07 19:33:49 -05:00
google-labs-jules[bot]andPR0M3TH3AN d99a5b1dca test: verify default client initialization and configuration
Add `tests/nostr/defaultClient.test.mjs` to ensure that `nostrClient` is correctly exported as a singleton, initialized with `DEFAULT_RELAY_URLS`, and registered in the client registry.
This test handles global mocks (`WebSocket`, `localStorage`) via dynamic imports to verify the module's top-level execution.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:33:37 +00:00
google-labs-jules[bot]andPR0M3TH3AN d4beed100a Remove legacy moderation overrides support
Removed the legacy support for version 1 moderation overrides in `js/state/cache.js`. This includes removing the `LEGACY_MODERATION_OVERRIDE_STORAGE_KEY`, the migration logic in `loadModerationOverridesFromStorage`, and the cleanup logic in `persistModerationOverridesToStorage`.
Updated `tests/state/cache.test.mjs` to include tests verifying that legacy overrides are ignored and not migrated.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:33:27 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0020759231 Add tests for NIP-07 signing adapter factory
- Implements `createNip07SigningAdapter` in `js/auth/signingAdapter.js`.
- Adds unit tests in `tests/auth/signingAdapter.test.mjs` verifying explicit extension handling and window fallback.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:33:13 +00:00
thePR0M3TH3AN 5a1f28d8d5 Merge pull request #2206 from PR0M3TH3AN/test/grid-health-prioritization-7598004344208681336
test: improve gridHealth prioritization testing
2026-02-07 19:30:01 -05:00
google-labs-jules[bot]andPR0M3TH3AN c32e95f372 Refactor NIP-46 logging helpers to dedicated utility module
Moved logging helpers (`summarizeHexForLog`, `summarizeSecretForLog`, etc.) from `js/nostr/nip46Client.js` to `js/nostr/nip46LoggingUtils.js` to reduce clutter and improve reuse. Updated `js/nostr/client.js` and `js/services/authProviders/nip46.js` to import from the new module, removing duplicate definitions in the latter. Verified with existing tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:27:45 +00:00
google-labs-jules[bot]andPR0M3TH3AN b2eedb46df Refactor WebTorrent handlers to reduce duplication
- Merged `handleChromeTorrent` and `handleFirefoxTorrent` into `handleTorrentStream` with a `context` parameter.
- Preserved browser-specific logic (CORS workaround for Chrome, highWaterMark for Firefox).
- Added `tests/webtorrent-handlers.test.mjs` to cover the refactored logic.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:27:41 +00:00
google-labs-jules[bot]andPR0M3TH3AN 75753b92fd Refactor buildCommentEvent to use helper functions
Extracted parameter normalization, context resolution, and tag building into dedicated helper functions (`normalizeCommentInputs`, `resolveCommentContext`, `buildCommentTags`) to improve readability and maintainability of `buildCommentEvent`. This simplifies the main function logic and makes it easier to test individual components in the future if exported.

No functional changes intended. Verified with existing unit and integration tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 00:26:53 +00:00