Bump app version to 0.5.1 and add auto-update support

- Implemented auto-update logic in `ScribeTopBar` with update notification and user interaction.
- Integrated `@tauri-apps/plugin-updater` and `@tauri-apps/plugin-process` for updater functionality.
- Added automatic migration feature with `autoMigrateElectron` support and UI feedback.
- Refactored app architecture with new routing, components, and layout for better modularity.
- Enhanced JSON response handling in API client for robust data parsing.
- Updated locales to include new translations for update and migration-related UI.
This commit is contained in:
natreex
2026-04-07 16:09:35 -04:00
parent 687c1d582c
commit 5c7e71ce9e
19 changed files with 461 additions and 46 deletions

View File

@@ -25,7 +25,11 @@ async function handleResponse<T>(response: Response): Promise<T> {
const body = await response.json().catch(() => ({message: response.statusText}));
throw new ApiError(body.message || body || response.statusText, response.status);
}
return response.json() as Promise<T>;
const contentType = response.headers.get('content-type') ?? '';
if (contentType.includes('application/json')) {
return response.json() as Promise<T>;
}
return response.text() as unknown as Promise<T>;
}
export async function apiGet<T>(url: string, auth: string, lang: string = "fr", params: Record<string, unknown> = {}): Promise<T> {

View File

@@ -55,7 +55,9 @@
"scribeTopBar": {
"logoAlt": "Logo",
"scribe": "Scribe",
"separator": " - "
"separator": " - ",
"update": "Update",
"updating": "Updating..."
},
"scribeLeftBar": {
"editorComponents": {
@@ -217,7 +219,13 @@
"retry": "Retry",
"fileNotFound": "The migration file was not found at this path.",
"dbNotFound": "The database was not found next to the migration file.",
"importFailed": "Import failed. Please check that the files are valid."
"importFailed": "Import failed. Please check that the files are valid.",
"autoMigrating": "Migrating your data...",
"autoErrorTitle": "Automatic migration failed",
"autoErrorText": "Your data from the previous version could not be recovered.",
"autoErrorContinue": "Continue without migrating",
"autoErrorContinueWarning": "Warning: your local data will not be recovered.",
"autoErrorRetry": "Retry"
},
"quillSense": {
"needSubscription": "Please subscribe to QuillSense or bring your keys to access this feature.",

View File

@@ -55,7 +55,9 @@
"scribeTopBar": {
"logoAlt": "Logo",
"scribe": "Scribe",
"separator": " - "
"separator": " - ",
"update": "Mettre à jour",
"updating": "Mise à jour..."
},
"scribeLeftBar": {
"editorComponents": {
@@ -217,7 +219,13 @@
"retry": "Réessayer",
"fileNotFound": "Le fichier de migration est introuvable à ce chemin.",
"dbNotFound": "La base de données n'a pas été trouvée à côté du fichier de migration.",
"importFailed": "L'importation a échoué. Vérifiez que les fichiers sont valides."
"importFailed": "L'importation a échoué. Vérifiez que les fichiers sont valides.",
"autoMigrating": "Migration des données en cours...",
"autoErrorTitle": "La migration automatique a échoué",
"autoErrorText": "Vos données de l'ancienne version n'ont pas pu être récupérées.",
"autoErrorContinue": "Continuer sans migrer",
"autoErrorContinueWarning": "Attention : vos données locales ne seront pas récupérées.",
"autoErrorRetry": "Réessayer"
},
"quillSense": {
"needSubscription": "Veuillez vous abonner à QuillSense ou Amenez vos clés pour accéder à cette fonctionnalité.",

View File

@@ -700,6 +700,20 @@ export async function importFromElectron(migrationFilePath: string): Promise<Mig
return invoke<MigrationResult>('import_from_electron', {data: {migrationFilePath}});
}
export interface AutoMigrationResult {
migrated: boolean;
userId: string | null;
tokenMigrated: boolean;
keyMigrated: boolean;
pinMigrated: boolean;
dbMigrated: boolean;
error: string | null;
}
export async function autoMigrateElectron(): Promise<AutoMigrationResult> {
return invoke<AutoMigrationResult>('auto_migrate_electron');
}
// ─── Window Management ──────────────────────────────────────
let loginWindowOpening = false;