Commit Graph

12 Commits

Author SHA1 Message Date
natreex
9e51cc93a8 Remove SyncService and introduce context-based offline mode and state management
- Delete `SyncService` and its associated bidirectional synchronization logic.
- Add multiple context providers (`OfflineProvider`, `AlertProvider`, `LangContext`, `UserContext`, `SessionContext`, `WorldContext`, `SettingBookContext`) for contextual state management.
- Implement `SecureStorage` for OS-level secure data encryption and replace dependency on `SyncService` synchronization.
- Update localization files (`en.json`, `fr.json`) with offline mode and error-related strings.
2025-11-19 22:01:24 -05:00
natreex
f85c2d2269 Add offline mode support with PIN configuration and management
- Introduce `OfflinePinSetup` component for users to configure secure offline access.
- Add new `AIUsageContext` and extend `OfflineProvider` for offline-related state management.
- Implement offline login functionality in `electron/main.ts` with PIN verification and fallback support.
- Enhance IPC handlers to manage offline mode data, PIN setup, and synchronization.
- Update localization files (`en.json`, `fr.json`) with offline mode and PIN-related strings.
- Add `bcrypt` and `@types/bcrypt` dependencies for secure PIN hashing and validation.
- Refactor login and session management to handle offline mode scenarios with improved error handling and flow.
2025-11-19 19:58:55 -05:00
natreex
dde4683c38 Migrate from electron-store to OS-level secure storage (getSecureStorage)
- Replace `electron-store` with OS-level encrypted storage for secure token, userId, and language management in `LocalSystem` and `keyManager`.
- Add `init-user` IPC handler to initialize user data and manage encryption keys.
- Update login process to handle encrypted storage saving with fallback for macOS issues.
- Add offline warning component to `login/page.tsx` to handle first-time sync requirements.
- Remove `electron-store` and associated dependencies from `package.json` and `package-lock.json`.
2025-11-19 19:10:12 -05:00
natreex
b56f45d1ba Add ipc/character.ipc.ts and ipc/location.ipc.ts for character and location database interactions
- Introduce IPC handlers in `ipc/character.ipc.ts` and `ipc/location.ipc.ts` for CRUD operations, attributes management, and related actions.
- Register character and location IPC modules in `main.ts` for global accessibility.
- Utilize `createHandler` pattern for consistent and modular IPC handler implementation.
- Enhance type definitions for character and location functionalities, improving code consistency.
2025-11-18 22:47:20 -05:00
natreex
75e5d71c74 Add ipc/chapter.ipc.ts to handle chapter-related database interactions
- Introduce IPC handlers in `ipc/chapter.ipc.ts` for chapter CRUD, content management, and related operations.
- Register chapter IPC module in `main.ts` for application-wide access.
- Enhance type definitions for chapter functionalities, improving code consistency.
- Refactor `ipc/book.ipc.ts` to include new `UpdateStoryData` interface and additional story update handler.
2025-11-18 22:42:18 -05:00
natreex
0bafaadecc Add user data synchronization and database IPC handlers
- Introduce `db:user:sync` to synchronize user data with the local database during initialization.
- Add `db:user:info` and `db:user:update` IPC handlers for fetching and updating user information.
- Update `User` model and repository to support extended user fields and improved structure.
- Dynamically import user models in main process to avoid circular dependencies.
- Refactor database initialization in the app to include user sync logic with error handling.
2025-11-18 22:17:22 -05:00
natreex
004008cc13 Refactor imports, streamline database IPC handlers, and improve offline support
- Replace absolute import paths with relative paths for consistency across files.
- Transition database operations in Electron main process to modular handlers in `ipc/book.ipc.ts` using the `createHandler` pattern.
- Update database sync service to use `window.electron.invoke()` for improved reliability and structure.
- Refactor `AddNewBookForm` to handle both online and offline book creation seamlessly.
2025-11-18 21:28:41 -05:00
natreex
d018e75be4 Remove DataService and OfflineDataService, refactor book and character operations to use streamlined handlers in LocalSystem
- Delete `data.service.ts` and `offline-data.service.ts`, consolidating functionality into `LocalSystem`.
- Refactor book, character, and conversation operations to adopt unified, multilingual, and session-enabled IPC handlers in `LocalSystem`.
- Simplify redundant legacy methods, enhancing maintainability and consistency.
2025-11-18 21:02:38 -05:00
natreex
d46aecc80d Integrate session management, multilingual IPC handlers, and Book database operations
- Add `LocalSystem` with handlers for session retrieval (`userId`, `lang`) and error handling.
- Extend IPC handlers to support multilingual operations (`fr`, `en`) and session data injection
2025-11-18 19:51:17 -05:00
natreex
71067c6fa8 Integrate local database management and IPC handlers into Electron
- Add comprehensive IPC handlers for database operations like books, chapters, characters, and conversations.
- Implement local database initialization and user data encryption.
- Update preload script paths for consistent environment handling.
- Modify `page.tsx` to initialize local database within Electron environment.
- Add new dependencies including `node-sqlite3-wasm` and `electron-rebuild`.
2025-11-17 07:46:20 -05:00
natreex
a1fcca45cb Update Electron main process for production readiness and app protocol handling
- Register `app://` protocol for secure file handling in production.
- Adjust icon paths to support macOS and Windows/Linux distinctions.
- Enhance security by validating file paths under the `out/` directory.
- Replace `file://` accesses with the `app://` protocol.
- Update `package.json` build scripts for platform-specific builds and refined output directory structure.
- Modify main and login window settings for improved compatibility across all platforms.
2025-11-16 19:18:17 -05:00
natreex
de03dedaf0 Add Electron main process with token management and navigation setup
- Implement main and login windows for Electron.
- Integrate `electron-store` for secure token storage and management.
- Setup IPC handlers for authentication.
- Update dependencies to support Electron, including `vite`, `react-router-dom`, and plugins.
2025-11-16 13:55:08 -05:00