Commit Graph
5159 Commits
Author SHA1 Message Date
google-labs-jules[bot]andPR0M3TH3AN 6a74b3ddfc Refactor fetchListIncrementally into RelayBatchFetcher and genericize timeout logic
Extracted `fetchListIncrementally` from `js/nostr/client.js` into a new `RelayBatchFetcher` class in `js/nostr/relayBatchFetcher.js` to reduce complexity in `NostrClient`.
Moved `withRequestTimeout` to `js/utils/asyncUtils.js` to make it reusable and remove duplication.
Updated `js/nostr/client.js` to use these new components while preserving existing behavior and specific logging for COUNT diagnostics.

- Created `js/nostr/relayBatchFetcher.js`
- Updated `js/utils/asyncUtils.js`
- Refactored `js/nostr/client.js`
- Verified with existing tests

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 19:09:11 +00:00
thePR0M3TH3AN c785894943 Merge pull request #2252 from PR0M3TH3AN/codex/track-parallel-task-results-in-authsessioncoordinator
Track auth list sync outcomes and add consolidated auth-sync retry
2026-02-08 13:55:48 -05:00
thePR0M3TH3AN ffc248ecd3 Track auth list sync outcomes and expose retryable auth status 2026-02-08 13:52:04 -05:00
thePR0M3TH3AN 596498f306 Merge pull request #2251 from PR0M3TH3AN/claude/speed-up-nostr-login-EMmz7
Improve permission handling and fix async/decryption issues
2026-02-08 13:37:43 -05:00
thePR0M3TH3AN 589a196b0d Merge pull request #2241 from PR0M3TH3AN/refactor-app-constructor-8693111500998222747
🧹 Refactor Application constructor to setup() method
2026-02-08 13:33:33 -05:00
thePR0M3TH3AN e8eb138278 Merge pull request #2250 from PR0M3TH3AN/known-issues-triage-1473100205507666275
docs: update KNOWN_ISSUES.md and triage environment issues
2026-02-08 13:32:20 -05:00
thePR0M3TH3AN ede2f5cdc2 Merge pull request #2249 from PR0M3TH3AN/docs-subscription-backup-schema-11453826493234400433
Add Subscription Backup to Nostr Event Schemas Docs
2026-02-08 13:32:04 -05:00
thePR0M3TH3AN 5fcab6305f Merge pull request #2248 from PR0M3TH3AN/perf-sorters-optimization-11213639907851955656
⚡ Optimize chronological sorter performance
2026-02-08 13:31:49 -05:00
thePR0M3TH3AN a0614cdf82 Merge pull request #2247 from PR0M3TH3AN/ai/doc-moderationService-20260208-12200370596611243912
chore(ai): document js/services/moderationService.js
2026-02-08 13:31:33 -05:00
thePR0M3TH3AN 5b460fd327 Merge pull request #2246 from PR0M3TH3AN/ai/schema-validate-20260208-8755993239566575953
chore(ai): event schema validation tool + fixes
2026-02-08 13:31:20 -05:00
thePR0M3TH3AN 9c70fcfe26 Merge pull request #2234 from PR0M3TH3AN/security-fix-disable-dev-mode-6861215856535760775
🔒 Security Fix: Ensure IS_DEV_MODE is disabled in production
2026-02-08 13:30:36 -05:00
thePR0M3TH3AN 4d56d964c6 Merge branch 'unstable' into refactor-app-constructor-8693111500998222747 2026-02-08 13:28:55 -05:00
thePR0M3TH3AN 032bd40dbc Merge pull request #2237 from PR0M3TH3AN/dm-db-singleton-connection-6077819706812808064
⚡ Use singleton IndexedDB connection in dmDb.js
2026-02-08 13:28:25 -05:00
thePR0M3TH3AN f99f3f5ea8 Merge branch 'unstable' into security-fix-disable-dev-mode-6861215856535760775 2026-02-08 13:26:56 -05:00
google-labs-jules[bot]andPR0M3TH3AN c6cb9e6785 docs: update KNOWN_ISSUES.md and triage environment issues
- Update KNOWN_ISSUES.md to reflect current environment status (missing devDependencies).
- Create issues/test-env-deps.md to document missing dependencies preventing test runs.
- Create issues/popover-flip-bug.md to document the persistent popover flip bug.
- Update timestamps and references in KNOWN_ISSUES.md.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 18:19:33 +00:00
google-labs-jules[bot]andPR0M3TH3AN c7ac9f03f2 docs: add Subscription Backup to event schema catalogue
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 16:57:43 +00:00
google-labs-jules[bot]andPR0M3TH3AN 7c1f3c9ada perf: Optimize chronological sorter hook resolution
Hoisted the timestamp hook resolution out of the inner loop in `createChronologicalSorter`.
This avoids allocating an array of candidate functions for every comparison during sorting (O(N log N)).
Benchmark shows a ~27% speedup (38ms -> 27ms for 100k items).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 16:55:27 +00:00
thePR0M3TH3AN ec50db8645 Merge pull request #2243 from PR0M3TH3AN/refactor-application-monolith-3243348981324014635
Refactor Application class into Router and UI Coordinators
2026-02-08 10:57:44 -05:00
thePR0M3TH3AN 0ae727e97b Merge pull request #2244 from PR0M3TH3AN/refactor/nip46-connector-12138390981153838002
Refactor NIP-46 connection logic into Nip46Connector helper
2026-02-08 10:57:19 -05:00
thePR0M3TH3AN 6f765cc647 Merge pull request #2240 from PR0M3TH3AN/refactor-revert-video-2176939372137755635
🧹 Refactor revertVideo to use helper function
2026-02-08 10:56:57 -05:00
thePR0M3TH3AN eaa55c9a22 Merge pull request #2239 from PR0M3TH3AN/auth-service-refactor-485832951651761248
🧹 Refactor loadOwnProfile logic in AuthService
2026-02-08 10:56:31 -05:00
thePR0M3TH3AN 6fcb18349b Merge pull request #2245 from PR0M3TH3AN/test/hex-utils-coverage-3841884006452707287
🧪 Add tests for hex utils
2026-02-08 10:55:13 -05:00
thePR0M3TH3AN 1bf2c06022 Merge pull request #2235 from PR0M3TH3AN/refactor-app-init-2313962746277118562
🧹 Refactor Application.init into initialization phases
2026-02-08 10:49:35 -05:00
google-labs-jules[bot]andPR0M3TH3AN 75c21c83dd chore(ai): doc js/services/moderationService.js (agent)
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 15:06:35 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0f04245440 chore(ai): event schema validation tool + fixes
- Created `scripts/agent/validate-events.mjs` to validate event builders against schemas, covering standard and specific usage patterns.
- Updated `js/nostrEventSchemas.js` to include NIP-17 event types (`GIFT_WRAP`, `SEAL`, `CHAT_MESSAGE`) and their builders.
- Refactored `js/nostr/client.js` to use NIP-17 builders in `sendDirectMessage`, enabling runtime schema validation.
- Updated `docs/nostr-event-schemas.md` to document the new event types.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 05:09:54 +00:00
google-labs-jules[bot]andPR0M3TH3AN 01f9f61010 test: add unit tests for hex utils
- Added `tests/utils/hex.test.mjs`
- Covered `normalizeHexString` with various input types
- Covered `HEX64_REGEX` with valid and invalid cases
- Verified aliases `normalizeHexId` and `normalizeHexPubkey`

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 04:20:48 +00:00
google-labs-jules[bot]andPR0M3TH3AN ca7fb02171 Refactor NIP-46 connection logic into Nip46Connector helper
- Extract handshake and connection logic to js/nostr/nip46Connector.js
- Delegate NIP-46 operations in NostrClient to the new connector
- Add unit tests for Nip46Connector with dependency injection support

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:58:39 +00:00
thePR0M3TH3AN 900e58714f Merge pull request #2238 from PR0M3TH3AN/perf/kids-scoring-allocation-15408833110746768753
⚡ Optimize object allocation in kids scoring loop
2026-02-07 22:58:00 -05:00
thePR0M3TH3AN 648443f1b7 Merge pull request #2233 from PR0M3TH3AN/test-profile-media-sanitization-13997846489115155630
🧪 Add tests for sanitizeProfileMediaUrl and fix edge cases
2026-02-07 22:57:43 -05:00
thePR0M3TH3AN 2a1443d560 Merge pull request #2232 from PR0M3TH3AN/test-improvement-validate-config-261762045049538306
test: add comprehensive tests for config validation
2026-02-07 22:57:25 -05:00
thePR0M3TH3AN 7c1f247d0e Merge pull request #2236 from PR0M3TH3AN/refactor-app-loadview-5332920943685041227
🧹 Simplify loadView assignment in Application constructor
2026-02-07 22:57:02 -05:00
thePR0M3TH3AN 9c4c02717e Merge pull request #2230 from PR0M3TH3AN/chore/refactor-fetchVideos-5572786315509686162
Refactor deprecated fetchVideos method
2026-02-07 22:56:36 -05:00
google-labs-jules[bot]andPR0M3TH3AN 44e9f42ac0 Refactor Application class into smaller coordinators
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:51:43 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0665a3392e refactor(app): Move heavy initialization from constructor to setup()
- Introduces a `setup()` method in `Application` class to handle complex initialization and side effects.
- Updates `constructor` to be lightweight, only storing configuration options.
- Updates `js/bootstrap.js`, `js/embed.js`, and relevant tests to call `app.setup()` explicitly after instantiation.
- Resolves "Heavy Constructor" code health issue.
- Fixes `tests/video-modal-zap.test.mjs` environment issue with `globalThis.navigator`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:44:38 +00:00
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
google-labs-jules[bot]andPR0M3TH3AN dcb8424535 Refactor loadOwnProfile to use Promise.race and clean up relay fetching logic.
Extracts `fetchProfileFromRelay` helper method in `AuthService` to encapsulate timeout logic and event validation. This simplifies `loadOwnProfile` and makes it more readable and maintainable.

Also adds comprehensive tests for `loadOwnProfile` in `tests/auth-service.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:42:50 +00:00
google-labs-jules[bot]andPR0M3TH3AN 96dea42692 Optimize object allocation in kids scoring loop
- Replaced array allocation and loop with unrolled scalar comparisons in `kidsScorerStage`.
- Added unit tests and benchmark.
- Measured ~12% performance improvement (282ms -> 249ms for 200k items).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:41:50 +00:00
google-labs-jules[bot]andPR0M3TH3AN 03f4efbfeb refactor(dm-db): use singleton IndexedDB connection to avoid N+1 overhead
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:41:19 +00:00
google-labs-jules[bot]andPR0M3TH3AN 6c31434a36 Refactor Application constructor to simplify loadView assignment
Replaced the explicit `typeof` check for `viewLoader` with a simpler assignment using the logical OR operator (`|| null`). This removes excessive defensive coding while preserving the behavior of defaulting to `null` when the argument is undefined or falsy.

Verified with a reproduction test case that confirms `loadView` is correctly assigned or defaulted to `null`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:41:17 +00:00
thePR0M3TH3AN 84fc1c71a4 Merge pull request #2231 from PR0M3TH3AN/jules-fix-verbose-dev-mode-2268472334484590253
🔒 Ensure verbose dev logging is disabled in production
2026-02-07 22:41:15 -05:00
google-labs-jules[bot]andPR0M3TH3AN fa7a2997e8 Refactor Application.init into initialization phases
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:40:49 +00:00
google-labs-jules[bot]andPR0M3TH3AN d5e86ee5eb feat(security): ensure IS_DEV_MODE is false and add regression test
- Added `tests/unit/security-config.test.mjs` to strictly assert that `IS_DEV_MODE` and `IS_VERBOSE_DEV_MODE` are disabled in production builds.
- Verified that `config/instance-config.js` is correctly set to `false`.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:39:41 +00:00
google-labs-jules[bot]andPR0M3TH3AN 5fb7299850 test: add unit tests for sanitizeProfileMediaUrl and fix bugs
- Add `tests/utils/profileMedia.test.mjs` with comprehensive test cases.
- Fix `sanitizeProfileMediaUrl` to correctly trim whitespace after removing quotes.
- Fix `sanitizeProfileMediaUrl` to correctly detect and normalize `ipfs/` paths (without protocol).

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:36:59 +00:00
google-labs-jules[bot]andPR0M3TH3AN 0281968867 test: add comprehensive tests for config validation
Adds missing test cases to `tests/validate-config.test.mjs` to cover edge cases for:
- `ADMIN_SUPER_NPUB` (empty, invalid format)
- `PLATFORM_FEE_PERCENT` (negative, >100, infinite)
- `THEME_ACCENT_OVERRIDES` (invalid hex, invalid structure)
- Optional URLs (invalid URL, invalid protocol)

This ensures `validateInstanceConfig` correctly enforces configuration constraints.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:34:20 +00:00
google-labs-jules[bot]andPR0M3TH3AN dd4b0df89b Ensure IS_VERBOSE_DEV_MODE is disabled in production config
- Add explicit security comment to config/instance-config.js
- Add regression test to verify IS_VERBOSE_DEV_MODE is false
- Verify IS_DEV_MODE is false

Note: The configuration file was found to be already set to `false` in the environment. This change enforces the policy.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:23:18 +00:00
google-labs-jules[bot]andPR0M3TH3AN 911c030437 chore: refactor fetchVideos to use subscribeVideos
Replaced the deprecated `fetchVideos` implementation with a wrapper around the newer `subscribeVideos` method. This reduces code duplication and ensures consistent behavior for video fetching logic. The wrapper maintains the original Promise-based API and ensures NIP-71 metadata is populated before resolving.

Added tests in `tests/nostr/client.test.mjs` to verify `fetchVideos` behavior.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-08 03:22:50 +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
Claude 79c5814432 Fix slow Nostr login: unblock NIP-04 decryption, fix signer readiness, storage tab, and watch-history feed
Four issues caused login to be extremely slow and lists to fail syncing:

1. Subscription list decryption excluded NIP-04 when NIP-44 was available,
   preventing decryption of NIP-04-encrypted lists entirely. Removed the
   allowNip04 gate so NIP-04 is always a fallback (matching userBlocks.js
   and hashtagPreferencesService.js which already worked correctly).

2. When the NIP-07 extension permission pre-grant failed (common on page
   refresh when the extension injects slowly), all list services were called
   with allowPermissionPrompt:false and could never recover. Now list
   services are allowed to prompt for permissions themselves when the
   pre-grant fails, avoiding 6-10 second retry delays.

3. The profile modal storage tab was never refreshed on login or logout,
   so it stayed locked even after authentication succeeded. Added
   populateStoragePane() calls to handleAuthLogin and handleAuthLogout.

4. The watch-history feed engine.run() call was missing await, so rejected
   promises from unregistered feeds escaped the try/catch and propagated
   as unhandled errors instead of falling through to the service fallback.

https://claude.ai/code/session_013puYzbf1cC7a59HLcGQUdJ
2026-02-08 02:47:30 +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