mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 07:05:05 -04:00
Refactor URL arguments, localStorage and sessionStorage entries, and IndexedDB/PersistentStorage entries to snake_case.
This commit is contained in:
parent
da8178d72e
commit
a8242cecf7
6 changed files with 34 additions and 26 deletions
|
@ -4,7 +4,7 @@ class PersistentStorage {
|
|||
PersistentStorage.logBrowserNotCapable();
|
||||
return;
|
||||
}
|
||||
const DBOpenRequest = window.indexedDB.open('pairdrop_store', 4);
|
||||
const DBOpenRequest = window.indexedDB.open('pairdrop_store', 5);
|
||||
DBOpenRequest.onerror = e => {
|
||||
PersistentStorage.logBrowserNotCapable();
|
||||
console.log('Error initializing database: ');
|
||||
|
@ -13,7 +13,7 @@ class PersistentStorage {
|
|||
DBOpenRequest.onsuccess = _ => {
|
||||
console.log('Database initialised.');
|
||||
};
|
||||
DBOpenRequest.onupgradeneeded = e => {
|
||||
DBOpenRequest.onupgradeneeded = async e => {
|
||||
const db = e.target.result;
|
||||
const txn = e.target.transaction;
|
||||
|
||||
|
@ -42,6 +42,14 @@ class PersistentStorage {
|
|||
roomSecretsObjectStore4.createIndex('display_name', 'display_name');
|
||||
roomSecretsObjectStore4.createIndex('auto_accept', 'auto_accept');
|
||||
}
|
||||
if (e.oldVersion <= 4) {
|
||||
// migrate to v5
|
||||
const editedDisplayNameOld = await PersistentStorage.get('editedDisplayName');
|
||||
if (editedDisplayNameOld) {
|
||||
await PersistentStorage.set('edited_display_name', editedDisplayNameOld);
|
||||
await PersistentStorage.delete('editedDisplayName');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue