Commit Graph
38 Commits
Author SHA1 Message Date
google-labs-jules[bot]andPR0M3TH3AN 69c1528ac0 perf: bound concurrency in authService profile hydration
Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-12 16:32:53 +00:00
google-labs-jules[bot]andPR0M3TH3AN f148653c39 Refactor AuthService login logic
Extracted complex logic from `AuthService.login` into private helper methods (`_validateAndNormalizeLoginInputs`, `_checkAccessControl`, `_updateGlobalState`, `_updateSavedProfiles`, `_initiatePostLogin`) to improve readability and maintainability.

Moved `SimpleEventEmitter` to `js/utils/simpleEventEmitter.js` and auth constants/normalization helpers to `js/services/authUtils.js` to reduce file size and coupling.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-10 13:53:10 +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
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 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 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 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
Claude 8a335c2ec8 Fix slow Nostr list sync by decoupling from profile and awaiting before feed render
The login-to-feed pipeline had several issues causing lists (blocks,
subscriptions, hashtag preferences) to load too slowly or not reflect
in the feed:

1. All list loading was chained after profileStatePromise, adding
   2.5-6s of unnecessary delay. Lists only need relay URLs, not profile
   data. Now they chain off relaysReadyPromise instead, loading in
   parallel with profile fetching.

2. The video grid refreshed immediately without waiting for any lists,
   so the feed briefly displayed unfiltered content. Now the grid refresh
   waits (up to 8s) for critical feed-filtering lists to settle.

3. Hashtag preferences weren't cached into the snapshot before the feed
   rendered, so interests/disinterests were empty on first paint.

4. Subscription ensureLoaded had a 6s timeout that was too aggressive
   for relay fetch (12s) + decryption (3-12s), causing silent failures.
   Increased to 30s.

5. Subscription relay fetches for user and session actor ran sequentially.
   Now they run in parallel via Promise.all.

https://claude.ai/code/session_01UKmTWb83AnQPRVQo3bKZqm
2026-02-05 23:55:50 +00:00
thePR0M3TH3AN 7ef420e1e2 Defer block list permission prompts during login 2026-01-30 15:53:57 -05:00
google-labs-jules[bot]andPR0M3TH3AN fdc070479b Optimize post-login sequence to load relays before other data
Prioritizes fetching the user's relay list (NIP-65) immediately after login, ensuring that subsequent data fetches (profile, contact list, DMs, feed) utilize the user's preferred relays instead of default ones. This prevents "slow" or incomplete data loading issues caused by relying on defaults.

- Refactored `authService.applyPostLoginState` to sequence relay loading before profile/block loading.
- Refactored `app.handleAuthLogin` to await relay loading before initiating dependent fetches (Hashtags, Moderation, DMs, NWC, Lists, Feed).
- Updated unit tests in `tests/auth-service.test.mjs` to verify sequential execution and correct return values.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-30 16:34:12 +00:00
thePR0M3TH3AN 1642b787ec Reset caches on logout 2026-01-29 15:54:44 -05:00
thePR0M3TH3AN aad2fe465a Tier login hydration and trim DM fetch 2026-01-29 15:43:34 -05:00
thePR0M3TH3AN 89b8d124fa Consolidate profile metadata fetches 2026-01-29 15:25:08 -05:00
thePR0M3TH3AN 95dc380f54 Emit post-login hydration events 2026-01-29 12:40:50 -05:00
google-labs-jules[bot]andPR0M3TH3AN 3c7a396da9 refactor(auth): decouple NIP-07 logic and optimize list fetching (agent)
- Moved NIP-07 extension detection and permission logic from `NostrClient` to `nip07` provider.
- Removed redundant `login` method from `NostrClient`.
- Increased concurrency and added timeouts to `fetchListIncrementally` to prevent hanging on slow relays.
- Updated `UserBlocks` to force full fetch on cache miss, fixing "empty list" issues.
- Updated unit tests for login permissions and hashtag preferences to reflect architectural changes.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-01-26 21:48:52 +00:00
google-labs-jules[bot] a2de2b550d Fix hashtag preferences loading and profile persistence issues
- Migrated Kind 0 profile metadata storage to unified `profileCache.js` with partitioning and persistence.
- Added `defaultDTag` for hashtag preferences in `cachePolicies.js` to ensure consistent key resolution.
- Updated `hashtagPreferencesService.js` to use `profileCache` and implemented legacy data migration.
- Added `handleEvent` to `NostrClient` to centrally ingest Kind 0 events into the cache.
- Updated `authService.js` and `cache.js` to delegate profile operations to the unified cache system.
- Added `PROFILE_METADATA` schema to `nostrEventSchemas.js`.
2026-01-18 02:09:04 +00:00
google-labs-jules[bot] 926e6ebf39 Refactor user-specific lists to use centralized profileCache 2026-01-17 20:47:27 +00:00
thePR0M3TH3AN b5d2d04401 Add access control check to login 2026-01-15 14:31:51 -05:00
thePR0M3TH3AN 34789d4752 Reset moderation settings on logout 2026-01-02 12:50:18 -05:00
thePR0M3TH3AN 5536180682 refactor: centralize nostr client bootstrap 2025-10-22 21:09:18 -04:00
thePR0M3TH3AN 75ea73b178 Refactor Nostr client imports 2025-10-22 20:55:54 -04:00
thePR0M3TH3AN 6d84d6be4e feat: show provider metadata in saved profiles 2025-10-21 14:44:14 -04:00
thePR0M3TH3AN ea45488ee4 Handle custom auth providers in saved profiles 2025-10-21 13:56:38 -04:00
thePR0M3TH3AN 62d411e3ff Refactor auth service to use provider registry 2025-10-21 13:41:57 -04:00
thePR0M3TH3AN bae9b29f49 Enforce lockdown restrictions on login 2025-10-20 15:38:29 -04:00
thePR0M3TH3AN 9827e330e9 Respect explicit logout when hydrating saved profiles 2025-10-19 18:52:56 -04:00
thePR0M3TH3AN deffbf7670 Ensure NIP-07 permissions are granted before signing and encrypting 2025-10-15 22:36:57 -04:00
thePR0M3TH3AN 0a2a2c4e78 Fix syntax errors blocking app bootstrap 2025-10-15 15:08:55 -04:00
thePR0M3TH3AN 7ae07b1369 refactor: migrate console usage to shared loggers 2025-10-15 14:37:25 -04:00
thePR0M3TH3AN d705cf176b Revert "Refactor logging to centralized logger" 2025-10-15 11:14:10 -04:00
thePR0M3TH3AN 37ba57aa37 Refactor logging to centralized logger 2025-10-15 11:11:14 -04:00
thePR0M3TH3AN 77fa149cc3 Speed up profile and relay fetches 2025-10-09 18:55:18 -04:00
thePR0M3TH3AN 12b1c1e7f8 Refine profile switching login flow 2025-10-09 18:41:27 -04:00
thePR0M3TH3AN 0a3057d081 Defer post-login hydration to async follow-up 2025-10-09 16:37:23 -04:00
thePR0M3TH3AN 599c40c3cc Refactor post-login state loading and add tests 2025-10-09 13:27:45 -04:00
thePR0M3TH3AN ad0713b4cb Fix video modal stacking and playback readiness 2025-10-07 21:51:12 -04:00
thePR0M3TH3AN 3bf380dfc6 Ensure login UI updates after NIP-07 approval 2025-10-07 15:59:43 -04:00
thePR0M3TH3AN 3d04c90ddc refactor: introduce auth service 2025-10-03 12:39:17 -04:00