From 452ae555bbd8e987e48c736105a33dee7d2c957a Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 19 Jun 2025 12:37:41 -0600 Subject: [PATCH] IndexedDB migration: add ability to see mnemonic and download settings & contacts --- src/services/indexedDBMigrationService.ts | 8 + src/views/DatabaseMigration.vue | 181 ++++++++++++++++------ 2 files changed, 143 insertions(+), 46 deletions(-) diff --git a/src/services/indexedDBMigrationService.ts b/src/services/indexedDBMigrationService.ts index 4005773f..2cea6b3b 100644 --- a/src/services/indexedDBMigrationService.ts +++ b/src/services/indexedDBMigrationService.ts @@ -21,6 +21,8 @@ * @since 2024 */ +import "dexie-export-import"; + import { PlatformServiceFactory } from "./PlatformServiceFactory"; import { db, accountsDBPromise } from "../db/index"; import { Contact, ContactMethod } from "../db/tables/contacts"; @@ -108,6 +110,12 @@ export interface MigrationResult { warnings: string[]; } +export async function getDexieExportBlob(): Promise { + await db.open(); + const blob = db.export({ prettyJson: true }); + return blob; +} + /** * Retrieves all contacts from the Dexie (IndexedDB) database * diff --git a/src/views/DatabaseMigration.vue b/src/views/DatabaseMigration.vue index d836203c..8565f30e 100644 --- a/src/views/DatabaseMigration.vue +++ b/src/views/DatabaseMigration.vue @@ -53,17 +53,87 @@ -
-

+

- Beware: you have unexpected existing data in the SQLite database that will be overwritten. You should talk with Trent. -

+ Beware: you have unexpected existing data in the SQLite database that will be overwritten. Talk with Trent. +

+

+ We cannot find your main account. Talk with Trent. +

+

+ You have multiple accounts. If you didn't mean to, talk with Trent. +

+
+
+

+ Here is your seed. Write it down! +
+ {{ downloadMnemonic }} +

+ + + + +
+ + +

+ If no download happened yet, click here to download now. +

+
+
+ +
+
{{ @@ -457,7 +527,7 @@ svg-class="h-5 w-5 text-red-600 mr-2" /> MissingKeep {{ @@ -489,13 +559,13 @@ - +

- Modified Accounts ({{ comparison.differences.accounts.modified.length }}): + Modify Accounts ({{ comparison.differences.accounts.modified.length }}):

- +

- Missing Accounts ({{ comparison.differences.accounts.missing.filter(a => a.did).length }}): + Keep Accounts ({{ comparison.differences.accounts.missing.filter(a => a.did).length }}):

ModifiedModify
{{ @@ -586,7 +656,7 @@ svg-class="h-5 w-5 text-red-600 mr-2" /> MissingKeep
{{ @@ -616,13 +686,13 @@
- +

- Modified Settings ({{ comparison.differences.settings.modified.length }}): + Modify Settings ({{ comparison.differences.settings.modified.length }}):

- +

- Missing Settings ({{ comparison.differences.settings.missing.filter(s => s.accountDid || s.activeDid).length }}): + Keep Settings ({{ comparison.differences.settings.missing.filter(s => s.accountDid || s.activeDid).length }}):

ModifiedModify
{{ @@ -709,7 +779,7 @@ svg-class="h-5 w-5 text-red-600 mr-2" /> MissingKeep
{{ @@ -739,13 +809,13 @@
- +

- Modified Contacts ({{ comparison.differences.contacts.modified.length }}): + Modify Contacts ({{ comparison.differences.contacts.modified.length }}):

- +

- Missing Contacts ({{ comparison.differences.contacts.missing.filter(c => c.did).length }}): + Keep Contacts ({{ comparison.differences.contacts.missing.filter(c => c.did).length }}):