mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Version 0.5.2
This commit is contained in:
parent
6c95eaa98a
commit
548b59f5a2
10 changed files with 101 additions and 49 deletions
11
CHANGELOG
Normal file → Executable file
11
CHANGELOG
Normal file → Executable file
|
|
@ -1,3 +1,14 @@
|
|||
0.5.2 (02-02-2018)
|
||||
=========================
|
||||
- Choose own credential fields saves the full URL instead of host
|
||||
- HTTP Auth no longer gets stuck when there are no credentials available
|
||||
- Added option to show notifications (enabled by default)
|
||||
- Added notifications for HTTP Auth and saving new credentialsList (new permission needed)
|
||||
|
||||
0.5.1 (23-01-2018)
|
||||
=========================
|
||||
- Fixed unnecessary credential retrieving when input fields are not available
|
||||
|
||||
0.5.0 (22-01-2018)
|
||||
=========================
|
||||
- Fixed an error when filling only a password
|
||||
|
|
|
|||
68
keepassxc-browser/background/browserAction.js
Normal file → Executable file
68
keepassxc-browser/background/browserAction.js
Normal file → Executable file
|
|
@ -200,43 +200,49 @@ browserAction.removeRememberPopup = function(callback, tab, removeImmediately) {
|
|||
};
|
||||
|
||||
browserAction.setRememberPopup = function(tabId, username, password, url, usernameExists, credentialsList) {
|
||||
const settings = typeof(localStorage.settings) === 'undefined' ? {} : JSON.parse(localStorage.settings);
|
||||
const id = tabId || page.currentTabId;
|
||||
let timeoutMinMillis = Number(getValueOrDefault(settings, 'blinkMinTimeout', BLINK_TIMEOUT_REDIRECT_THRESHOLD_TIME_DEFAULT, 0));
|
||||
browser.storage.local.get({'settings': {}}).then(function(item) {
|
||||
const settings = item.settings;
|
||||
const id = tabId || page.currentTabId;
|
||||
let timeoutMinMillis = Number(getValueOrDefault(settings, 'blinkMinTimeout', BLINK_TIMEOUT_REDIRECT_THRESHOLD_TIME_DEFAULT, 0));
|
||||
|
||||
if (timeoutMinMillis > 0) {
|
||||
timeoutMinMillis += Date.now();
|
||||
}
|
||||
if (timeoutMinMillis > 0) {
|
||||
timeoutMinMillis += Date.now();
|
||||
}
|
||||
|
||||
const blinkTimeout = getValueOrDefault(settings, 'blinkTimeout', BLINK_TIMEOUT_DEFAULT, 0);
|
||||
const pageUpdateAllowance = getValueOrDefault(settings, 'allowedRedirect', BLINK_TIMEOUT_REDIRECT_COUNT_DEFAULT, 0);
|
||||
const blinkTimeout = getValueOrDefault(settings, 'blinkTimeout', BLINK_TIMEOUT_DEFAULT, 0);
|
||||
const pageUpdateAllowance = getValueOrDefault(settings, 'allowedRedirect', BLINK_TIMEOUT_REDIRECT_COUNT_DEFAULT, 0);
|
||||
|
||||
const stackData = {
|
||||
visibleForMilliSeconds: blinkTimeout,
|
||||
visibleForPageUpdates: pageUpdateAllowance,
|
||||
redirectOffset: timeoutMinMillis,
|
||||
level: 10,
|
||||
intervalIcon: {
|
||||
index: 0,
|
||||
counter: 0,
|
||||
max: 2,
|
||||
icons: ['icon_remember_red_background_19x19.png', 'icon_remember_red_lock_19x19.png']
|
||||
},
|
||||
icon: 'icon_remember_red_background_19x19.png',
|
||||
popup: 'popup_remember.html'
|
||||
};
|
||||
const stackData = {
|
||||
visibleForMilliSeconds: blinkTimeout,
|
||||
visibleForPageUpdates: pageUpdateAllowance,
|
||||
redirectOffset: timeoutMinMillis,
|
||||
level: 10,
|
||||
intervalIcon: {
|
||||
index: 0,
|
||||
counter: 0,
|
||||
max: 2,
|
||||
icons: ['icon_remember_red_background_19x19.png', 'icon_remember_red_lock_19x19.png']
|
||||
},
|
||||
icon: 'icon_remember_red_background_19x19.png',
|
||||
popup: 'popup_remember.html'
|
||||
};
|
||||
|
||||
browserAction.stackPush(stackData, id);
|
||||
browserAction.stackPush(stackData, id);
|
||||
|
||||
page.tabs[id].credentials = {
|
||||
username: username,
|
||||
password: password,
|
||||
url: url,
|
||||
usernameExists: usernameExists,
|
||||
list: credentialsList
|
||||
};
|
||||
page.tabs[id].credentials = {
|
||||
username: username,
|
||||
password: password,
|
||||
url: url,
|
||||
usernameExists: usernameExists,
|
||||
list: credentialsList
|
||||
};
|
||||
|
||||
browserAction.show(null, {'id': id});
|
||||
browserAction.show(null, {'id': id});
|
||||
|
||||
if (page.settings.showNotifications) {
|
||||
showNotification('Create or modify the credentials by clicking on the extension icon.');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function getValueOrDefault(settings, key, defaultVal, min) {
|
||||
|
|
|
|||
2
keepassxc-browser/background/event.js
Normal file → Executable file
2
keepassxc-browser/background/event.js
Normal file → Executable file
|
|
@ -198,7 +198,7 @@ kpxcEvent.onGetKeePassXCVersions = function(callback, tab) {
|
|||
}, tab);
|
||||
} else {
|
||||
callback({"current": keepass.currentKeePassXC.version, "latest": keepass.currentKeePassXC.version});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
kpxcEvent.onCheckUpdateKeePassXC = function(callback, tab) {
|
||||
|
|
|
|||
22
keepassxc-browser/background/httpauth.js
Normal file → Executable file
22
keepassxc-browser/background/httpauth.js
Normal file → Executable file
|
|
@ -45,9 +45,17 @@ httpAuth.handleRequestCallback = function(details, callback) {
|
|||
httpAuth.processPendingCallbacks(details, callback, callback);
|
||||
};
|
||||
|
||||
httpAuth.processPendingCallbacks = function(details, resolve, reject) {
|
||||
httpAuth.retrieveCredentials = function(tabId, url, submitUrl, forceCallback) {
|
||||
return new Promise((resolve, reject) => {
|
||||
keepass.retrieveCredentials((logins) => {
|
||||
resolve(logins);
|
||||
}, tabId, url, submitUrl, forceCallback);
|
||||
});
|
||||
};
|
||||
|
||||
httpAuth.processPendingCallbacks = async function(details, resolve, reject) {
|
||||
if (httpAuth.requests.indexOf(details.requestId) >= 0 || !page.tabs[details.tabId]) {
|
||||
reject({});
|
||||
reject({cancel: false});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -59,9 +67,8 @@ httpAuth.processPendingCallbacks = function(details, resolve, reject) {
|
|||
|
||||
details.searchUrl = (details.isProxy && details.proxyUrl) ? details.proxyUrl : details.url;
|
||||
|
||||
keepass.retrieveCredentials((logins) => {
|
||||
httpAuth.loginOrShowCredentials(logins, details, resolve, reject);
|
||||
}, { "id": details.tabId }, details.searchUrl, details.searchUrl, true);
|
||||
const logins = await httpAuth.retrieveCredentials({ 'id': details.tabId }, details.searchUrl, details.searchUrl, true);
|
||||
httpAuth.loginOrShowCredentials(logins, details, resolve, reject);
|
||||
};
|
||||
|
||||
httpAuth.loginOrShowCredentials = function(logins, details, resolve, reject) {
|
||||
|
|
@ -75,11 +82,14 @@ httpAuth.loginOrShowCredentials = function(logins, details, resolve, reject) {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
if (page.settings.showNotifications) {
|
||||
showNotification('Multiple credentials detected. Click on the extension icon to choose the correct one.');
|
||||
}
|
||||
kpxcEvent.onHTTPAuthPopup(null, { 'id': details.tabId }, { 'logins': logins, 'url': details.searchUrl, 'resolve': resolve });
|
||||
}
|
||||
}
|
||||
// no logins found
|
||||
else {
|
||||
reject({});
|
||||
reject({cancel: false});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
4
keepassxc-browser/background/keepass.js
Normal file → Executable file
4
keepassxc-browser/background/keepass.js
Normal file → Executable file
|
|
@ -62,7 +62,7 @@ const kpErrors = {
|
|||
4: { msg: 'Cannot decrypt message' },
|
||||
5: { msg: 'Timeout or not connected to KeePassXC' },
|
||||
6: { msg: 'Action cancelled or denied' },
|
||||
7: { msg: 'Cannot encrypt message or public key not found. Is Native Messaging enabled in KeePassXC?' },
|
||||
7: { msg: 'Cannot encrypt message or public key not found. Is native messaging or support for your browser enabled in KeePassXC?' },
|
||||
8: { msg: 'KeePassXC association failed, try again.' },
|
||||
9: { msg: 'Key change was not successful.' },
|
||||
10: { msg: 'Encryption key is not recognized' },
|
||||
|
|
@ -265,9 +265,11 @@ keepass.retrieveCredentials = function(callback, tab, url, submiturl, forceCallb
|
|||
}
|
||||
else if (response.error && response.errorCode) {
|
||||
keepass.handleError(tab, response.errorCode, response.error);
|
||||
callback([]);
|
||||
}
|
||||
else {
|
||||
browserAction.showDefault(null, tab);
|
||||
callback([]);
|
||||
}
|
||||
});
|
||||
}, tab, false, triggerUnlock);
|
||||
|
|
|
|||
6
keepassxc-browser/background/page.js
Normal file → Executable file
6
keepassxc-browser/background/page.js
Normal file → Executable file
|
|
@ -4,7 +4,8 @@ const defaultSettings = {
|
|||
autoFillAndSend: true,
|
||||
usePasswordGenerator: true,
|
||||
autoFillSingleEntry: false,
|
||||
autoRetrieveCredentials: true
|
||||
autoRetrieveCredentials: true,
|
||||
showNotifications: true
|
||||
};
|
||||
|
||||
var page = {};
|
||||
|
|
@ -34,6 +35,9 @@ page.initSettings = function() {
|
|||
if (!('autoRetrieveCredentials' in page.settings)) {
|
||||
page.settings.autoRetrieveCredentials = defaultSettings.autoRetrieveCredentials;
|
||||
}
|
||||
if (!('showNotifications' in page.settings)) {
|
||||
page.settings.showNotifications = defaultSettings.showNotifications;
|
||||
}
|
||||
browser.storage.local.set({'settings': page.settings});
|
||||
resolve(page.settings);
|
||||
});
|
||||
|
|
|
|||
9
keepassxc-browser/global.js
Normal file → Executable file
9
keepassxc-browser/global.js
Normal file → Executable file
|
|
@ -4,3 +4,12 @@ var isFirefox = function() {
|
|||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var showNotification = function(message) {
|
||||
browser.notifications.create({
|
||||
'type': 'basic',
|
||||
'iconUrl': browser.extension.getURL('icons/keepassxc_64x64.png'),
|
||||
'title': 'KeePassXC-Browser',
|
||||
'message': message
|
||||
});
|
||||
};
|
||||
|
|
|
|||
16
keepassxc-browser/keepassxc-browser.js
Normal file → Executable file
16
keepassxc-browser/keepassxc-browser.js
Normal file → Executable file
|
|
@ -623,7 +623,7 @@ cipDefine.initDescription = function() {
|
|||
fieldIds.push(cipFields.prepareId(i));
|
||||
}
|
||||
|
||||
cip.settings['defined-credential-fields'][document.location.origin] = {
|
||||
cip.settings['defined-credential-fields'][document.location.href] = {
|
||||
username: cipDefine.selection.username,
|
||||
password: cipDefine.selection.password,
|
||||
fields: fieldIds
|
||||
|
|
@ -643,7 +643,7 @@ cipDefine.initDescription = function() {
|
|||
$description.append($btnAgain);
|
||||
$description.append($btnDismiss);
|
||||
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.origin]) {
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.href]) {
|
||||
const $p = jQuery('<p>').html('For this page credential fields are already selected and will be overwritten.<br />');
|
||||
const $btnDiscard = jQuery('<button>')
|
||||
.attr('id', 'btn-warning')
|
||||
|
|
@ -653,7 +653,7 @@ cipDefine.initDescription = function() {
|
|||
.addClass('btn-sm')
|
||||
.addClass('btn-danger')
|
||||
.click(function(e) {
|
||||
delete cip.settings['defined-credential-fields'][document.location.origin];
|
||||
delete cip.settings['defined-credential-fields'][document.location.href];
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'save_settings',
|
||||
|
|
@ -898,7 +898,7 @@ cipFields.getCombination = function(givenType, fieldId) {
|
|||
}
|
||||
}
|
||||
// use defined credential fields (already loaded into combinations)
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.origin]) {
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.href]) {
|
||||
return cipFields.combinations[0];
|
||||
}
|
||||
|
||||
|
|
@ -1098,8 +1098,8 @@ cipFields.prepareCombinations = function(combinations) {
|
|||
};
|
||||
|
||||
cipFields.useDefinedCredentialFields = function() {
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.origin]) {
|
||||
const creds = cip.settings['defined-credential-fields'][document.location.origin];
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.href]) {
|
||||
const creds = cip.settings['defined-credential-fields'][document.location.href];
|
||||
|
||||
let $found = _f(creds.username) || _f(creds.password);
|
||||
for (const i of creds.fields) {
|
||||
|
|
@ -1234,7 +1234,7 @@ cip.initCredentialFields = function(forceCall) {
|
|||
cip.url = document.location.origin;
|
||||
cip.submitUrl = cip.getFormActionUrl(cipFields.combinations[0]);
|
||||
|
||||
if (cip.settings.autoRetrieveCredentials && _called.retrieveCredentials === false) {
|
||||
if (cip.settings.autoRetrieveCredentials && _called.retrieveCredentials === false && (cip.url && cip.submitUrl)) {
|
||||
browser.runtime.sendMessage({
|
||||
action: 'retrieve_credentials',
|
||||
args: [ cip.url, cip.submitUrl ]
|
||||
|
|
@ -1808,7 +1808,7 @@ cipEvents.triggerActivatedTab = function() {
|
|||
|
||||
// initCredentialFields calls also "retrieve_credentials", to prevent it
|
||||
// check of init() was already called
|
||||
if (_called.initCredentialFields && (cip.url || cip.submitUrl) && cip.settings.autoRetrieveCredentials) {
|
||||
if (_called.initCredentialFields && (cip.url && cip.submitUrl) && cip.settings.autoRetrieveCredentials) {
|
||||
browser.runtime.sendMessage({
|
||||
action: 'retrieve_credentials',
|
||||
args: [ cip.url, cip.submitUrl ]
|
||||
|
|
|
|||
3
keepassxc-browser/manifest.json
Normal file → Executable file
3
keepassxc-browser/manifest.json
Normal file → Executable file
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "KeePassXC-Browser",
|
||||
"version": "0.5.0",
|
||||
"version": "0.5.2",
|
||||
"description": "KeePassXC integration for modern web browsers",
|
||||
"author": "KeePassXC Team",
|
||||
"icons": {
|
||||
|
|
@ -91,6 +91,7 @@
|
|||
"contextMenus",
|
||||
"clipboardWrite",
|
||||
"nativeMessaging",
|
||||
"notifications",
|
||||
"storage",
|
||||
"tabs",
|
||||
"webRequest",
|
||||
|
|
|
|||
9
keepassxc-browser/options/options.html
Normal file → Executable file
9
keepassxc-browser/options/options.html
Normal file → Executable file
|
|
@ -125,6 +125,15 @@
|
|||
</div>
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
<div class="checkbox">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="showNotifications" value="true" /> Show notifications.
|
||||
</label>
|
||||
<span class="help-block">Allow KeePassXC-Browser to show notifications when user interaction is needed from the extension icon.</span>
|
||||
</div>
|
||||
</p>
|
||||
<hr />
|
||||
<p>
|
||||
Check for updates of KeePassXC:
|
||||
<br />
|
||||
|
|
|
|||
Loading…
Reference in a new issue