mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Fixed popup status displays and public key changing.
This commit is contained in:
parent
f5aea1d2cd
commit
2fd38eee60
4 changed files with 43 additions and 22 deletions
|
|
@ -70,18 +70,20 @@ browserAction.showDefault = function(callback, tab) {
|
|||
iconType: "normal",
|
||||
popup: "popup.html"
|
||||
}
|
||||
if(!keepass.isConfigured() || keepass.isDatabaseClosed || !keepass.isKeePassXCAvailable || page.tabs[tab.id].errorMessage) {
|
||||
stackData.iconType = "cross";
|
||||
}
|
||||
keepass.isConfigured(function(response) {
|
||||
if (!response || keepass.isDatabaseClosed || !keepass.isKeePassXCAvailable || page.tabs[tab.id].errorMessage) {
|
||||
stackData.iconType = "cross";
|
||||
}
|
||||
|
||||
if(page.tabs[tab.id].loginList.length > 0) {
|
||||
stackData.iconType = "questionmark";
|
||||
stackData.popup = "popup_login.html";
|
||||
}
|
||||
if(page.tabs[tab.id].loginList.length > 0) {
|
||||
stackData.iconType = "questionmark";
|
||||
stackData.popup = "popup_login.html";
|
||||
}
|
||||
|
||||
browserAction.stackUnshift(stackData, tab.id);
|
||||
browserAction.stackUnshift(stackData, tab.id);
|
||||
|
||||
browserAction.show(null, tab);
|
||||
browserAction.show(null, tab);
|
||||
});
|
||||
}
|
||||
|
||||
browserAction.stackAdd = function(callback, tab, icon, popup, level, push, visibleForMilliSeconds, visibleForPageUpdates, redirectOffset, dontShow) {
|
||||
|
|
|
|||
|
|
@ -155,7 +155,9 @@ event.onGetConnectedDatabase = function(callback, tab) {
|
|||
|
||||
event.onGetKeePassXCVersions = function(callback, tab) {
|
||||
if (keepass.currentKeePassXC.version == 0) {
|
||||
keepass.getDatabaseHash(tab);
|
||||
keepass.getDatabaseHash(function(response) {
|
||||
callback({"current": keepass.currentKeePassXC.version, "latest": keepass.latestKeePassXC.version});
|
||||
}, tab);
|
||||
}
|
||||
callback({"current": keepass.currentKeePassXC.version, "latest": keepass.latestKeePassXC.version});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,11 @@ page.initOpenedTabs();
|
|||
// initial connection with KeePassXC
|
||||
keepass.connectToNative();
|
||||
keepass.generateNewKeyPair();
|
||||
keepass.getDatabaseHash(null, null);
|
||||
keepass.changePublicKeys();
|
||||
//keepass.getDatabaseHash(null, null);
|
||||
//keepass.changePublicKeys();
|
||||
keepass.getDatabaseHash(function(res) {
|
||||
keepass.changePublicKeys();
|
||||
}, null);
|
||||
// set initial tab-ID
|
||||
chrome.tabs.query({"active": true, "windowId": chrome.windows.WINDOW_ID_CURRENT}, function(tabs) {
|
||||
if (tabs.length === 0)
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ keepass.testAssociation = function (callback, tab, triggerUnlock) {
|
|||
}
|
||||
|
||||
if (keepass.serverPublicKey.length == 0) {
|
||||
if (tab && tab.id) {
|
||||
if (tab && page.tabs[tab.id]) {
|
||||
var errorMessage = "No KeePassXC public key available.";
|
||||
page.tabs[tab.id].errorMessage = errorMessage;
|
||||
console.log(errorMessage);
|
||||
|
|
@ -446,18 +446,26 @@ keepass.getDatabaseHash = function (callback, tab, triggerUnlock) {
|
|||
keepass.associated.hash = null;
|
||||
}
|
||||
|
||||
if (tab && page.tabs[tab.id]) {
|
||||
delete page.tabs[tab.id].errorMessage;
|
||||
}
|
||||
|
||||
statusOK();
|
||||
callback(response.hash);
|
||||
}
|
||||
else if (response.errorCode)
|
||||
{
|
||||
keepass.databaseHash = "no-hash";
|
||||
keepass.isDatabaseClosed = true;
|
||||
console.log("Error: KeePass database is not opened.");
|
||||
if (tab && page.tabs[tab.id]) {
|
||||
page.tabs[tab.id].errorMessage = "KeePass database is not opened.";
|
||||
}
|
||||
callback(keepass.databaseHash);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tab && tab.id) {
|
||||
keepass.databaseHash = "no-hash";
|
||||
if (tab && page.tabs[tab.id]) {
|
||||
page.tabs[tab.id].errorMessage = "Database hash not received.";
|
||||
}
|
||||
callback(keepass.databaseHash);
|
||||
}
|
||||
});
|
||||
keepass.nativePort.postMessage(message);
|
||||
|
|
@ -489,7 +497,7 @@ keepass.changePublicKeys = function(tab) {
|
|||
|
||||
var id = response.id;
|
||||
if (!keepass.verifyKeyResponse(response, key, nonce)) {
|
||||
if (tab && tab.id) {
|
||||
if (tab && page.tabs[tab.id]) {
|
||||
page.tabs[tab.id].errorMessage = "Key change was not successful.";
|
||||
console.log("Key change was not successful.");
|
||||
}
|
||||
|
|
@ -516,6 +524,10 @@ keepass.isConfigured = function(callback) {
|
|||
callback(keepass.databaseHash in keepass.keyRing);
|
||||
}, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(keepass.databaseHash in keepass.keyRing);
|
||||
}
|
||||
}
|
||||
|
||||
keepass.isAssociated = function() {
|
||||
|
|
@ -675,9 +687,11 @@ keepass.onNativeMessage = function (response) {
|
|||
}
|
||||
|
||||
function onDisconnected() {
|
||||
console.log("Failed to connect: " + chrome.runtime.lastError.message);
|
||||
keepass.nativePort = null;
|
||||
keepass.isConnected = false;
|
||||
console.log("Failed to connect: " + chrome.runtime.lastError.message);
|
||||
keepass.nativePort = null;
|
||||
keepass.isConnected = false;
|
||||
keepass.isDatabaseClosed = true;
|
||||
keepass.isKeePassXCAvailable = false;
|
||||
}
|
||||
|
||||
keepass.nativeConnect = function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue