Commit 13299cf
Stage (#9459)
* chore: increase GitHub actions timeout to 300
* fix(theme): resolve tabler icons module configuration
* fix(theme): resolve tabler icons module configuration
* fix: swagger
* fix: Tabler Icon Module import
* Merge pull request #9456 from ever-co/fix/sharper-tray-icon
Fix/sharper tray icon
* fix: add secondary lib entry point for icons
* Apply suggestion from @greptile-apps[bot]
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* Apply suggestion from @greptile-apps[bot]
* [Feat] Windows data sync (#9454)
* Expose internal storage engines and logger utilities
│ Files: packages/desktop-core/src/index.ts
│ Rationale: Reorganizes and expands the public API of the core package to provide necessary Akita storage engines and helper types to dependent packages.
* Enhance ElectronService with Observable-based IPC and export storage services
│ Files: packages/desktop-ui-lib/src/lib/electron/services/electron/electron.service.ts, packages/desktop-ui-lib/src/lib/services/index.ts
│ Rationale: Adds robust IPC invocation and event listening capabilities using Observables and NgZone, providing the necessary frontend infrastructure for synchronized storage.
* feat: Implement Akita storage IPC handler and perform code cleanup
│ Files: packages/desktop-lib/src/lib/desktop-ipc.ts
│ Rationale: Adds the AkitaStorageHandler to manage IPC communication for state persistence. Includes formatting improvements and improved cleanup logic for power management handlers.
* feat: Initialize Akita storage handler in the desktop main process
│ Files: apps/desktop-timer/src/index.ts
│ Rationale: Wires up the main process storage handler during the app is ready state and performs minor cleanup of imports and formatting.
* feat: Configure Akita state persistence using GauzyStorageService in the renderer
│ Files: apps/desktop-timer/src/main.ts
│ Rationale: Migrates the application bootstrap process to use the custom GauzyStorageService within a provideAppInitializer, ensuring state is persisted via the new IPC-based mechanism.
* feat(desktop): implement akita storage engine and ipc handlers
Introduce a persistent storage solution for Akita in the desktop
application. This implementation includes:
- A core AkitaStorageEngine leveraging electron-store for data
persistence.
- IPC handlers in the main process to bridge storage operations between
processes.
- An Angular GauzyStorageService to provide a clean interface for the UI
to interact with the storage engine via Electron IPC.
* refactor: migrate akita state persistence to gauzystorageservice
Move Akita's `persistState` and `akitaConfig` from top-level execution
to `provideAppInitializer` during the application bootstrap process.
This allows the use of `GauzyStorageService` through Angular's
dependency injection and enables `enableInNonBrowser: true` to ensure
state persistence works correctly across different environments.
* feat(desktop): initialize akita storage handler
Initialize the setupAkitaStorageHandler in the agent, desktop, server,
and server-api applications. This ensures that Akita state management
is correctly synchronized and handled via IPC communication across all
electron-based components.
* refactor(desktop-ui-lib): add missing await and types to storage service
Update GauzyStorageService methods to properly await electron service
invocations and include explicit Promise return types for improved
type safety.
* refactor(desktop-ui-lib): make electronService private in GauzyStorageService
Change the visibility of the injected ElectronService from public to
private to improve encapsulation within the GauzyStorageService.
* fix(akita-storage): update default store name to 'window-state'
* fix(electron-service): enhance API availability checks for Electron and ContextBridge
* refactor(store.service): update state interfaces to use nullable types and improve initial state creation
* refactor(language): ensure preferredLanguage is typed correctly
* refactor(auth): enhance token validation and expand auth endpoints
Implement robust JWT validation within the authentication strategy to
ensure tokens received from refresh operations are well-formed and
contain valid claims. This includes checks for expiration, issued-at,
and not-before times using a 60-second clock skew buffer.
Expand the list of authentication endpoints to include various sign-in
and logout paths, ensuring they are excluded from automatic refresh
logic to prevent potential infinite loops. Refine token expiry logic in
the store to better handle missing or invalid expiry data by providing
sane defaults and improved logging.
* feat(auth): implement circuit breaker and improve token refresh synchronization
Introduce a circuit breaker in the proactive refresh service to prevent
infinite retry loops after multiple consecutive failures. The breaker
automatically attempts recovery after a cooldown period.
Improve synchronization across the authentication stack:
- Replace ReplaySubject with a tracked Subject in RefreshStateManager
using unique refresh IDs to ensure requests only resolve with the
result of the specific refresh cycle they joined.
- Add an atomic execution lock in SessionExpiredHandler to prevent race
conditions when multiple concurrent requests return 401 status codes.
- Ensure RefreshStateManager state is explicitly reset during logout
flows to clear pending operations.
- Standardize error handling and state notification in the refresh
executor to prevent stalled request queues.
* refactor(auth): simplify guards and improve offline mode support
Simplify AuthGuard and NoAuthGuard by removing the AuthService dependency
and relying on stored state (token and userId). This makes guards more
lightweight and delegates token validation and refresh responsibilities
to HTTP interceptors.
Improve offline support by allowing authenticated users to access routes
when the server is unreachable. Clean up redirection logic and remove
redundant logout calls from within the guard components.
* refactor(routing): reorganize application routes and update guard logic
Reorganize routes into logical sections (Public, Auth, Protected, and
Utility) to improve maintainability and clarity. Update route guards to
consistently enforce authentication across internal pages and utility
components.
Key changes include:
- Replace deprecated AppModuleGuard with specific Auth/NoAuth guards
- Add AuthGuard to utility routes (updater, viewer, etc.)
- Clarify guard execution order via documentation
- Group public routes like splash-screen and server-down together
* refactor(auth): centralize authentication data storage and enhance security
- Extract authentication data storage logic into reusable `storeAuthenticationData()` method
- Make `setTokenExpiry()` public to allow reuse across login components
- Add `validateEmployeeUser()` public method to ensure user has employee record
- Implement employee validation in offline login flow with proper error handling
- Schedule electron authentication callback with 3-second delay using asyncScheduler
- Pass full auth response to electron authentication instead of individual parameters
- Update magic login component to use router state instead of query params for sensitive code
- Improve code formatting and documentation in login components
- Enhance security by preventing authentication codes from appearing in browser history
* refactor(desktop-timer): remove unused AppModuleGuard import
- Remove unused AppModuleGuard import from app-routing.module.ts
- Simplify routing module dependencies and reduce unnecessary imports
- Clean up module structure for better maintainability
* refactor(server-down): enhance navigation and capture redirect URL
- Add ActivatedRoute import to access query parameters
- Capture original URL from query parameters on component initialization
- Update navigation logic to redirect to original URL when server connection restored
- Replace router.navigate with router.navigateByUrl for proper URL handling
- Fix component decorator indentation to use tabs consistently
- Add redirectUrl property to store the original navigation target
- Improve logging to track server connection restoration and navigation flow
* refactor(auth): enhance token management and improve offline access handling
* refactor(auth.guard): update stored auth check logic to allow access with userId
* refactor(auth): convert class-based guards to functional guards
Migrate AuthGuard, NoAuthGuard, and AuthConnectionGuard from class-based implementations to functional guards using the Angular inject function. This aligns with modern Angular best practices and simplifies the routing configuration.
Additional changes:
- Update app routing to use the new functional guards.
- Refactor tray icon initialization to use TrayIconFactory.
- Clean up redundant guard providers and initializers in main.ts.
- Update recap routing to utilize lazy-loaded child routes.
* refactor(screen-capture): clean up imports and streamline code formatting
* fix(auth): improve electron authentication flow and user validation
Refactor the authentication process to use RxJS observables instead of
manual delays when communicating with the Electron main process. This
ensures more reliable state synchronization between the UI and the
backend.
Additional changes:
- Add stricter validation for user records, including remote ID and
employee status checks.
- Update the IPC event listener from 'auth_success_tray_init' to
'timer_tracker_show'.
- Implement defensive null checks in the user service retrieval logic.
* refactor(desktop-lib): modularize tray icon using design patterns
The monolithic TrayIcon class in desktop-tray.ts has been refactored into a more maintainable structure using several design patterns:
- Strategy Pattern: for switching between authenticated and unauthenticated menu states.
- Command Pattern: to encapsulate tray menu actions.
- Observer Pattern: to handle language changes without recreating the tray.
- Adapter Pattern: to decouple the tray logic from core services.
- Builder Pattern: for fluent menu item construction.
This restructuring improves testability and separates IPC handling, menu management, and authentication logic into dedicated classes.
* feat(auth): enhance connection guard and refactor login flow
Update `authConnectionGuard` to verify server connectivity via
`ServerConnectionService` before allowing access. Refactor
`AuthStrategy` and workspace login to utilize RxJS `switchMap` for
better handling of asynchronous authentication processes, removing
manual delays and improving code consistency.
* refactor(auth): improve reactive state management and auth flow
Convert authentication guards, interceptors, and services to use RxJS
observable streams instead of synchronous property checks. This ensures
that auth state is correctly evaluated after Akita state persistence
has initialized.
Changes include:
- Update auth and no-auth guards to return Observables.
- Integrate Akita persistence initialization checks in guards.
- Refactor server ping logic using RxJS operators for better reliability.
- Clean up logout and IPC handling logic in the desktop library.
- Introduce a shared `isAuthenticated$` stream in the store service.
- Update token refresh logic to be fully reactive.
* refactor(desktop): migrate to functional guards and TrayIconFactory
Update routing configuration to use the functional authConnectionGuard and ensure the time-tracker route is protected. Refactor the desktop tray icon creation to use TrayIconFactory for better abstraction and remove unused guard providers from the application bootstrap.
* refactor(routing): replace AppModuleGuard with noAuthGuard and update route guards
* refactor(tray): update tray icon creation to use variable assignment
* refactor(magic-login): remove unused Store import and clean up constructor
* refactor(auth-connection.guard): update access condition to use logical OR for connection state
* refactor(auth-ipc-handler): improve type annotations and clean up logging
* refactor(app.component): ensure proper cleanup of subscriptions with untilDestroyed
* refactor: improve setting window initialization and event handling
* refactor(start-timer-command): enhance execute method for better window handling
* refactor(auth): streamline authentication success logging and improve error handling in command execution
* fix(auth.guard): correct typo in isAuthenticated variable name
* refactor(login): enhance change detection strategy and streamline imports across components
* refactor(desktop-ui-lib): update screen capture component to use observables
Switch the component to OnPush change detection and replace manual IPC
listeners with observable streams. Implement proper subscription
cleanup using untilDestroyed and remove the unused NgZone dependency.
* refactor(tray): improve handling of time tracker window in logout and tray interactions
* fix(tray): improve menu command execution and auth flow
- Properly await command execution in the tray menu item builder.
- Ensure the timer window is visible when attempting to start the timer
via the tray while unauthenticated.
- Delay auth IPC handler setup until tray icon initialization.
- Add safety checks to the login response and remove the strict refresh
token requirement during token refresh.
- Remove an unused auth variable in the desktop-timer entry point.
* refactor: update TablerIconsModule import path across multiple files
* Update unauthenticated-menu-strategy.ts
* Update packages/desktop-lib/src/lib/tray/strategies/authenticated-menu-strategy.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Update packages/desktop-lib/src/lib/tray/observer/language-subject.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
---------
Co-authored-by: Ruslan Konviser <evereq@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
---------
Co-authored-by: Rahul R. <rahulrathore576@gmail.com>
Co-authored-by: Rahul R. <41804588+rahul-rocket@users.noreply.github.com>
Co-authored-by: syns2191 <sutralian@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Kifungo A <45813955+adkif@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>File tree
150 files changed
+5336
-4081
lines changed- .github/workflows
- apps
- agent/src
- app
- desktop-timer/src
- app
- preload
- desktop/src
- app
- server-api/src
- server/src
- packages
- core/src/lib/bootstrap
- desktop-core/src
- lib/store/akita
- desktop-lib/src/lib
- offline/services
- storage
- tray
- adapters
- auth
- builders
- commands
- handlers
- managers
- observer
- states
- strategies
- desktop-ui-lib/src/lib
- agent-dashboard
- always-on
- auth
- services
- constants
- electron/services/electron
- image-viewer
- interceptors
- language
- login
- features
- login-magic
- login-workspace
- magic-login-workspace
- recap
- screen-capture
- server-down
- services
- settings/plugins
- setup
- time-tracker
- ui-core
- icons
- src
- lib
- theme/src
- lib
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
150 files changed
+5336
-4081
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
0 commit comments