v1.0.8b
- Bug fixed: initDB not upgrading correctly. - Added message to remind the user to secure the private key with password. - Darkened (color) the warning popup.
This commit is contained in:
parent
1764a90912
commit
326d4bc589
38
index.html
38
index.html
@ -1075,6 +1075,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<script id="onLoadStartUp">
|
<script id="onLoadStartUp">
|
||||||
function onLoadStartUp() {
|
function onLoadStartUp() {
|
||||||
|
privKeyNotSecured = true;
|
||||||
//display loading screen
|
//display loading screen
|
||||||
document.getElementById("loading-screen").classList.remove("hide")
|
document.getElementById("loading-screen").classList.remove("hide")
|
||||||
document.getElementById("sign-in-box").classList.add("hide")
|
document.getElementById("sign-in-box").classList.add("hide")
|
||||||
@ -1112,6 +1113,7 @@
|
|||||||
signInBox["key"].setAttribute("placeholder", "Password")
|
signInBox["key"].setAttribute("placeholder", "Password")
|
||||||
signInBox["guest-login"].classList.add("hide");
|
signInBox["guest-login"].classList.add("hide");
|
||||||
signInBox["remove-account"].classList.remove("hide");
|
signInBox["remove-account"].classList.remove("hide");
|
||||||
|
privKeyNotSecured = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -1413,7 +1415,7 @@
|
|||||||
|
|
||||||
document.forms["sign-in-box"]["remove-account"].addEventListener('click', function (e) {
|
document.forms["sign-in-box"]["remove-account"].addEventListener('click', function (e) {
|
||||||
getConfirmation('Remove Account?',
|
getConfirmation('Remove Account?',
|
||||||
'**Remember to store your PRIVATE-KEY**\*Private-Key will be needed to signIn again*\nAre you sure you want to remove account?',
|
'**Remember to store your PRIVATE-KEY**\n*Private-Key will be needed to signIn again*\nAre you sure you want to remove account?',
|
||||||
"Remove").then(result => {
|
"Remove").then(result => {
|
||||||
floDapps.logout().then(result => {
|
floDapps.logout().then(result => {
|
||||||
showMessage("Removed Account")
|
showMessage("Removed Account")
|
||||||
@ -1424,9 +1426,10 @@
|
|||||||
|
|
||||||
document.getElementById("secure-key").addEventListener('click', function (e) {
|
document.getElementById("secure-key").addEventListener('click', function (e) {
|
||||||
getPromptInput("Secure Private-Key", 'Enter Password', false).then(value => {
|
getPromptInput("Secure Private-Key", 'Enter Password', false).then(value => {
|
||||||
floDapps.securePrivKey(value)
|
floDapps.securePrivKey(value).then(result => {
|
||||||
.then(result => showMessage("Private Key secured"))
|
privKeyNotSecured = false;
|
||||||
.catch(error => showMessage("Securing Failed", "error", error))
|
showMessage("Private Key secured");
|
||||||
|
}).catch(error => showMessage("Securing Failed", "error", error))
|
||||||
}).catch(error => {})
|
}).catch(error => {})
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1459,6 +1462,8 @@
|
|||||||
showMessage(
|
showMessage(
|
||||||
`${Object.keys(data.messages).length} New Messages And ${Object.keys(data.mails).length} New Mails`
|
`${Object.keys(data.messages).length} New Messages And ${Object.keys(data.mails).length} New Mails`
|
||||||
)
|
)
|
||||||
|
if(privKeyNotSecured)
|
||||||
|
setTimeout( () => showMessage("Private key is not secured with password. Remember to secure the private key in settings", "warn"), 5000)
|
||||||
}).catch(error => showMessage(error, "error"))
|
}).catch(error => showMessage(error, "error"))
|
||||||
.finally(_ => this.classList.remove("active"))
|
.finally(_ => this.classList.remove("active"))
|
||||||
})
|
})
|
||||||
@ -1635,7 +1640,7 @@
|
|||||||
let bg = {
|
let bg = {
|
||||||
normal: '#00C853',
|
normal: '#00C853',
|
||||||
error: '#D32F2F',
|
error: '#D32F2F',
|
||||||
warn: '#FFCC00',
|
warn: '#FFAA00',
|
||||||
cool: '#08B6CE'
|
cool: '#08B6CE'
|
||||||
}
|
}
|
||||||
let banner = document.getElementById('show-message')
|
let banner = document.getElementById('show-message')
|
||||||
@ -10002,33 +10007,40 @@ Bitcoin.Util = {
|
|||||||
this.dbName = dbName;
|
this.dbName = dbName;
|
||||||
},
|
},
|
||||||
|
|
||||||
initDB: function (dbName, objectStores = {}) {
|
initDB: function (dbName, objectStores = {}, version = null, removeStores = []) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.dbName = this.dbName || dbName;
|
this.dbName = this.dbName || dbName;
|
||||||
var idb = indexedDB.open(dbName);
|
var idb = version ? indexedDB.open(dbName, version) : indexedDB.open(dbName);
|
||||||
idb.onerror = (event) => {
|
idb.onerror = (event) => {
|
||||||
reject("Error in opening IndexedDB!");
|
reject("Error in opening IndexedDB!");
|
||||||
};
|
};
|
||||||
idb.onupgradeneeded = (event) => {
|
idb.onupgradeneeded = (event) => {
|
||||||
var db = event.target.result;
|
var db = event.target.result;
|
||||||
for (obs in objectStores) {
|
for (let obs in objectStores) {
|
||||||
var objectStore = db.createObjectStore(obs, objectStores[obs].options ||
|
var objectStore = db.createObjectStore(obs, objectStores[obs].options ||
|
||||||
{});
|
{});
|
||||||
if (objectStores[obs].indexes && typeof objectStores[obs].indexes ===
|
if (objectStores[obs].indexes && typeof objectStores[obs].indexes ===
|
||||||
'object')
|
'object')
|
||||||
for (i in objectStores[obs].indexes)
|
for (let i in objectStores[obs].indexes)
|
||||||
objectStore.createIndex(i, i, objectStores[obs].indexes[i] || {});
|
objectStore.createIndex(i, i, objectStores[obs].indexes[i] || {});
|
||||||
}
|
}
|
||||||
|
if (version)
|
||||||
|
removeStores.forEach(obs => db.deleteObjectStore(obs));
|
||||||
}
|
}
|
||||||
idb.onsuccess = (event) => {
|
idb.onsuccess = (event) => {
|
||||||
var db = event.target.result;
|
var db = event.target.result;
|
||||||
if (JSON.stringify(Object.values(db.objectStoreNames).sort()) === JSON
|
if (JSON.stringify(Object.values(db.objectStoreNames).sort()) === JSON
|
||||||
.stringify(Object.keys(
|
.stringify(Object.keys(objectStores).sort()))
|
||||||
objectStores).sort()))
|
|
||||||
resolve("Initiated IndexedDB");
|
resolve("Initiated IndexedDB");
|
||||||
else {
|
else {
|
||||||
Object.values(db.objectStoreNames).forEach(obs => delete objectStores[obs])
|
let removeObs = [];
|
||||||
this.initDB(dbName, objectStores, db.version + 1)
|
Object.values(db.objectStoreNames).forEach(obs => {
|
||||||
|
if (obs in objectStores)
|
||||||
|
delete objectStores[obs]
|
||||||
|
else
|
||||||
|
removeObs.push(obs)
|
||||||
|
})
|
||||||
|
this.initDB(dbName, objectStores, db.version + 1, removeObs)
|
||||||
.then(result => resolve(result))
|
.then(result => resolve(result))
|
||||||
.catch(error => reject(error))
|
.catch(error => reject(error))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user