Commit Graph

27 Commits

Author SHA1 Message Date
natreex
5cceceaea9 Refactor SecureStorage for stricter typings, enhanced error handling, and cleanup
- Add explicit type annotations for improved code clarity and type safety.
- Refactor encryption/decryption logic with stricter validations and error handling.
- Remove redundant `appReady` logic and unused comments.
- Convert instance methods to `public` for consistent access modifiers.
- Streamline `saveToDisk` to ensure robust encryption and error reporting.
2025-11-25 11:50:11 -05:00
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
71d13e2b12 Refactor IPC handlers to enforce consistent return types and enhance type definitions
- Update return types for IPC handlers in `character.ipc.ts`, `chapter.ipc.ts`, and `location.ipc.ts` for stricter type safety.
- Introduce new type definitions for better structure and clarity.
- Remove redundant console logs and unnecessary comments for cleaner code.
2025-11-18 23:01:52 -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
361a1b0b7c Refactor ipc/book.ipc.ts for streamlined IPC handlers and additional type definitions
- Reorganize and reformat IPC handlers for improved readability and structure.
- Add missing type definitions for `StoryData`, `AddWorldElementData`, `SetAIGuideLineData`, and others.
- Simplify handler functions by enforcing consistent parameter usage and return types.
- Remove outdated comments, redundant logic, and placeholder TODOs.
2025-11-18 22:26:59 -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
5a891a72ff Add Book model with interfaces, utilities, and database integration
- Implement `Book` class to manage book-related operations, including CRUD functionality, cover image handling, and metadata management.
- Add interfaces for `BookProps`, `GuideLine`, `Act`, and other related structures.
- Integrate support for encryption and decryption of sensitive data.
- Include multilingual support (`fr` and `en`) for error messages and content handling.
- Establish connection with `book.repository` and other repositories for streamlined database operations.
2025-11-17 21:50:36 -05:00
natreex
3bc30d42ad Remove Story model handling verbal styles and linguistic properties
- Delete `Story` model implementation including `getVerbesStyle` method and related properties.
- Cleanup unused interfaces and redundant logic from the codebase.
2025-11-17 21:32:42 -05:00
natreex
baa45ac106 Add Content, Model, and Story models with text processing and AI model configuration utilities
- Implement `Content` model for converting Tiptap raw data into HTML and plain text.
- Add `Model` for storing and managing AI model configurations with pricing and metadata.
- Introduce `Story` model to handle verbal styles and linguistic properties for diverse narrative structures.
- Update `book.repository.ts` to refine `updateBookBasicInformation` and `insertNewPlotPoint` methods, removing unused parameters and optimizing queries.
2025-11-17 20:14:22 -05:00
natreex
4cd4f68d1a Add repository classes for character, location, and user data management
- Implement `CharacterRepo`, `LocationRepo`, and `UserRepo` for managing character, location, and user data with SQLite.
- Add methods for performing CRUD operations on characters, locations, and users, including attributes and metadata handling.
- Integrate error handling with multilingual support (`fr` and `en`).
- Support data encryption and synchronization using the existing database utilities.
2025-11-17 19:57:36 -05:00
natreex
a8693973e0 Remove all database mappers and README file 2025-11-17 19:36:38 -05:00
natreex
d5eb1691d9 Add database schema, encryption utilities, and local database service
- Implement `schema.ts` for SQLite schema creation, indexing, and sync metadata initialization.
- Develop `encryption.ts` with AES-256-GCM encryption utilities for securing database data.
- Add `database.service.ts` to manage CRUD operations with encryption support, user-specific databases, and schema initialization.
- Integrate book, chapter, and character operations with encrypted content handling and sync preparation.
2025-11-17 09:34:54 -05:00
natreex
09768aafcf Implement synchronization, offline data handling, and intelligent request routing
- Add services for offline data management, including `offline-data.service.ts`, ensuring data is saved to a local database and synced with the server when online.
- Introduce bidirectional `SyncService` for managing data synchronization with conflict resolution and retry mechanisms.
- Create `data.service.ts` to handle smart routing between local database and server API based on connectivity status.
- Update models and logic to support comprehensive synchronization for books, chapters, characters, and conversations.
- Implement event listeners for online/offline detection and automatic sync scheduling.
2025-11-17 07:47:15 -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
b4eafca3bc Add comprehensive models and script for handling inline scripts and structured data
- Implement `remove-inline-scripts.js` to externalize Next.js inline scripts, enhancing CSP compliance.
- Add models for `Book`, `Character`, `Story`, `Editor`, `System`, and `BookSerie` with relevant properties and utilities.
- Include macOS entitlements plist for app development with advanced permissions.
- Add utility functions to handle script hashing, cookie management, and content formatting.
2025-11-16 19:56:14 -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
natreex
1e6ebba56d Add login page and social login integration
- Implement `LoginPage`, `LoginForm`, and `SocialForm` components.
- Add language toggle and dynamic title support.
- Update `tsconfig.electron.json` for stricter settings.
- Add `electron-store` and associated types for token storage.
- Update `package.json` scripts and dependencies for Electron compatibility.
2025-11-16 13:20:20 -05:00
natreex
c9cf99e166 Update imports and Electron compatibility
- Removed unnecessary React imports.
- Adjusted package.json scripts for Electron integration.
- Updated components to replace Next.js-specific imports with Electron-compatible alternatives.
- Minor tsconfig.json changes for better compatibility.
2025-11-16 11:55:52 -05:00
natreex
8167948881 Add components for Act management and integrate Electron setup 2025-11-16 11:00:04 -05:00
natreex
e192b6dcc2 Add initial package.json file 2025-11-16 10:28:51 -05:00