Commit Graph
5044 Commits
Author SHA1 Message Date
google-labs-jules[bot]andPR0M3TH3AN 273cbfd9cc Refactor HashtagPreferencesService to use unified profile cache key
Replaced the legacy "interests" string literal with NOTE_TYPES.HASHTAG_PREFERENCES
in profileCache calls to unify key usage. Updated migration logic and comments.
Verified that the underlying storage key remains consistent for backward compatibility.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:50:18 +00:00
thePR0M3TH3AN a20d01a412 Merge pull request #2197 from PR0M3TH3AN/chore/refactor-remove-custom-bech32-2289762197289114271
🧹 Remove custom Bech32 implementation in nip46Client
2026-02-07 18:40:17 -05:00
google-labs-jules[bot]andPR0M3TH3AN a892d78c4e chore: remove custom bech32 implementation in nip46Client
Removes the custom `bech32Polymod` and related Bech32 decoding functions from `js/nostr/nip46Client.js` in favor of using `nostr-tools` library implementation via `nip19.decode`. This reduces code duplication and relies on the standard library for decoding npubs.

Breaking Changes:
- None. `decodeNpubToHex` now strictly requires `nostr-tools` to be available, which is consistent with the rest of the file's dependencies.

Tests:
- Verified with targeted unit tests (`tests/nostr/nip46Client.test.js`).
- Verified with a reproduction script (`tests/repro_issue.mjs`) ensuring `decodeNpubToHex` correctly decodes valid npubs and handles invalid inputs.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:25:08 +00:00
thePR0M3TH3AN e897bfe44b Merge pull request #2196 from PR0M3TH3AN/perf/channel-profile-render-loop-optimization-15025405161037801037
⚡ Remove dead code execution in channel profile render loop
2026-02-07 18:24:37 -05:00
thePR0M3TH3AN 9110f1762b Merge pull request #2195 from PR0M3TH3AN/tests/zap-helpers-coverage-11165774273391187280
test: add unit tests for zap helpers
2026-02-07 18:22:25 -05:00
thePR0M3TH3AN d6b606a6e3 Merge pull request #2185 from PR0M3TH3AN/refactor/remove-unused-import-nostrevent-schemas-1391210410040613476
🧹 Remove unused import WATCH_HISTORY_LIST_IDENTIFIER in nostrEventSchemas.js
2026-02-07 18:20:50 -05:00
google-labs-jules[bot]andPR0M3TH3AN 99d217e778 perf: remove dead code in channel profile render loop
Removes the call to `app.persistWatchHistoryMetadataForVideo` in `renderChannelVideosFromList` within `js/channelProfile.js`. This function was identified as a no-op (delegating to a deprecated empty method), adding unnecessary overhead to the rendering loop.

Benchmark results (100M iterations):
- With call: ~1278ms
- Without call: ~88ms
- Improvement: ~14x speedup in the tight loop simulation.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:20:39 +00:00
thePR0M3TH3AN 8ccf0dc8e1 Merge pull request #2187 from PR0M3TH3AN/test-improvement/comment-avatar-resolution-2019846885315383708
🧪 Add unit tests for comment avatar resolution
2026-02-07 18:20:08 -05:00
thePR0M3TH3AN b549069fc4 Merge pull request #2194 from PR0M3TH3AN/refactor/feed-coordinator-load-logic-7944534665779205819
🧹 Refactor feed loading logic into shared loadFeedVideos method
2026-02-07 18:19:51 -05:00
thePR0M3TH3AN 135841c851 Merge pull request #2193 from PR0M3TH3AN/security/fix-nip46-session-storage-10018068311908189559
🔒 Fix insecure storage of NIP-46 session keys
2026-02-07 18:19:43 -05:00
thePR0M3TH3AN 340e4cc50a Merge pull request #2191 from PR0M3TH3AN/ai/test-video-menu-renderers-13178145676174629231
🧪 Add tests for video menu renderers
2026-02-07 18:19:00 -05:00
thePR0M3TH3AN c290959a7e Merge pull request #2192 from PR0M3TH3AN/perf/batch-profile-refresh-14711465702211977594
⚡ Optimize profile refreshing with batch requests
2026-02-07 18:18:50 -05:00
thePR0M3TH3AN 619596d8e5 Merge pull request #2189 from PR0M3TH3AN/security/fix-login-modal-open-redirect-13235976572682331262
🔒 Fix Open Redirect and XSS via NIP-46 Authentication URL
2026-02-07 18:18:41 -05:00
google-labs-jules[bot]andPR0M3TH3AN 1fa72709d9 test: add unit tests for zap helpers
Add comprehensive unit tests for `js/ui/dm/zapHelpers.js` in `tests/ui/dm/zapHelpers.test.mjs`.

- Covers `formatZapAmount` for standard and compact notation.
- Covers `aggregateZapTotals` for aggregation logic and edge cases.
- Covers `normalizeZapReceipt` for input normalization.
- Ensures robust handling of invalid inputs (NaN, null, etc.).

Signed-off-by: Jules <[email protected]>

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:18:40 +00:00
thePR0M3TH3AN 85b0c2640f Merge pull request #2190 from PR0M3TH3AN/test-dom-utils-8159522647333333512
test(utils): add unit tests for domUtils
2026-02-07 18:18:10 -05:00
thePR0M3TH3AN 6598bb3c86 Merge pull request #2186 from PR0M3TH3AN/ai/test-dm-decrypt-diagnostics-16550896764619201700
🧪 Add tests for DM decrypt diagnostics
2026-02-07 18:17:57 -05:00
thePR0M3TH3AN b7adb91e37 Merge pull request #2188 from PR0M3TH3AN/refactor/load-saved-profiles-18358852260091920961
🧹 Refactor loadSavedProfilesFromStorage complexity
2026-02-07 18:17:40 -05:00
google-labs-jules[bot]andPR0M3TH3AN afd64ba1ce Refactor feed loading logic into shared loadFeedVideos method
- Introduce `loadFeedVideos(feedType, forceFetch)` in `js/app/feedCoordinator.js` to consolidate video loading logic.
- Update `loadForYouVideos`, `loadKidsVideos`, `loadExploreVideos`, and `loadVideos` to use the shared method.
- Parameterize feed-specific configuration (telemetry context, tags, loading messages, relay health checks) based on feed type.
- Add `tests/app/feedCoordinator.test.mjs` to verify the new logic.

Signed-off-by: Jules <[email protected]>

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:15:56 +00:00
google-labs-jules[bot]andPR0M3TH3AN 8a9dcab4e1 fix(security): encrypt NIP-46 session keys in localStorage
- Implement AES-GCM encryption for NIP-46 `clientPrivateKey` and `secret` using `js/nostr/sessionActor.js` primitives.
- Update `writeStoredNip46Session` to accept an optional `passphrase` and encrypt sensitive fields before storage.
- Update `readStoredNip46Session` to support encrypted session retrieval.
- Add `decryptNip46Session` helper to unlock session keys with a user-provided passphrase.
- Update `NostrClient` methods `connectRemoteSigner` and `useStoredRemoteSigner` to support the new encryption flow.
- Ensure plain text keys are never persisted to `localStorage` (default safe behavior maintained).

Signed-off-by: Jules <[email protected]>

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:15:48 +00:00
google-labs-jules[bot]andPR0M3TH3AN aae2ea7d16 perf: use batch fetch for profile refresh
Replaces the sequential loop in `forceRefreshAllProfiles` with `batchFetchProfiles` to reduce network requests.
Updates `batchFetchProfilesFromRelays` to support `forceRefresh`, ensuring fresh data is requested while maintaining optimistic UI updates.
Adds unit tests for `forceRefresh` behavior.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:15:13 +00:00
google-labs-jules[bot]andPR0M3TH3AN 4d93ed25ce 🧪 Add tests for video menu renderers
Signed-off-by: Jules <[email protected]>

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:15:02 +00:00
google-labs-jules[bot]andPR0M3TH3AN 06865e5f46 test(utils): add unit tests for domUtils
- Added `tests/utils/domUtils.test.mjs` to test `escapeHTML` and `removeTrackingScripts`.
- Verified tests pass with `node:test` and JSDOM.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:14:18 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2f78bc6632 Fix Open Redirect and XSS via NIP-46 Authentication URL
- Validated `pendingAuthUrl` protocol to be `http:` or `https:` in `js/ui/loginModalController.js`.
- Logged warning if unsafe URL is encountered.

Signed-off-by: Jules <[email protected]>

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:13:31 +00:00
google-labs-jules[bot]andPR0M3TH3AN 53d7bc7a59 Refactor loadSavedProfilesFromStorage for better maintainability
Extracted the complex parsing, validation, and migration logic for saved profiles into a new helper function `processSavedProfilesPayload`. This reduces the complexity of `loadSavedProfilesFromStorage` and improves readability.

Functionality is preserved, including handling of legacy formats, NIP-07 auth types, and active profile normalization.

Verified with targeted tests:
- tests/state/cache-saved-profiles.test.mjs
- tests/state/cache.test.mjs

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:13:11 +00:00
google-labs-jules[bot]andPR0M3TH3AN e79998f7b5 test: add unit tests for comment avatar resolution
Added a new test file `tests/unit/comment-avatar.test.mjs` to comprehensively test the `commentAvatar.js` utility. The tests cover:
- `normalizeCommentAvatarKey`: Verifies input sanitization and normalization.
- `resolveCommentAvatarAsset`: Verifies avatar resolution logic including defaults, failure handling, and caching strategies.
- `registerCommentAvatarFailure`: Verifies failure registration and cache invalidation.

This ensures robust handling of user avatars in comments, including edge cases like missing or failed images and cache persistence.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:12:11 +00:00
google-labs-jules[bot]andPR0M3TH3AN aefd6308a2 🧪 Add tests for DM decrypt diagnostics
- Added unit tests for `summarizeDmEventForLog` covering null/invalid inputs, valid events, and edge cases.
- Added unit tests for `sanitizeDecryptError` covering null/invalid inputs, string errors, and error objects.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:11:47 +00:00
google-labs-jules[bot]andPR0M3TH3AN 28af2910de chore(code-health): remove unused WATCH_HISTORY_LIST_IDENTIFIER import from nostrEventSchemas.js
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 23:10:26 +00:00
thePR0M3TH3AN c539fef553 Merge pull request #2183 from PR0M3TH3AN/jules-fix-unused-import-appjs-3659969045676148831
chore(js): remove unused splitAndZap import in app.js
2026-02-07 17:40:17 -05:00
bitvid-agent 73093ae916 fix(ai): formatting (agent) suggested 2026-02-07 22:17:31 +00:00
google-labs-jules[bot]andPR0M3TH3AN 31dc297991 chore(js): remove unused splitAndZap import in app.js
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 22:14:19 +00:00
thePR0M3TH3AN 2c5fb67985 Merge pull request #2182 from PR0M3TH3AN/refactor/feed-types-constants-7142050680573542479
🧹 Refactor hardcoded feed identifiers to constants
2026-02-07 17:03:10 -05:00
bitvid-agent 9f710c1f77 fix(ai): formatting (agent) suggested 2026-02-07 22:02:54 +00:00
google-labs-jules[bot]andPR0M3TH3AN a829cd95ca Refactor hardcoded feed identifiers to use constants
Introduced FEED_TYPES constants in js/constants.js and updated js/app/authSessionCoordinator.js, js/hashChangeHandler.js, js/viewManager.js, and js/app/feedCoordinator.js to use them. This improves maintainability and reduces the risk of typos in feed view names.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 21:59:37 +00:00
thePR0M3TH3AN 38f63e5851 Merge pull request #2181 from PR0M3TH3AN/refactor/deduplicate-hex64-regex-4819369490365472168
🧹 Refactor: Deduplicate HEX64_REGEX constant
2026-02-07 16:57:49 -05:00
bitvid-agent 955398d338 fix(ai): formatting (agent) suggested 2026-02-07 21:56:02 +00:00
google-labs-jules[bot]andPR0M3TH3AN a084bb59de refactor: deduplicate HEX64_REGEX to js/utils/hex.js
Moves the repeatedly defined HEX64_REGEX constant to a shared utility
module to improve maintainability and consistency. Updates all consumers
to import from the new location.

Signed-off-by: Jules <[email protected]>

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 21:52:51 +00:00
thePR0M3TH3AN 4c30228fad Merge pull request #2180 from PR0M3TH3AN/chore-remove-unused-nip46-constants-17069818061582667621
🧹 Remove unused NIP-46 constants exports
2026-02-07 16:49:29 -05:00
bitvid-agent ac96ef76ea fix(ai): formatting (agent) suggested 2026-02-07 21:48:59 +00:00
thePR0M3TH3AN 136c09e93e Merge pull request #2179 from PR0M3TH3AN/chore/remove-unused-import-app-js-6603743995432153207
🧹 Remove unused MAX_WALLET_DEFAULT_ZAP import from app.js
2026-02-07 16:46:23 -05:00
bitvid-agent ad336a708e fix(ai): formatting (agent) suggested 2026-02-07 21:46:06 +00:00
google-labs-jules[bot]andPR0M3TH3AN 314cf01ac1 chore: remove unused NIP-46 constants exports
Removed `export` from `NIP46_SESSION_STORAGE_KEY`, `NIP46_PUBLISH_TIMEOUT_MS`, `NIP46_RESPONSE_TIMEOUT_MS`, `NIP46_SIGN_EVENT_TIMEOUT_MS`, and `NIP46_MAX_RETRIES` in `js/nostr/nip46Client.js` as they are only used internally.
Updated `js/nostr/client.js` to remove unused imports of these constants.
Verified that `NIP46_HANDSHAKE_TIMEOUT_MS` and `NIP46_AUTH_CHALLENGE_MAX_ATTEMPTS` are used in `js/nostr/client.js` and thus remain exported.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 21:45:47 +00:00
google-labs-jules[bot]andPR0M3TH3AN 5f12eadd4d chore: remove unused MAX_WALLET_DEFAULT_ZAP import from app.js
Removes the unused `MAX_WALLET_DEFAULT_ZAP` import from `js/app.js` to improve code health and reduce confusion. This variable was imported from `config.js` but never used within `app.js`.

Verification:
- Confirmed `MAX_WALLET_DEFAULT_ZAP` is not present in `js/app.js`.
- Ran `tests/app/is-user-logged-in.test.mjs` to ensure `js/app.js` still loads and functions correctly.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-07 21:42:58 +00:00
thePR0M3TH3AN 22fcc97672 Merge pull request #2174 from PR0M3TH3AN/ai/smoke-tests-20260207-2355643236623905980
chore(ai): add smoke test script (agent)
2026-02-07 16:34:40 -05:00
thePR0M3TH3AN 5a3256afef Merge pull request #2173 from PR0M3TH3AN/ai/load-test-20260207-17226311979336768263
feat(agent): implement nostr relay load test script
2026-02-07 16:34:21 -05:00
thePR0M3TH3AN 6c57794aa2 Merge pull request #2172 from PR0M3TH3AN/fix-known-issues-20260207-9290030417190436591
fix(tests): remediate known issues in LoginModal and VideoCard tests
2026-02-07 16:34:07 -05:00
thePR0M3TH3AN c58ead0b3f Merge pull request #2171 from PR0M3TH3AN/docs-align-behavior-17496722204495467027
📘 Align development docs with codebase behavior
2026-02-07 16:33:33 -05:00
thePR0M3TH3AN 5335d134ed Merge branch 'unstable' into docs-align-behavior-17496722204495467027 2026-02-07 16:33:22 -05:00
thePR0M3TH3AN c3c7d4f044 Merge pull request #2170 from PR0M3TH3AN/perf/optimize-explore-diversity-sorter-11300380522406167028
⚡ Optimize Explore Diversity Sorter with Inverted Index
2026-02-07 16:32:55 -05:00
thePR0M3TH3AN 5ea7ad30ae Merge pull request #2165 from PR0M3TH3AN/ai/lint-20260207-5252793567895615076
chore(ai): apply formatting/lint autofixes
2026-02-07 16:24:30 -05:00
thePR0M3TH3AN 4381620024 Merge pull request #2162 from PR0M3TH3AN/ai/reproducers-known-bugs-20240522-9928543418568370400
docs(repro): add minimal reproducers for known bugs
2026-02-07 16:23:59 -05:00