mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Fix reconnect issues
This commit is contained in:
parent
26b4ee56df
commit
9a5408e366
3 changed files with 27 additions and 18 deletions
|
|
@ -152,16 +152,12 @@ kpxcEvent.onGetStatus = function(callback, tab, internalPoll = false, triggerUnl
|
|||
}
|
||||
};
|
||||
|
||||
kpxcEvent.onReconnect = function(callback, tab) {
|
||||
// Add a small timeout after reconnecting. Just to make sure. It's not pretty, I know :(
|
||||
setTimeout(() => {
|
||||
keepass.reconnect(callback, tab).then((configured) => {
|
||||
browser.tabs.sendMessage(tab.id, {
|
||||
action: 'redetect_fields'
|
||||
});
|
||||
kpxcEvent.showStatus(configured, tab, callback);
|
||||
});
|
||||
}, 500);
|
||||
kpxcEvent.onReconnect = async function(callback, tab) {
|
||||
const configured = await keepass.reconnect(callback, tab);
|
||||
browser.tabs.sendMessage(tab.id, {
|
||||
action: 'redetect_fields'
|
||||
});
|
||||
kpxcEvent.showStatus(configured, tab, callback);
|
||||
};
|
||||
|
||||
kpxcEvent.lockDatabase = function(callback, tab) {
|
||||
|
|
|
|||
|
|
@ -4,12 +4,10 @@ keepass.migrateKeyRing().then(() => {
|
|||
page.initSettings().then(() => {
|
||||
page.initOpenedTabs().then(() => {
|
||||
httpAuth.init();
|
||||
keepass.connectToNative();
|
||||
keepass.generateNewKeyPair();
|
||||
keepass.enableAutomaticReconnect();
|
||||
keepass.changePublicKeys(null).then((pkRes) => {
|
||||
keepass.enableAutomaticReconnect();
|
||||
keepass.getDatabaseHash((gdRes) => {}, null);
|
||||
});
|
||||
}).catch((e) => {});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1152,10 +1152,25 @@ keepass.disableAutomaticReconnect = function() {
|
|||
keepass.reconnectLoop = null;
|
||||
};
|
||||
|
||||
keepass.reconnect = async function(callback, tab) {
|
||||
keepass.connectToNative();
|
||||
keepass.generateNewKeyPair();
|
||||
keepass.changePublicKeys(tab, true).then(r => true).catch(e => false);
|
||||
keepass.reconnect = function(callback, tab) {
|
||||
return new Promise((resolve) => {
|
||||
keepass.connectToNative();
|
||||
keepass.generateNewKeyPair();
|
||||
keepass.changePublicKeys(tab, true).then((r) => {
|
||||
keepass.getDatabaseHash((gdRes) => {
|
||||
if (gdRes !== '' && tab && page.tabs[tab.id]) {
|
||||
delete page.tabs[tab.id].errorMessage;
|
||||
}
|
||||
keepass.testAssociation((associationResponse) => {
|
||||
keepass.isConfigured().then((configured) => {
|
||||
resolve(true);
|
||||
});
|
||||
});
|
||||
}, tab);
|
||||
}).catch((e) => {
|
||||
resolve(false);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
keepass.updatePopup = function(iconType) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue