Commit Graph
6180 Commits
Author SHA1 Message Date
thePR0M3TH3AN cb1a0fec00 Merge pull request #2729 from PR0M3TH3AN/security-fix-qrcode-innerhtml-16143867429725848701
Refactor qrcode.js to eliminate unsafe innerHTML usage
2026-02-26 14:42:43 -05:00
thePR0M3TH3AN 98e1181783 Merge branch 'unstable' into security-fix-qrcode-innerhtml-16143867429725848701 2026-02-26 14:42:34 -05:00
thePR0M3TH3AN 89b364c2e7 Merge pull request #2726 from PR0M3TH3AN/refactor/delete-modal-dtag-extraction-9801703157260752806
Refactor DeleteModal to use shared getDTagValueFromTags
2026-02-26 14:41:55 -05:00
thePR0M3TH3AN 475e1f71f1 Merge branch 'unstable' into refactor/delete-modal-dtag-extraction-9801703157260752806 2026-02-26 14:41:48 -05:00
thePR0M3TH3AN 55fd4ed789 Merge pull request #2722 from PR0M3TH3AN/refactor/revert-modal-nip71-d-tag-2158505577819364487
Refactor RevertModal to use shared nip71.getDTagValueFromTags
2026-02-26 14:41:31 -05:00
thePR0M3TH3AN 7b1ac9903a Merge branch 'unstable' into refactor/revert-modal-nip71-d-tag-2158505577819364487 2026-02-26 14:41:24 -05:00
thePR0M3TH3AN d050156d69 Merge pull request #2720 from PR0M3TH3AN/perf-watch-history-parallel-18111087127374532903
⚡ Optimize watch history publishing with Promise.all
2026-02-26 14:41:05 -05:00
thePR0M3TH3AN b74e2df01c Merge pull request #2731 from PR0M3TH3AN/test/link-preview-settings-coverage-2904834955738247686
test: Add tests for LinkPreviewSettings utility
2026-02-26 14:40:53 -05:00
thePR0M3TH3AN 010006fc1c Merge pull request #2738 from PR0M3TH3AN/agents-daily-scheduler-update-agent-11547664209218518467
Daily Scheduler Update Agent Execution
2026-02-26 14:40:27 -05:00
thePR0M3TH3AN fc291d2120 Merge branch 'unstable' into agents-daily-scheduler-update-agent-11547664209218518467 2026-02-26 14:40:19 -05:00
thePR0M3TH3AN 53a003b137 Merge pull request #2739 from PR0M3TH3AN/agents/daily/scheduler-update-agent-5338406603034586351
docs(prompts): sync scheduler rosters — 2026-02-26
2026-02-26 14:39:51 -05:00
thePR0M3TH3AN 4c0908fc80 Merge pull request #2719 from PR0M3TH3AN/test/comment-avatar-utils-17097475916649989632
🧪 Add tests for comment avatar utils
2026-02-26 14:39:37 -05:00
thePR0M3TH3AN c5d464f335 Merge pull request #2718 from PR0M3TH3AN/test/comment-avatar-7190109823382715625
🧪 Add tests for commentAvatar.js
2026-02-26 14:39:22 -05:00
thePR0M3TH3AN 9453a40c82 Merge branch 'unstable' into test/comment-avatar-7190109823382715625 2026-02-26 14:39:15 -05:00
thePR0M3TH3AN 4bdf0830ce Merge pull request #2717 from PR0M3TH3AN/security/fix-embed-rel-noopener-9431652007769204320
🔒 Security Fix: Add rel="noopener noreferrer" to embed watch button
2026-02-26 14:38:28 -05:00
thePR0M3TH3AN 11250f681b Merge pull request #2716 from PR0M3TH3AN/refactor-app-extract-dtag-value-657233878683899686
Refactor extractDTagValue in js/app.js
2026-02-26 14:38:13 -05:00
thePR0M3TH3AN 2d28b4d49a Merge pull request #2715 from PR0M3TH3AN/fix-channel-profile-security-vulnerability-10108335032867122402
🔒 Fix missing rel="noopener noreferrer" in channel profile link
2026-02-26 14:37:56 -05:00
google-labs-jules[bot]andPR0M3TH3AN 7775e4d3fb docs(prompts): sync scheduler rosters — 2026-02-26
- No changes required; verified roster.json and scheduler markdown files match prompt directories.
- Daily count: 23 prompts
- Weekly count: 21 prompts
- Verified with torch/scripts/validate-scheduler-roster.mjs

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 19:35:58 +00:00
google-labs-jules[bot]andPR0M3TH3AN 23531f708b docs(scheduler): scheduler-update-agent completed daily sync
- Verified roster consistency between `roster.json` and actual prompt files.
- No discrepancies found.
- Generated task log.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 19:28:52 +00:00
thePR0M3TH3AN 19d3e0dfbd Merge pull request #2736 from PR0M3TH3AN/update-watch-history-test-items-15094903720553574923
Update watch history test to use aggregated items
2026-02-26 13:04:27 -05:00
thePR0M3TH3AN de80e58b5d Merge pull request #2725 from PR0M3TH3AN/refactor-delete-modal-dtag-919037621417068012
Refactor DeleteModal to use shared getDTagValueFromTags utility
2026-02-26 13:04:19 -05:00
thePR0M3TH3AN 292f3a40cb Merge pull request #2723 from PR0M3TH3AN/refactor-revert-modal-dtag-18208308647871133769
🧹 Refactor RevertModal to use shared d-tag extraction utility
2026-02-26 13:04:11 -05:00
thePR0M3TH3AN 0e5e56b146 Merge branch 'unstable' into refactor-revert-modal-dtag-18208308647871133769 2026-02-26 13:04:04 -05:00
thePR0M3TH3AN ecdea6ac94 Merge pull request #2724 from PR0M3TH3AN/test/link-preview-settings-coverage-13742612794998658634
test: Add unit tests for linkPreviewSettings.js
2026-02-26 13:03:45 -05:00
thePR0M3TH3AN 143dcf771d Merge pull request #2727 from PR0M3TH3AN/test/video-menu-renderers-15090243999919330255
🧪 Add tests for video menu renderers
2026-02-26 13:02:53 -05:00
thePR0M3TH3AN 73f7540b4e Merge pull request #2730 from PR0M3TH3AN/security-fix-qrcode-innerhtml-10127011832917430140
🔒 Fix unsafe innerHTML usage in qrcode.js
2026-02-26 13:02:46 -05:00
thePR0M3TH3AN c7cbe086bc Merge pull request #2728 from PR0M3TH3AN/test/static-modal-accessibility-13129271747123339314
🧪 Add tests for staticModalAccessibility.js
2026-02-26 13:02:39 -05:00
thePR0M3TH3AN 3bfa2d8a83 Merge pull request #2733 from PR0M3TH3AN/perf-nostr-service-incremental-updates-3861441146552926280
⚡ Optimize video subscription updates using incremental processing
2026-02-26 13:02:32 -05:00
thePR0M3TH3AN f536c71917 Merge pull request #2721 from PR0M3TH3AN/test/comment-avatar-16584237555601496118
Add unit tests for commentAvatar.js
2026-02-26 13:02:25 -05:00
google-labs-jules[bot]andPR0M3TH3AN 311e14c66c test(watch-history): rely on aggregated items from publishRecords
Updated `tests/watch-history.test.mjs` to consume `snapshotResult.items` directly, as `WatchHistoryManager`'s `publishRecords` correctly returns aggregated items. Removed the fallback logic and TODO comment that suggested otherwise.

This cleanup aligns the test with the current implementation of `WatchHistoryManager` which flattens monthly results into a top-level `items` array.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 18:02:18 +00:00
thePR0M3TH3AN c28d1e2c2b Merge pull request #2734 from PR0M3TH3AN/refactor/revert-modal-rendering-15253432646628070109
Refactor RevertModal rendering logic
2026-02-26 13:00:38 -05:00
thePR0M3TH3AN c60eada1a6 Merge pull request #2735 from PR0M3TH3AN/refactor-videomodal-comments-13431359782891705470
🧹 Refactor VideoModal to extract CommentsController logic
2026-02-26 13:00:27 -05:00
thePR0M3TH3AN 6692fe1a30 Merge pull request #2732 from PR0M3TH3AN/fix/dm-decryptor-race-order-8056308351647388512
⚡ Use ordered race for parallel DM decryption to respect preference
2026-02-26 13:00:18 -05:00
google-labs-jules[bot]andPR0M3TH3AN feb7ad765a Refactor VideoModal to delegate comments to CommentsController
Move comment-related logic and state from VideoModal.js to CommentsController.js.
Split CommentsController into CommentsController (orchestration), CommentsListRenderer (DOM management), and CommentNodeFactory (element creation) to maintain modularity and adhere to file size limits.
Update VideoModal to initialize and destroy CommentsController correctly.
Fix minor lint issues.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:53:34 +00:00
google-labs-jules[bot]andPR0M3TH3AN 2703382ab4 Refactor RevertModal rendering logic into separate module
Extracted excessive DOM rendering logic from `RevertModal.js` into `revertModalRenderers.js`.
This improves code readability and maintainability by separating the view construction from the modal logic.
Added unit tests for the new renderers using a lightweight DOM mock.
Replaced local d-tag extraction with shared utility `getDTagValueFromTags`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:50:10 +00:00
google-labs-jules[bot]andPR0M3TH3AN 6e42d2c97c perf: Optimize nostrService video subscription updates
Optimizes the `subscribeVideos` callback in `js/services/nostrService.js` to handle video updates incrementally, avoiding O(N*M) complexity during high-volume updates (e.g., initial load).

Changes:
- Modified `js/nostr/videoEventBuffer.js` to include deleted videos in the flushed batch, allowing consumers to handle deletions incrementally.
- Updated `js/services/nostrService.js` to process `updatedVideos` incrementally:
  - Separates updates into active and deleted.
  - Updates `this.videosMap` directly (removing deleted, adding/updating active).
  - Filters and caches only the active updates (O(M)).
  - Emits `videos:updated` with the full sorted list (derived from the updated map) to maintain API contract with consumers.
  - Persists the full sorted list to localStorage.

This reduces the per-batch overhead significantly by avoiding O(N) filtering and map reconstruction for every batch of updates.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:48:37 +00:00
google-labs-jules[bot]andPR0M3TH3AN 56ffdb693d Refactor decryptLegacyDm to use ordered parallel race for decryptors.
Replaces Promise.any with raceOrdered utility to respect decryptor preference order while maintaining parallel execution.
Adds regression test for order preference.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:45:31 +00:00
google-labs-jules[bot]andPR0M3TH3AN fd5e6fef6b test: add missing tests for LinkPreviewSettings utility
- Refactor `tests/utils/linkPreviewSettings.test.mjs` to be self-contained and remove dependency on `jsdom` (via `test-setup.mjs`).
- Add comprehensive test cases for `getLinkPreviewSettings`, `setLinkPreviewAutoFetch`, `allowLinkPreviewDomain`, `isLinkPreviewDomainAllowed`, and `subscribeToLinkPreviewSettings`.
- Add robustness checks for missing `localStorage` (simulated) and invalid inputs.
- Polyfill `EventTarget` and `CustomEvent` (as fallback) to ensure tests run reliably in environments where `jsdom` is unavailable.

This addresses the gap in testing coverage for `js/utils/linkPreviewSettings.js` while ensuring test stability.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:44:51 +00:00
google-labs-jules[bot]andPR0M3TH3AN e2835603c5 Refactor js/utils/qrcode.js to replace innerHTML with DOM manipulation
- Replaced `innerHTML` usage in `Drawing.prototype.draw` (table fallback) with `document.createElement`, `appendChild`, etc.
- Replaced `innerHTML` usage in `Drawing.prototype.clear` with `removeChild` loop.
- Added `tests/qrcode_table_fallback.test.mjs` to verify the table generation logic in a simulated environment (JSDOM) without Canvas support.
- Updated `package.json` to include `jsdom` in `devDependencies` (if it wasn't already there and committed, though I verified it is present after install).

This change eliminates the potential for HTML injection vulnerabilities in the QR code generation library.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:42:43 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0fcfc6009f Refactor qrcode.js to use DOM methods instead of innerHTML
- Replaces unsafe innerHTML usage with document.createElement and appendChild in the table drawing fallback.
- Adds a unit test `tests/qrcode_table_fallback.test.mjs` to verify the table generation logic using JSDOM.
- Addresses a potential security vulnerability where HTML injection could occur (though unlikely in this specific context, it is best practice).
- Updates package.json to include jsdom in devDependencies (if not already present).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:42:28 +00:00
google-labs-jules[bot]andPR0M3TH3AN 7ec726aad1 Add tests for staticModalAccessibility.js
- Create `tests/static-modal-accessibility.test.mjs` to test `prepareStaticModal`, `openStaticModal`, and `closeStaticModal`.
- Tests cover element resolution, DOM state updates (classes, attributes), and edge cases (missing elements, null targets).
- Use `jsdom` to mock the browser environment.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:42:07 +00:00
google-labs-jules[bot]andPR0M3TH3AN e95355fdb0 Add unit tests for video menu renderers
- Created `tests/video-menu-renderers.test.mjs` to test `js/ui/components/videoMenuRenderers.js`.
- Implemented comprehensive test coverage for `createVideoMoreMenuPanel`, `createVideoShareMenuPanel`, `createChannelProfileMenuPanel`, and `createVideoSettingsMenuPanel`.
- Tests use `jsdom` to simulate DOM element creation and verify structure, classes, and dataset attributes.
- Ensured dependencies (`jsdom`) are installed.
- Verified tests pass with `npm run test:unit`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:41:34 +00:00
google-labs-jules[bot]andPR0M3TH3AN 822ba4d478 Refactor DeleteModal to use shared getDTagValueFromTags
Replaced the local `extractDTagValue` function in `js/ui/components/DeleteModal.js` with the shared `getDTagValueFromTags` utility from `js/nostr/nip71.js` to reduce code duplication and improve maintainability.

Added `tests/ui/components/DeleteModal.test.mjs` with manual DOM mocks to verify the refactor and ensure no regressions.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:39:38 +00:00
google-labs-jules[bot]andPR0M3TH3AN 4bdcfbdb2e Refactor: Replace duplicated extractDTagValue in DeleteModal
Replaced the local `extractDTagValue` function in `js/ui/components/DeleteModal.js` with the shared `getDTagValueFromTags` utility from `js/nostr/nip71.js` (exported via `js/nostr/index.js`).

Added a new unit test `tests/ui/components/DeleteModal.test.mjs` to verify the d-tag extraction logic and ensure the refactor is correct and safe. This test uses `jsdom` to mock the necessary DOM environment.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:39:07 +00:00
google-labs-jules[bot]andPR0M3TH3AN c4fc0cdb16 test: Add unit tests for linkPreviewSettings.js
- Added comprehensive tests for default settings, storage parsing, and error handling.
- Covered `setLinkPreviewAutoFetch` and `allowLinkPreviewDomain` (including normalization and silent mode).
- Verified `isLinkPreviewDomainAllowed` and event subscriptions.
- Mocked `window.dispatchEvent`, `addEventListener`, and `CustomEvent` locally as they are missing from test helpers.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:38:30 +00:00
google-labs-jules[bot]andPR0M3TH3AN 931f57eebe Refactor RevertModal to use shared d-tag extraction utility
- Removed duplicated `extractDTagValue` method from `js/ui/components/RevertModal.js`
- Imported and used `getDTagValueFromTags` from `js/nostr/nip71.js`
- Added unit tests for `getDTagValueFromTags` in `tests/nostr/nip71-d-tag.test.mjs`

This reduces code duplication and ensures consistent d-tag extraction logic.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:37:26 +00:00
google-labs-jules[bot]andPR0M3TH3AN 30fbb8d81a Refactor RevertModal to use shared nip71.getDTagValueFromTags
Replaced the duplicated `extractDTagValue` method in `RevertModal.js` with the standard `getDTagValueFromTags` utility from `js/nostr/nip71.js`.

Verified by adding a new unit test suite `tests/nostr/nip71-d-tag.test.mjs` ensuring the utility covers all edge cases.

This improves code health by reducing duplication and centralizing NIP-71 logic.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:36:43 +00:00
google-labs-jules[bot]andPR0M3TH3AN b1b797a12b Add unit tests for commentAvatar.js utility functions
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:36:00 +00:00
google-labs-jules[bot]andPR0M3TH3AN 37d55944ba perf: parallelize watch history publishing
Replaced `pMap` with `Promise.all` in `publishRecords` to remove concurrency limit for faster syncing of multiple month records.

Measured ~50% improvement in mock benchmark (200ms -> 100ms for 10 items with concurrency 5 vs unbounded).

Note: The task description described the existing code as a sequential `for` loop, but the actual file used `pMap` with concurrency 5. This change optimizes it further by removing the concurrency limit as requested.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:35:40 +00:00
google-labs-jules[bot]andPR0M3TH3AN 12dc1ac57c Add unit tests for comment avatar utilities
Added `tests/comment-avatar.test.mjs` to cover `normalizeCommentAvatarKey`, `resolveCommentAvatarAsset`, and `registerCommentAvatarFailure`.
Tests cover:
- Input validation and edge cases.
- Caching logic and fallback behaviors.
- Failure registration and cache invalidation.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-26 17:34:14 +00:00