mirror of
https://github.com/bitwarden/desktop.git
synced 2024-11-14 10:16:02 +01:00
cached sites for current tab page
This commit is contained in:
parent
6f142c3682
commit
072a9606e1
@ -87,6 +87,7 @@ var Folder = function (obj, alreadyEncrypted) {
|
||||
return null;
|
||||
}).then(function (val) {
|
||||
model.uri = val;
|
||||
model.domain = tldjs.getDomain(val);
|
||||
if (self.username) {
|
||||
return self.username.decryptWithPromise();
|
||||
}
|
||||
|
@ -29,61 +29,21 @@ angular
|
||||
$scope.canAutofill = true;
|
||||
});
|
||||
|
||||
var filteredPromises = [],
|
||||
filteredSites = [],
|
||||
promises = [],
|
||||
decSites = [];
|
||||
var filteredSites = [],
|
||||
promises = [];
|
||||
|
||||
siteService.getAll(function (sites) {
|
||||
var sitePromise = $q.when(siteService.getAllDecrypted());
|
||||
sitePromise.then(function (sites) {
|
||||
for (var i = 0; i < sites.length; i++) {
|
||||
var uriPromise = cipherService.decrypt(sites[i].uri, i);
|
||||
filteredPromises.push(uriPromise);
|
||||
uriPromise.then(function (obj) {
|
||||
if (!obj.val) {
|
||||
return;
|
||||
}
|
||||
|
||||
var siteDomain = tldjs.getDomain(obj.val);
|
||||
if (!siteDomain || siteDomain != domain) {
|
||||
return;
|
||||
}
|
||||
|
||||
filteredSites.push(obj.index);
|
||||
});
|
||||
}
|
||||
|
||||
$q.all(filteredPromises).then(function () {
|
||||
for (var j = 0; j < filteredSites.length; j++) {
|
||||
var index = filteredSites[j];
|
||||
decSites.push({
|
||||
id: sites[index].id,
|
||||
folderId: sites[index].folderId,
|
||||
favorite: sites[index].favorite
|
||||
});
|
||||
|
||||
var namePromise = cipherService.decrypt(sites[index].name, j);
|
||||
promises.push(namePromise);
|
||||
namePromise.then(function (obj) {
|
||||
decSites[obj.index].name = obj.val;
|
||||
});
|
||||
|
||||
var usernamePromise = cipherService.decrypt(sites[index].username, j);
|
||||
promises.push(usernamePromise);
|
||||
usernamePromise.then(function (obj) {
|
||||
decSites[obj.index].username = obj.val;
|
||||
});
|
||||
|
||||
var passwordPromise = cipherService.decrypt(sites[index].password, j);
|
||||
promises.push(passwordPromise);
|
||||
passwordPromise.then(function (obj) {
|
||||
decSites[obj.index].password = obj.val;
|
||||
});
|
||||
if (sites[i].domain && sites[i].domain == domain) {
|
||||
filteredSites.push(sites[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
promises.push(sitePromise);
|
||||
|
||||
$q.all(promises).then(function () {
|
||||
$scope.sites = decSites;
|
||||
});
|
||||
});
|
||||
$q.all(promises).then(function () {
|
||||
$scope.sites = filteredSites;
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user