mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Added browser-polyfill, merged changes from latest passifox, fixed HTTP auth
This commit is contained in:
parent
015eab1ce3
commit
b1135c232d
24 changed files with 311 additions and 233 deletions
|
|
@ -1,3 +1,10 @@
|
|||
0.3.0 (2017-??-??)
|
||||
=========================
|
||||
- Added Mozilla's browser-polyfill
|
||||
- Merged changes from the latest passifox (credits to smorks):
|
||||
- HTTP auth works with all browsers
|
||||
- TODO: Automatic detectal of div's with forms that are non-hidden by user interaction
|
||||
|
||||
0.2.9 (2017-08-27)
|
||||
=========================
|
||||
- Code cleaning, global functions moved to global.js
|
||||
|
|
|
|||
39
README.md
39
README.md
|
|
@ -2,7 +2,7 @@
|
|||
Chrome extension for [KeePassXC](https://keepassxc.org/) with Native Messaging.
|
||||
|
||||
This is a heavily forked version of [pfn](https://github.com/pfn)'s [chromeIPass](https://github.com/pfn/passifox).
|
||||
Some changes merged also from [projectgus'](https://github.com/projectgus/passifox) fork.
|
||||
Some changes merged also from [projectgus'](https://github.com/projectgus/passifox) and [smorks'](https://github.com/smorks/passifox) fork.
|
||||
For testing purposes, please use following unofficial KeePassXC [release's](https://github.com/varjolintu/keepassxc/releases).
|
||||
|
||||
Get the extension for [Firefox](https://addons.mozilla.org/en-US/firefox/addon/keepassxc-browser/) or [Chrome/Chromium](https://chrome.google.com/webstore/detail/keepassxc-browser/iopaggbpplllidnfmcghoonnokmjoicf).
|
||||
|
|
@ -269,41 +269,10 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
```
|
||||
|
||||
The following quick method to determine which browser is used with API calls by [David Rousset](https://github.com/davrous):
|
||||
```javascript
|
||||
window.browser = (function () {
|
||||
return window.msBrowser ||
|
||||
window.browser ||
|
||||
window.chrome;
|
||||
})();
|
||||
```
|
||||
|
||||
```
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 David Rousset
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
||||
|
||||
## Donations
|
||||
|
||||
Feel free to support this project:
|
||||
- Donate via [PayPal](https://paypal.me/varjolintu)
|
||||
- Donate via Bitcoin: 1LHbD69CcmpLW5hjUXs2MGJhw3GxwqLdw3
|
||||
- Donate via Bitcoin: 1LHbD69CcmpLW5hjUXs2MGJhw3GxwqLdw3
|
||||
|
||||
Also consider donating to [KeePassXC](https://flattr.com/submit/auto?fid=x7yqz0&url=https%3A%2F%2Fkeepassxc.org) and passifox teams [(1)](https://github.com/smorks/passifox),[(2)](https://github.com/projectgus/passifox),[(3)](https://github.com/pfn/passifox). They are doing great job.
|
||||
|
|
@ -218,43 +218,45 @@ 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((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});
|
||||
});
|
||||
}
|
||||
|
||||
function getValueOrDefault(settings, key, defaultVal, min) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ event.invoke = function(handler, callback, senderTabId, args, secondTime) {
|
|||
// remove information from no longer existing tabs
|
||||
page.removePageInformationFromNotExistingTabs();
|
||||
|
||||
browser.tabs.get(senderTabId, (tab) => {
|
||||
browser.tabs.get(senderTabId).then((tab) => {
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -101,27 +101,32 @@ event.showStatus = function(configured, tab, callback) {
|
|||
}
|
||||
|
||||
event.onLoadSettings = function(callback, tab) {
|
||||
page.settings = (typeof(localStorage.settings) === 'undefined') ? {} : JSON.parse(localStorage.settings);
|
||||
browser.storage.local.get({'settings': {}}).then((item) => {
|
||||
callback(item.settings);
|
||||
}, (err) => {
|
||||
console.log('error loading settings: ' + err);
|
||||
});
|
||||
}
|
||||
|
||||
event.onLoadKeyRing = function(callback, tab) {
|
||||
keepass.keyRing = (typeof(localStorage.keyRing) === 'undefined') ? {} : JSON.parse(localStorage.keyRing);
|
||||
if (keepass.isAssociated() && !keepass.keyRing[keepass.associated.hash]) {
|
||||
keepass.associated = {
|
||||
value: false,
|
||||
hash: null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
event.onGetSettings = function(callback, tab) {
|
||||
event.onLoadSettings();
|
||||
callback({ data: page.settings });
|
||||
browser.storage.local.get({'keyRing': {}}).then(function(item) {
|
||||
keepass.keyRing = item.keyRing;
|
||||
if (keepass.isAssociated() && !keepass.keyRing[keepass.associated.hash]) {
|
||||
keepass.associated = {
|
||||
"value": false,
|
||||
"hash": null
|
||||
};
|
||||
}
|
||||
callback(item.keyRing);
|
||||
}, (err) => {
|
||||
console.log('error loading keyRing: ' + err);
|
||||
});
|
||||
}
|
||||
|
||||
event.onSaveSettings = function(callback, tab, settings) {
|
||||
localStorage.settings = JSON.stringify(settings);
|
||||
event.onLoadSettings();
|
||||
browser.storage.local.set({'settings': settings}).then(function() {
|
||||
event.onLoadSettings();
|
||||
});
|
||||
}
|
||||
|
||||
event.onGetStatus = function(callback, tab) {
|
||||
|
|
@ -237,7 +242,6 @@ event.messageHandlers = {
|
|||
'check_update_keepassxc': event.onCheckUpdateKeePassXC,
|
||||
'get_connected_database': event.onGetConnectedDatabase,
|
||||
'get_keepassxc_versions': event.onGetKeePassXCVersions,
|
||||
'get_settings': event.onGetSettings,
|
||||
'get_status': event.onGetStatus,
|
||||
'get_tab_information': event.onGetTabInformation,
|
||||
'load_keyring': event.onLoadKeyRing,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,21 @@ httpAuth.proxyUrl = null;
|
|||
httpAuth.resolve = null;
|
||||
httpAuth.reject = null;
|
||||
|
||||
httpAuth.handleRequest = function (details, callback) {
|
||||
httpAuth.handleRequest = function(details) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (httpAuth.requestId == details.requestId || !page.tabs[details.tabId]) {
|
||||
reject({});
|
||||
}
|
||||
else {
|
||||
httpAuth.requestId = details.requestId;
|
||||
httpAuth.resolve = resolve;
|
||||
httpAuth.reject = reject;
|
||||
httpAuth.processPendingCallbacks(details);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
httpAuth.handleRequestChrome = function(details, callback) {
|
||||
if (httpAuth.requestId == details.requestId || !page.tabs[details.tabId]) {
|
||||
callback({});
|
||||
}
|
||||
|
|
@ -21,12 +35,14 @@ httpAuth.handleRequest = function (details, callback) {
|
|||
}
|
||||
|
||||
httpAuth.processPendingCallbacks = function(details) {
|
||||
httpAuth.callback = httpAuth.pendingCallbacks.pop();
|
||||
if (!isFirefox) {
|
||||
httpAuth.callback = httpAuth.pendingCallbacks.pop();
|
||||
}
|
||||
httpAuth.tabId = details.tabId;
|
||||
httpAuth.url = details.url;
|
||||
httpAuth.isProxy = details.isProxy;
|
||||
|
||||
if (details.challenger){
|
||||
if (details.challenger) {
|
||||
httpAuth.proxyUrl = details.challenger.host;
|
||||
}
|
||||
|
||||
|
|
@ -35,8 +51,7 @@ httpAuth.processPendingCallbacks = function(details) {
|
|||
// chrome.tabs.get(tabId, callback) <-- but what should callback be?
|
||||
|
||||
const url = (httpAuth.isProxy && httpAuth.proxyUrl) ? httpAuth.proxyUrl : httpAuth.url;
|
||||
|
||||
keepass.retrieveCredentials(httpAuth.loginOrShowCredentials, { 'id' : details.tabId }, url, url, true);
|
||||
keepass.retrieveCredentials(httpAuth.loginOrShowCredentials, { "id" : details.tabId }, url, url, true);
|
||||
}
|
||||
|
||||
httpAuth.loginOrShowCredentials = function(logins) {
|
||||
|
|
@ -47,19 +62,29 @@ httpAuth.loginOrShowCredentials = function(logins) {
|
|||
//generate popup-list for HTTP Auth usernames + descriptions
|
||||
|
||||
if (page.settings.autoFillAndSend) {
|
||||
httpAuth.callback({
|
||||
authCredentials: {
|
||||
username: logins[0].login,
|
||||
password: logins[0].password
|
||||
}
|
||||
});
|
||||
if (isFirefox) {
|
||||
httpAuth.resolve({
|
||||
authCredentials: {
|
||||
username: logins[0].login,
|
||||
password: logins[0].password
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
httpAuth.callback({
|
||||
authCredentials: {
|
||||
username: logins[0].login,
|
||||
password: logins[0].password
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
httpAuth.callback({});
|
||||
isFirefox ? httpAuth.reject({}) : httpAuth.callback({});
|
||||
}
|
||||
}
|
||||
// no logins found
|
||||
else {
|
||||
httpAuth.callback({});
|
||||
isFirefox ? httpAuth.reject({}) : httpAuth.callback({});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
/*
|
||||
keepass.convertKeyToKeyRing();
|
||||
page.initSettings();
|
||||
page.initOpenedTabs();
|
||||
|
|
@ -6,12 +7,30 @@ keepass.generateNewKeyPair();
|
|||
keepass.changePublicKeys(null, (pkRes) => {
|
||||
keepass.getDatabaseHash((gdRes) => {}, null);
|
||||
});
|
||||
*/
|
||||
|
||||
// Set initial tab-ID
|
||||
browser.tabs.query({"active": true, "currentWindow": true}, (tabs) => {
|
||||
if (tabs.length === 0)
|
||||
return; // For example: only the background devtools or a popup are opened
|
||||
page.currentTabId = tabs[0].id;
|
||||
// since version 2.0 the extension is using a keyRing instead of a single key-name-pair
|
||||
keepass.migrateKeyRing().then(() => {
|
||||
// load settings
|
||||
page.initSettings().then(() => {
|
||||
// initial connection with KeePassHttp
|
||||
keepass.connectToNative();
|
||||
keepass.generateNewKeyPair();
|
||||
keepass.changePublicKeys(null, (pkRes) => {
|
||||
keepass.getDatabaseHash((gdRes) => {
|
||||
// create tab information structure for every opened tab
|
||||
page.initOpenedTabs();
|
||||
|
||||
// set initial tab-ID
|
||||
browser.tabs.query({"active": true, "currentWindow": true}).then(function(tabs) {
|
||||
if (tabs.length === 0)
|
||||
return; // For example: only the background devtools or a popup are opened
|
||||
page.currentTabId = tabs[0].id;
|
||||
browserAction.show(null, tabs[0]);
|
||||
});
|
||||
}, null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Milliseconds for intervall (e.g. to update browserAction)
|
||||
|
|
@ -55,8 +74,7 @@ browser.tabs.onActivated.addListener((activeInfo) => {
|
|||
page.clearCredentials(page.currentTabId, true);
|
||||
browserAction.removeRememberPopup(null, {'id': page.currentTabId}, true);
|
||||
|
||||
browser.tabs.get(activeInfo.tabId, (info) => {
|
||||
//console.log(info.id + ': ' + info.url);
|
||||
browser.tabs.get(activeInfo.tabId).then((info) => {
|
||||
if (info && info.id) {
|
||||
page.currentTabId = info.id;
|
||||
if (info.status === 'complete') {
|
||||
|
|
@ -79,9 +97,16 @@ browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
|||
});
|
||||
|
||||
// Retrieve Credentials and try auto-login for HTTPAuth requests
|
||||
browser.webRequest.onAuthRequired.addListener(httpAuth.handleRequest,
|
||||
{ urls: ['<all_urls>'] }, ['asyncBlocking']
|
||||
);
|
||||
if (browser.webRequest.onAuthRequired) {
|
||||
if (isFirefox) {
|
||||
browser.webRequest.onAuthRequired.addListener(httpAuth.handleRequest,
|
||||
{ urls: ["<all_urls>"] }, ["blocking"]);
|
||||
}
|
||||
else {
|
||||
browser.webRequest.onAuthRequired.addListener(httpAuth.handleRequestChrome,
|
||||
{ urls: ["<all_urls>"] }, ["asyncBlocking"]);
|
||||
}
|
||||
}
|
||||
|
||||
browser.runtime.onMessage.addListener(event.onMessage);
|
||||
|
||||
|
|
@ -100,7 +125,7 @@ for (const item of contextMenuItems) {
|
|||
onclick: (info, tab) => {
|
||||
browser.tabs.sendMessage(tab.id, {
|
||||
action: item.action
|
||||
});
|
||||
}).catch((e) => {console.log(e);});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,14 @@ const kpErrors = {
|
|||
}
|
||||
};
|
||||
|
||||
browser.storage.local.get({
|
||||
'latestKeePassXC': {'version': 0, 'versionParsed': 0, 'lastChecked': null},
|
||||
'keyRing': {}})
|
||||
.then((item) => {
|
||||
keepass.latestKeePassHttp = item.latestKeePassHttp;
|
||||
keepass.keyRing = item.keyRing;
|
||||
});
|
||||
|
||||
keepass.addCredentials = function(callback, tab, username, password, url) {
|
||||
keepass.updateCredentials(callback, tab, null, username, password, url);
|
||||
}
|
||||
|
|
@ -551,23 +559,29 @@ keepass.isAssociated = function() {
|
|||
return (keepass.associated.value && keepass.associated.hash && keepass.associated.hash === keepass.databaseHash);
|
||||
}
|
||||
|
||||
keepass.convertKeyToKeyRing = function() {
|
||||
if (keepass.keyId in localStorage && keepass.keyBody in localStorage && !('keyRing' in localStorage)) {
|
||||
keepass.getDatabaseHash((hash) => {
|
||||
keepass.saveKey(hash, localStorage[keepass.keyId], localStorage[keepass.keyBody]);
|
||||
|
||||
keepass.migrateKeyRing = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
browser.storage.local.get('keyRing').then((item) => {
|
||||
var keyring = item.keyRing;
|
||||
if ('keyRing' in localStorage) {
|
||||
if (!keyring) {
|
||||
keyring = JSON.parse(localStorage['keyRing']);
|
||||
browser.storage.local.set({'keyRing': keyring});
|
||||
}
|
||||
delete localStorage['keyRing'];
|
||||
}
|
||||
if (keepass.keyId in localStorage && keepass.keyBody in localStorage) {
|
||||
if (!keyring) {
|
||||
var hash = keepass.getDatabaseHash(null);
|
||||
keepass.saveKey(hash, localStorage[keepass.keyId], localStorage[keepass.keyBody]);
|
||||
}
|
||||
delete localStorage[keepass.keyId];
|
||||
delete localStorage[keepass.keyBody];
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
if ('keyRing' in localStorage) {
|
||||
delete localStorage[keepass.keyId];
|
||||
delete localStorage[keepass.keyBody];
|
||||
}
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
keepass.saveKey = function(hash, id, key) {
|
||||
if (!(hash in keepass.keyRing)) {
|
||||
|
|
@ -584,19 +598,19 @@ keepass.saveKey = function(hash, id, key) {
|
|||
keepass.keyRing[hash].key = key;
|
||||
keepass.keyRing[hash].hash = hash;
|
||||
}
|
||||
localStorage.keyRing = JSON.stringify(keepass.keyRing);
|
||||
browser.storage.local.set({'keyRing': keepass.keyRing});
|
||||
}
|
||||
|
||||
keepass.updateLastUsed = function(hash) {
|
||||
if ((hash in keepass.keyRing)) {
|
||||
keepass.keyRing[hash].lastUsed = new Date();
|
||||
localStorage.keyRing = JSON.stringify(keepass.keyRing);
|
||||
browser.storage.local.set({'keyRing': keepass.keyRing});
|
||||
}
|
||||
}
|
||||
|
||||
keepass.deleteKey = function(hash) {
|
||||
delete keepass.keyRing[hash];
|
||||
localStorage.keyRing = JSON.stringify(keepass.keyRing);
|
||||
browser.storage.local.set({'keyRing': keepass.keyRing});
|
||||
}
|
||||
|
||||
keepass.setcurrentKeePassXCVersion = function(version) {
|
||||
|
|
@ -635,7 +649,7 @@ keepass.checkForNewKeePassXCVersion = function() {
|
|||
}
|
||||
|
||||
if (version !== -1) {
|
||||
localStorage.latestKeePassXC = JSON.stringify(keepass.latestKeePassXC);
|
||||
browser.storage.local.set({'latestKeePassXC': keepass.latestKeePassXC});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -15,34 +15,56 @@ page.currentTabId = -1;
|
|||
page.settings = (typeof(localStorage.settings) === 'undefined') ? {} : JSON.parse(localStorage.settings);
|
||||
page.blockedTabs = {};
|
||||
|
||||
page.migrateSettings = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const old = localStorage.getItem('settings');
|
||||
if (old) {
|
||||
const settings = JSON.parse(old);
|
||||
browser.storage.local.set({'settings': settings}).then(() => {
|
||||
localStorage.removeItem('settings');
|
||||
resolve(obj);
|
||||
});
|
||||
} else {
|
||||
event.onLoadSettings((settings) => {
|
||||
resolve(settings);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
page.initSettings = function() {
|
||||
event.onLoadSettings();
|
||||
if (!('checkUpdateKeePassXC' in page.settings)) {
|
||||
page.settings.checkUpdateKeePassXC = defaultSettings.checkUpdateKeePassXC;
|
||||
}
|
||||
if (!('autoCompleteUsernames' in page.settings)) {
|
||||
page.settings.autoCompleteUsernames = defaultSettings.autoCompleteUsernames;
|
||||
}
|
||||
if (!('autoFillAndSend' in page.settings)) {
|
||||
page.settings.autoFillAndSend = defaultSettings.autoFillAndSend;
|
||||
}
|
||||
if (!('usePasswordGenerator' in page.settings)) {
|
||||
page.settings.usePasswordGenerator = defaultSettings.usePasswordGenerator;
|
||||
}
|
||||
if (!('autoFillSingleEntry' in page.settings)) {
|
||||
page.settings.autoFillSingleEntry = defaultSettings.autoFillSingleEntry;
|
||||
}
|
||||
if (!('autoRetrieveCredentials' in page.settings)) {
|
||||
page.settings.autoRetrieveCredentials = defaultSettings.autoRetrieveCredentials;
|
||||
}
|
||||
if (!('port' in page.settings)) {
|
||||
page.settings.port = defaultSettings.proxyPort;
|
||||
}
|
||||
localStorage.settings = JSON.stringify(page.settings);
|
||||
return new Promise((resolve, reject) => {
|
||||
page.migrateSettings().then((settings) => {
|
||||
page.settings = settings;
|
||||
if (!('checkUpdateKeePassXC' in page.settings)) {
|
||||
page.settings.checkUpdateKeePassXC = defaultSettings.checkUpdateKeePassXC;
|
||||
}
|
||||
if (!('autoCompleteUsernames' in page.settings)) {
|
||||
page.settings.autoCompleteUsernames = defaultSettings.autoCompleteUsernames;
|
||||
}
|
||||
if (!('autoFillAndSend' in page.settings)) {
|
||||
page.settings.autoFillAndSend = defaultSettings.autoFillAndSend;
|
||||
}
|
||||
if (!('usePasswordGenerator' in page.settings)) {
|
||||
page.settings.usePasswordGenerator = defaultSettings.usePasswordGenerator;
|
||||
}
|
||||
if (!('autoFillSingleEntry' in page.settings)) {
|
||||
page.settings.autoFillSingleEntry = defaultSettings.autoFillSingleEntry;
|
||||
}
|
||||
if (!('autoRetrieveCredentials' in page.settings)) {
|
||||
page.settings.autoRetrieveCredentials = defaultSettings.autoRetrieveCredentials;
|
||||
}
|
||||
if (!('port' in page.settings)) {
|
||||
page.settings.port = defaultSettings.proxyPort;
|
||||
}
|
||||
browser.storage.local.set({'settings': page.settings});
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
page.initOpenedTabs = function() {
|
||||
browser.tabs.query({}, (tabs) => {
|
||||
browser.tabs.query({}).then((tabs) => {
|
||||
for (const i of tabs) {
|
||||
page.createTabEntry(i.id);
|
||||
}
|
||||
|
|
@ -57,7 +79,7 @@ page.isValidProtocol = function(url) {
|
|||
|
||||
page.switchTab = function(callback, tab) {
|
||||
browserAction.showDefault(null, tab);
|
||||
browser.tabs.sendMessage(tab.id, {action: 'activated_tab'});
|
||||
browser.tabs.sendMessage(tab.id, {action: 'activated_tab'}).catch((e) => {console.log(e);});
|
||||
}
|
||||
|
||||
page.clearCredentials = function(tabId, complete) {
|
||||
|
|
@ -73,7 +95,7 @@ page.clearCredentials = function(tabId, complete) {
|
|||
|
||||
browser.tabs.sendMessage(tabId, {
|
||||
action: 'clear_credentials'
|
||||
});
|
||||
}).catch((e) => {console.log(e);});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
9
keepassxc-browser/browser-polyfill.min.js
vendored
Normal file
9
keepassxc-browser/browser-polyfill.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,4 @@
|
|||
var isFirefox = false;
|
||||
if (typeof browser !== 'undefined') {
|
||||
if (!(/Chrome/.test(navigator.userAgent) && /Google/.test(navigator.vendor))) {
|
||||
isFirefox = true;
|
||||
}
|
||||
|
||||
window.browser = (function () { return window.msBrowser || window.browser || window.chrome; })();
|
||||
}
|
||||
|
|
@ -52,9 +52,9 @@ browser.runtime.onMessage.addListener(function(req, sender, callback) {
|
|||
}
|
||||
else if (req.action === 'redetect_fields') {
|
||||
browser.runtime.sendMessage({
|
||||
action: 'get_settings',
|
||||
}, (response) => {
|
||||
cip.settings = response.data;
|
||||
action: 'load_settings',
|
||||
}).then((settings) => {
|
||||
cip.settings = settings;
|
||||
cip.initCredentialFields(true);
|
||||
});
|
||||
}
|
||||
|
|
@ -254,7 +254,7 @@ cipPassword.createDialog = function() {
|
|||
e.preventDefault();
|
||||
browser.runtime.sendMessage({
|
||||
action: 'generate_password'
|
||||
}, cipPassword.callbackGeneratedPassword);
|
||||
}).then(cipPassword.callbackGeneratedPassword);
|
||||
}
|
||||
},
|
||||
'Copy':
|
||||
|
|
@ -419,7 +419,7 @@ cipPassword.callbackGeneratedPassword = function(entries) {
|
|||
cipPassword.onRequestPassword = function() {
|
||||
browser.runtime.sendMessage({
|
||||
action: 'generate_password'
|
||||
}, cipPassword.callbackGeneratedPassword);
|
||||
}).then(cipPassword.callbackGeneratedPassword);
|
||||
}
|
||||
|
||||
cipPassword.checkObservedElements = function() {
|
||||
|
|
@ -1102,9 +1102,9 @@ jQuery(function() {
|
|||
|
||||
cip.init = function() {
|
||||
browser.runtime.sendMessage({
|
||||
action: 'get_settings',
|
||||
}, (response) => {
|
||||
cip.settings = response.data;
|
||||
action: 'load_settings',
|
||||
}).then((settings) => {
|
||||
cip.settings = settings;
|
||||
cip.initCredentialFields();
|
||||
});
|
||||
}
|
||||
|
|
@ -1139,7 +1139,7 @@ cip.initCredentialFields = function(forceCall) {
|
|||
browser.runtime.sendMessage({
|
||||
action: 'retrieve_credentials',
|
||||
args: [ cip.url, cip.submitUrl ]
|
||||
}, cip.retrieveCredentialsCallback);
|
||||
}).then(cip.retrieveCredentialsCallback);
|
||||
}
|
||||
} // end function init
|
||||
|
||||
|
|
@ -1160,11 +1160,11 @@ cip.receiveCredentialsIfNecessary = function () {
|
|||
browser.runtime.sendMessage({
|
||||
action: 'retrieve_credentials',
|
||||
args: [ cip.url, cip.submitUrl ]
|
||||
}, cip.retrieveCredentialsCallback);
|
||||
}).then(cip.retrieveCredentialsCallback);
|
||||
}
|
||||
}
|
||||
|
||||
cip.retrieveCredentialsCallback = function (credentials, dontAutoFillIn) {
|
||||
cip.retrieveCredentialsCallback = function(credentials, dontAutoFillIn) {
|
||||
if (cipFields.combinations.length > 0) {
|
||||
cip.u = _f(cipFields.combinations[0].username);
|
||||
cip.p = _f(cipFields.combinations[0].password);
|
||||
|
|
@ -1301,7 +1301,7 @@ cip.fillInCredentials = function(combination, onlyPassword, suppressWarnings) {
|
|||
browser.runtime.sendMessage({
|
||||
action: 'retrieve_credentials',
|
||||
args: [ cip.url, cip.submitUrl, false, true ]
|
||||
}, (credentials) => {
|
||||
}).then((credentials) => {
|
||||
cip.retrieveCredentialsCallback(credentials, true);
|
||||
cip.fillIn(combination, onlyPassword, suppressWarnings);
|
||||
});
|
||||
|
|
@ -1692,6 +1692,6 @@ cipEvents.triggerActivatedTab = function() {
|
|||
browser.runtime.sendMessage({
|
||||
action: 'retrieve_credentials',
|
||||
args: [ cip.url, cip.submitUrl ]
|
||||
}, cip.retrieveCredentialsCallback);
|
||||
}).then(cip.retrieveCredentialsCallback);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "keepassxc-browser",
|
||||
"version": "0.2.9",
|
||||
"version": "0.3.0",
|
||||
"description": "KeePassXC integration for modern web browsers",
|
||||
"author": "Sami Vänttinen",
|
||||
"icons": {
|
||||
|
|
@ -24,6 +24,7 @@
|
|||
},
|
||||
"background": {
|
||||
"scripts": [
|
||||
"browser-polyfill.min.js",
|
||||
"global.js",
|
||||
"background/nacl.min.js",
|
||||
"background/nacl-util.min.js",
|
||||
|
|
@ -38,10 +39,10 @@
|
|||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"http://*/*",
|
||||
"https://*/*"
|
||||
"<all_urls>"
|
||||
],
|
||||
"js": [
|
||||
"browser-polyfill.min.js",
|
||||
"global.js",
|
||||
"jquery-3.2.1.min.js",
|
||||
"jquery-ui.min.js",
|
||||
|
|
@ -75,9 +76,11 @@
|
|||
"icons/key.png"
|
||||
],
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
"contextMenus",
|
||||
"clipboardWrite",
|
||||
"nativeMessaging",
|
||||
"storage",
|
||||
"tabs",
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="options.css" />
|
||||
<script type="text/javascript" src="../browser-polyfill.min.js"></script>
|
||||
<script type="text/javascript" src="../global.js"></script>
|
||||
<script type="text/javascript" src="../jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="bootstrap.min.js"></script>
|
||||
|
|
@ -307,7 +308,7 @@
|
|||
</div>
|
||||
<hr>
|
||||
<div class="footer">
|
||||
<p>2010-2017 - Perry Nguyen, Lukas Schulze, Sami Vänttinen</p>
|
||||
<p>2010-2017 - Perry Nguyen, Lukas Schulze, Angus Gratton, Andy Brandt, Sami Vänttinen</p>
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -3,17 +3,34 @@ if (jQuery) {
|
|||
}
|
||||
|
||||
$(function() {
|
||||
options.initMenu();
|
||||
options.initGeneralSettings();
|
||||
options.initConnectedDatabases();
|
||||
options.initSpecifiedCredentialFields();
|
||||
options.initAbout();
|
||||
browser.runtime.sendMessage({ action: 'load_settings' }).then((settings) => {
|
||||
options.settings = settings;
|
||||
browser.runtime.sendMessage({ action: 'load_keyring' }).then((keyRing) => {
|
||||
options.keyRing = keyRing;
|
||||
options.initMenu();
|
||||
options.initGeneralSettings();
|
||||
options.initConnectedDatabases();
|
||||
options.initSpecifiedCredentialFields();
|
||||
options.initAbout();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var options = options || {};
|
||||
|
||||
options.settings = typeof(localStorage.settings) === 'undefined' ? {} : JSON.parse(localStorage.settings);
|
||||
options.keyRing = typeof(localStorage.keyRing) === 'undefined' ? {} : JSON.parse(localStorage.keyRing);
|
||||
options.saveSettings = function() {
|
||||
browser.storage.local.set({'settings': options.settings});
|
||||
browser.runtime.sendMessage({
|
||||
action: 'load_settings'
|
||||
});
|
||||
};
|
||||
|
||||
options.saveKeyRing = function() {
|
||||
browser.storage.local.set({'keyRing': options.keyRing});
|
||||
browser.runtime.sendMessage({
|
||||
action: 'load_keyring'
|
||||
});
|
||||
};
|
||||
|
||||
options.initMenu = function() {
|
||||
$('.navbar:first ul.nav:first li a').click(function(e) {
|
||||
|
|
@ -31,12 +48,7 @@ options.saveSetting = function(name) {
|
|||
const $id = '#' + name;
|
||||
$($id).closest('.control-group').removeClass('error').addClass('success');
|
||||
setTimeout(() => { $($id).closest('.control-group').removeClass('success') }, 2500);
|
||||
|
||||
localStorage.settings = JSON.stringify(options.settings);
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'load_settings'
|
||||
});
|
||||
options.saveSettings();
|
||||
}
|
||||
|
||||
options.initGeneralSettings = function() {
|
||||
|
|
@ -46,38 +58,30 @@ options.initGeneralSettings = function() {
|
|||
|
||||
$('#tab-general-settings input[type=checkbox]').change(function() {
|
||||
options.settings[$(this).attr('name')] = $(this).is(':checked');
|
||||
localStorage.settings = JSON.stringify(options.settings);
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'load_settings'
|
||||
});
|
||||
options.saveSettings();
|
||||
});
|
||||
|
||||
$('#tab-general-settings input[type=radio]').each(function() {
|
||||
if($(this).val() === options.settings[$(this).attr('name')]) {
|
||||
if ($(this).val() === options.settings[$(this).attr('name')]) {
|
||||
$(this).attr('checked', options.settings[$(this).attr('name')]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#tab-general-settings input[type=radio]').change(function() {
|
||||
options.settings[$(this).attr('name')] = $(this).val();
|
||||
localStorage.settings = JSON.stringify(options.settings);
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'load_settings'
|
||||
});
|
||||
options.saveSettings();
|
||||
});
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'get_keepassxc_versions'
|
||||
}, options.showKeePassXCVersions);
|
||||
}).then(options.showKeePassXCVersions);
|
||||
|
||||
$('#tab-general-settings button.checkUpdateKeePassXC:first').click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).attr('disabled', true);
|
||||
browser.runtime.sendMessage({
|
||||
action: 'check_update_keepassxc'
|
||||
}, options.showKeePassXCVersions);
|
||||
}).then(options.showKeePassXCVersions);
|
||||
});
|
||||
|
||||
$('#port').val(options.settings['port']);
|
||||
|
|
@ -152,11 +156,7 @@ options.initConnectedDatabases = function() {
|
|||
$('#tab-connected-databases #tr-cd-' + $hash).remove();
|
||||
|
||||
delete options.keyRing[$hash];
|
||||
localStorage.keyRing = JSON.stringify(options.keyRing);
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'load_keyring'
|
||||
});
|
||||
options.saveKeyRing();
|
||||
|
||||
if ($('#tab-connected-databases table tbody:first tr').length > 2) {
|
||||
$('#tab-connected-databases table tbody:first tr.empty:first').hide();
|
||||
|
|
@ -218,11 +218,7 @@ options.initSpecifiedCredentialFields = function() {
|
|||
$('#tab-specified-fields #' + $trId).remove();
|
||||
|
||||
delete options.settings['defined-credential-fields'][$url];
|
||||
localStorage.settings = JSON.stringify(options.settings);
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'load_settings'
|
||||
});
|
||||
options.saveSettings();
|
||||
|
||||
if($('#tab-specified-fields table tbody:first tr').length > 2) {
|
||||
$('#tab-specified-fields table tbody:first tr.empty:first').hide();
|
||||
|
|
@ -235,7 +231,7 @@ options.initSpecifiedCredentialFields = function() {
|
|||
const $trClone = $('#tab-specified-fields table tr.clone:first').clone(true);
|
||||
$trClone.removeClass('clone');
|
||||
let counter = 1;
|
||||
for(let url in options.settings['defined-credential-fields']) {
|
||||
for (let url in options.settings['defined-credential-fields']) {
|
||||
const $tr = $trClone.clone(true);
|
||||
$tr.data('url', url);
|
||||
$tr.attr('id', 'tr-scf' + counter);
|
||||
|
|
@ -245,7 +241,7 @@ options.initSpecifiedCredentialFields = function() {
|
|||
$('#tab-specified-fields table tbody:first').append($tr);
|
||||
}
|
||||
|
||||
if($('#tab-specified-fields table tbody:first tr').length > 2) {
|
||||
if ($('#tab-specified-fields table tbody:first tr').length > 2) {
|
||||
$('#tab-specified-fields table tbody:first tr.empty:first').hide();
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="popup.css" />
|
||||
<link rel="stylesheet" href="../options/bootstrap.min.css" />
|
||||
<script type="text/javascript" src="../browser-polyfill.min.js"></script>
|
||||
<script type="text/javascript" src="../global.js"></script>
|
||||
<script type="text/javascript" src="../jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="../options/bootstrap.min.js" /></script>
|
||||
|
|
|
|||
|
|
@ -53,18 +53,17 @@ $(function() {
|
|||
$('#reload-status-button').click(function() {
|
||||
browser.runtime.sendMessage({
|
||||
action: 'reconnect'
|
||||
}, status_response);
|
||||
}).then(status_response);
|
||||
});
|
||||
|
||||
$('#reopen-database-button').click(function() {
|
||||
browser.runtime.sendMessage({
|
||||
action: 'get_status'
|
||||
}, status_response);
|
||||
close();
|
||||
}).then(status_response);
|
||||
});
|
||||
|
||||
$('#redetect-fields-button').click(function() {
|
||||
browser.tabs.query({"active": true, "currentWindow": true}, (tabs) => {
|
||||
browser.tabs.query({"active": true, "currentWindow": true}).then((tabs) => {
|
||||
if (tabs.length === 0)
|
||||
return; // For example: only the background devtools or a popup are opened
|
||||
let tab = tabs[0];
|
||||
|
|
@ -77,5 +76,5 @@ $(function() {
|
|||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'get_status'
|
||||
}, status_response);
|
||||
}).then(status_response);
|
||||
});
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
var $ = jQuery.noConflict(true);
|
||||
var _settings = typeof(localStorage.settings) ==='undefined' ? {} : JSON.parse(localStorage.settings);
|
||||
//var _settings = typeof(localStorage.settings) ==='undefined' ? {} : JSON.parse(localStorage.settings);
|
||||
|
||||
function updateAvailableResponse(available) {
|
||||
if (available) {
|
||||
|
|
@ -12,12 +12,11 @@ function updateAvailableResponse(available) {
|
|||
|
||||
function initSettings() {
|
||||
$ ('#settings #btn-options').click(function() {
|
||||
browser.runtime.openOptionsPage();
|
||||
close();
|
||||
browser.runtime.openOptionsPage().then(close());
|
||||
});
|
||||
|
||||
$ ('#settings #btn-choose-credential-fields').click(function() {
|
||||
browser.runtime.getBackgroundPage((global) => {
|
||||
browser.runtime.getBackgroundPage().then((global) => {
|
||||
browser.tabs.sendMessage(global.page.currentTabId, {
|
||||
action: 'choose_credential_fields'
|
||||
});
|
||||
|
|
@ -32,5 +31,5 @@ $(function() {
|
|||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'update_available_keepassxc'
|
||||
}, updateAvailableResponse);
|
||||
}).then(updateAvailableResponse);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="popup.css" />
|
||||
<link rel="stylesheet" href="../options/bootstrap.min.css" />
|
||||
<script type="text/javascript" src="../browser-polyfill.min.js"></script>
|
||||
<script type="text/javascript" src="../global.js"></script>
|
||||
<script type="text/javascript" src="../jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="../options/bootstrap.min.js" /></script>
|
||||
|
|
@ -12,8 +13,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="settings" class="settings">
|
||||
<button id="btn-options" class="btn btn-sm btn-warning">Settings</button>
|
||||
<button id="btn-choose-credential-fields" class="btn btn-sm">Choose own credential fields for this page</button>
|
||||
<button id="btn-options" class="btn btn-sm btn-success">Settings</button>
|
||||
<button id="btn-choose-credential-fields" class="btn btn-sm btn-default">Choose own credential fields for this page</button>
|
||||
|
||||
<div id="update-available">
|
||||
You use an old version of KeePassXC.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
$(function() {
|
||||
browser.runtime.getBackgroundPage(function(global) {
|
||||
browser.tabs.query({"active": true, "currentWindow": true}, (tab) => {
|
||||
browser.runtime.getBackgroundPage().then((global) => {
|
||||
browser.tabs.query({"active": true, "currentWindow": true}.then((tab) => {
|
||||
const data = global.page.tabs[tab.id].loginList;
|
||||
let ul = document.getElementById('login-list');
|
||||
for (let i = 0; i < data.logins.length; i++) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="popup.css" />
|
||||
<link rel="stylesheet" href="../options/bootstrap.min.css" />
|
||||
<script type="text/javascript" src="../browser-polyfill.min.js"></script>
|
||||
<script type="text/javascript" src="../global.js"></script>
|
||||
<script type="text/javascript" src="../jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="../options/bootstrap.min.js" /></script>
|
||||
|
|
@ -12,8 +13,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="settings" class="settings">
|
||||
<button id="btn-options" class="btn btn-sm btn-warning">Settings</button>
|
||||
<button id="btn-choose-credential-fields" class="btn btn-sm">Choose own credential fields for this page</button>
|
||||
<button id="btn-options" class="btn btn-sm btn-success">Settings</button>
|
||||
<button id="btn-choose-credential-fields" class="btn btn-sm btn-default">Choose own credential fields for this page</button>
|
||||
|
||||
<div id="update-available">
|
||||
You use an old version of KeePassXC.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
$(function() {
|
||||
browser.runtime.getBackgroundPage(function(global) {
|
||||
browser.tabs.query({"active": true, "currentWindow": true}, (tabs) => {
|
||||
browser.runtime.getBackgroundPage().then((global) => {
|
||||
browser.tabs.query({"active": true, "currentWindow": true}).then((tabs) => {
|
||||
if (tabs.length === 0)
|
||||
return; // For example: only the background devtools or a popup are opened
|
||||
const tab = tabs[0];
|
||||
|
|
@ -14,7 +14,7 @@ $(function() {
|
|||
li.appendChild(a);
|
||||
a.setAttribute('id', '' + i);
|
||||
a.addEventListener('click', (e) => {
|
||||
var id = e.target.id;
|
||||
const id = e.target.id;
|
||||
browser.tabs.sendMessage(tab.id, {
|
||||
action: 'fill_user_pass_with_specific_login',
|
||||
id: id
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="popup.css" />
|
||||
<link rel="stylesheet" href="../options/bootstrap.min.css" />
|
||||
<script type="text/javascript" src="../browser-polyfill.min.js"></script>
|
||||
<script type="text/javascript" src="../global.js"></script>
|
||||
<script type="text/javascript" src="../jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="../options/bootstrap.min.js" /></script>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="popup.css" />
|
||||
<link rel="stylesheet" href="../options/bootstrap.min.css" />
|
||||
<script type="text/javascript" src="../browser-polyfill.min.js"></script>
|
||||
<script type="text/javascript" src="../global.js"></script>
|
||||
<script type="text/javascript" src="../jquery-3.2.1.min.js"></script>
|
||||
<script type="text/javascript" src="../options/bootstrap.min.js" /></script>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function _initialize(tab) {
|
|||
browser.runtime.sendMessage({
|
||||
action: 'add_credentials',
|
||||
args: [_tab.credentials.username, _tab.credentials.password, _tab.credentials.url]
|
||||
}, _verifyResult);
|
||||
}).then(_verifyResult);
|
||||
});
|
||||
|
||||
$('#btn-update').click(function(e) {
|
||||
|
|
@ -34,7 +34,7 @@ function _initialize(tab) {
|
|||
browser.runtime.sendMessage({
|
||||
action: 'update_credentials',
|
||||
args: [_tab.credentials.list[0].uuid, _tab.credentials.username, _tab.credentials.password, _tab.credentials.url]
|
||||
}, _verifyResult);
|
||||
}).then(_verifyResult);
|
||||
}
|
||||
else {
|
||||
$('.credentials:first .username-new:first strong:first').text(_tab.credentials.username);
|
||||
|
|
@ -59,7 +59,7 @@ function _initialize(tab) {
|
|||
browser.runtime.sendMessage({
|
||||
action: 'update_credentials',
|
||||
args: [_tab.credentials.list[$(this).data('entryId')].uuid, _tab.credentials.username, _tab.credentials.password, _tab.credentials.url]
|
||||
}, _verifyResult);
|
||||
}).then(_verifyResult);
|
||||
});
|
||||
|
||||
if (_tab.credentials.usernameExists && _tab.credentials.username === _tab.credentials.list[i].login) {
|
||||
|
|
@ -116,9 +116,9 @@ $(function() {
|
|||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'get_tab_information'
|
||||
}, _initialize);
|
||||
}).then(_initialize);
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'get_connected_database'
|
||||
}, _connected_database);
|
||||
}).then(_connected_database);
|
||||
});
|
||||
Loading…
Reference in a new issue