Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32180589
D14940.1765074673.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D14940.1765074673.diff
View Options
diff --git a/web/shared-worker/worker/shared-worker.js b/web/shared-worker/worker/shared-worker.js
--- a/web/shared-worker/worker/shared-worker.js
+++ b/web/shared-worker/worker/shared-worker.js
@@ -97,6 +97,7 @@
}
}
+ // Main database
const encryptedContent =
await localforage.getItem<EncryptedData>(SQLITE_CONTENT);
@@ -122,6 +123,44 @@
setSQLiteQueryExecutor(
new newModule.SQLiteQueryExecutor(COMM_SQLITE_DATABASE_PATH, false),
);
+
+ // Restored database
+ const encryptedRestoredContent = await localforage.getItem<EncryptedData>(
+ RESTORED_SQLITE_CONTENT,
+ );
+
+ let restoredDBContent = null;
+ try {
+ if (encryptionKey && encryptedRestoredContent) {
+ restoredDBContent = await decryptData(
+ encryptedRestoredContent,
+ encryptionKey,
+ );
+ }
+ } catch (e) {
+ console.error(
+ 'Error while decrypting restored content, clearing restored database',
+ );
+ await localforage.removeItem(RESTORED_SQLITE_CONTENT);
+ }
+ if (restoredDBContent) {
+ importDatabaseContent(
+ restoredDBContent,
+ newModule,
+ SQLITE_RESTORE_DATABASE_PATH,
+ );
+
+ console.info(
+ 'Restored database exists and is properly encrypted, using persisted data',
+ );
+
+ setSQLiteQueryExecutor(
+ new newModule.SQLiteQueryExecutor(SQLITE_RESTORE_DATABASE_PATH, false),
+ databaseIdentifier.RESTORED,
+ );
+ } else {
+ console.info('Restored database does not exist');
+ }
}
async function initBackupClient(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 2:31 AM (8 h, 57 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5842160
Default Alt Text
D14940.1765074673.diff (1 KB)
Attached To
Mode
D14940: [web] initialize restored query executor
Attached
Detach File
Event Timeline
Log In to Comment