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.
This commit is contained in:
natreex
2025-11-19 19:58:55 -05:00
parent dde4683c38
commit f85c2d2269
10 changed files with 290 additions and 9 deletions

View File

@@ -891,5 +891,45 @@
"message": "Sorry! This feature is reserved for advanced members. You must have a higher subscription or the advanced AI activation option.",
"close": "Close"
}
},
"offline": {
"mode": {
"title": "Offline Mode",
"backToOnline": "Back to online login"
},
"pin": {
"setup": {
"title": "Configure PIN",
"titleFirstLogin": "Secure your offline access",
"subtitle": "Protect your local data",
"description": "This PIN will allow you to access your works even without an internet connection",
"pinLabel": "PIN Code (4-8 digits)",
"confirmPinLabel": "Confirm PIN",
"laterButton": "Later",
"configureButton": "Configure PIN",
"configuringButton": "Configuring...",
"footer": "Your PIN is stored securely on your device"
},
"verify": {
"title": "Offline Mode",
"subtitle": "Enter your PIN to access your local works",
"placeholder": "Enter your PIN",
"enterPin": "Please enter your PIN",
"incorrect": "Incorrect PIN",
"tooManyAttempts": "Too many failed attempts. Please reconnect online.",
"error": "Error verifying PIN",
"cancelButton": "Cancel",
"unlockButton": "Unlock",
"verifyingButton": "Verifying...",
"attemptsRemaining": "{{count}} attempt(s) remaining"
},
"errors": {
"tooShort": "PIN must be at least 4 digits",
"tooLong": "PIN cannot exceed 8 digits",
"digitsOnly": "PIN must contain only digits",
"mismatch": "PINs do not match",
"setupFailed": "Error configuring PIN"
}
}
}
}

View File

@@ -892,5 +892,45 @@
"message": "Désolé! Cette fonctionnalité est réservée aux membres avancés. Tu dois avoir un abonnement supérieur ou loption activation IA avancée.",
"close": "Fermer"
}
},
"offline": {
"mode": {
"title": "Mode Hors Ligne",
"backToOnline": "Retour à la connexion en ligne"
},
"pin": {
"setup": {
"title": "Configurer le PIN",
"titleFirstLogin": "Sécurisez votre accès hors ligne",
"subtitle": "Protégez vos données locales",
"description": "Ce PIN vous permettra d'accéder à vos œuvres même sans connexion internet",
"pinLabel": "Code PIN (4-8 chiffres)",
"confirmPinLabel": "Confirmer le PIN",
"laterButton": "Plus tard",
"configureButton": "Configurer le PIN",
"configuringButton": "Configuration...",
"footer": "Votre PIN est stocké de manière sécurisée sur votre appareil"
},
"verify": {
"title": "Mode Hors Ligne",
"subtitle": "Entrez votre PIN pour accéder à vos œuvres locales",
"placeholder": "Entrez votre PIN",
"enterPin": "Veuillez entrer votre PIN",
"incorrect": "PIN incorrect",
"tooManyAttempts": "Trop de tentatives échouées. Veuillez vous reconnecter en ligne.",
"error": "Erreur lors de la vérification du PIN",
"cancelButton": "Annuler",
"unlockButton": "Déverrouiller",
"verifyingButton": "Vérification...",
"attemptsRemaining": "{{count}} tentative(s) restante(s)"
},
"errors": {
"tooShort": "Le PIN doit contenir au moins 4 chiffres",
"tooLong": "Le PIN ne peut pas dépasser 8 chiffres",
"digitsOnly": "Le PIN doit contenir uniquement des chiffres",
"mismatch": "Les codes PIN ne correspondent pas",
"setupFailed": "Erreur lors de la configuration du PIN"
}
}
}
}