From f9d859e5599b7cc7e847c3f50595c530fb1b164c Mon Sep 17 00:00:00 2001 From: Administrator Date: Mon, 4 Nov 2019 13:11:56 +0800 Subject: [PATCH 1/3] Fix the problem of password pop-up being overwritten --- js/background/inject/inject.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/background/inject/inject.js b/js/background/inject/inject.js index 0f662007..f79f8e6d 100644 --- a/js/background/inject/inject.js +++ b/js/background/inject/inject.js @@ -130,11 +130,13 @@ $j(document).ready(function () { } function getMaxZ() { - return Math.max.apply(null, + var maxIndex = Math.max.apply(null, $j.map($j('body *'), function (e) { if ($j(e).css('position') !== 'static') return parseInt($j(e).css('z-index')) || 1; })); + maxIndex = maxIndex>0?maxIndex:9999; + return maxIndex; } var activeForm; From ada89fd94b45e7334578bd1b303c0f00af3101a0 Mon Sep 17 00:00:00 2001 From: xuzhao9 Date: Fri, 3 Aug 2018 10:10:42 -0400 Subject: [PATCH 2/3] Added retry when getting empty reply from the server. --- js/lib/api.js | 2 +- js/ui/popup/controllers/setup.js | 39 +++++++++++++++++++++++--------- manifest.json | 4 ---- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/js/lib/api.js b/js/lib/api.js index a2e6d5b1..3a9ef4d4 100644 --- a/js/lib/api.js +++ b/js/lib/api.js @@ -218,7 +218,7 @@ window.PAPI = (function () { var timeoutTimer = setTimeout(function () { API.notifications.create('Error', 'Error connecting to server (Error: Connection timeout)'); callback({error: true, result: {statusText: 'Connection timeout', status: 0}}); - }, 10000); + }, 30000); fetch(request).then(function(response){ clearTimeout(timeoutTimer); diff --git a/js/ui/popup/controllers/setup.js b/js/ui/popup/controllers/setup.js index a7ab4d33..9f43d29b 100644 --- a/js/ui/popup/controllers/setup.js +++ b/js/ui/popup/controllers/setup.js @@ -79,17 +79,34 @@ PAPI.username = $scope.settings.nextcloud_username; PAPI.password = $scope.settings.nextcloud_password; PAPI.getVaults(function (vaults) { - if (vaults.hasOwnProperty('error')) { - var errors = API.i18n.getMessage('invalid_response_from_server', [vaults.result.status, vaults.result.statusText]); - $scope.errors.push(errors); - notify(errors); - callback(false); - } - else { - $scope.vaults = vaults; - callback(true); - } - $scope.$apply(); + if(angular.equals(vaults, [])) { + // retry if returns empty + PAPI.getVaults(function(vaults) { + if (vaults.hasOwnProperty('error')) { + var errors = API.i18n.getMessage('invalid_response_from_server', [vaults.result.status, vaults.result.statusText]); + $scope.errors.push(errors); + notify(errors); + callback(false); + } + else { + $scope.vaults = vaults; + callback(true); + } + $scope.$apply(); + }); + } else { + if (vaults.hasOwnProperty('error')) { + var errors = API.i18n.getMessage('invalid_response_from_server', [vaults.result.status, vaults.result.statusText]); + $scope.errors.push(errors); + notify(errors); + callback(false); + } + else { + $scope.vaults = vaults; + callback(true); + } + $scope.$apply(); + } }); }, vault: function (callback) { diff --git a/manifest.json b/manifest.json index 9a541aec..e27da6bc 100644 --- a/manifest.json +++ b/manifest.json @@ -14,9 +14,6 @@ "64": "icons/icon64.png", "128": "icons/icon128.png" }, - "externally_connectable": { - "ids": [] - }, "background": { "scripts": [ "/js/vendor/jquery/jquery.js", @@ -77,7 +74,6 @@ "https://*/*" ], "all_frames": true, - "jsBuild": [], "js": [ "/js/lib/promise.js", "/js/vendor/sjcl/sjcl.js", From 79df559617ceb92cd12e4f1ab0e059124c02cd51 Mon Sep 17 00:00:00 2001 From: xuzhao9 Date: Fri, 3 Aug 2018 12:18:30 -0400 Subject: [PATCH 3/3] Fixed bug in loading the vaults. --- js/background/service/background.js | 15 ++++++++++++--- manifest.json | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/js/background/service/background.js b/js/background/service/background.js index 99cd1bea..994de9ea 100644 --- a/js/background/service/background.js +++ b/js/background/service/background.js @@ -181,14 +181,21 @@ var background = (function () { if (!master_password) { return; } - //console.log('Loading vault with the following settings: ', settings); + // console.log('Loading vault with the following settings: ', settings); var tmpList = []; for (var i = 0; i < _self.settings.accounts.length; i++) { var account = _self.settings.accounts[i]; /* jshint ignore:start */ (function (inner_account) { - PAPI.getVault(inner_account, function (vault) { + PAPI.host = inner_account.nextcloud_host; + PAPI.username = inner_account.nextcloud_username; + PAPI.password = inner_account.nextcloud_password; + PAPI.getVaults(function(vaults) { + if (vaults.hasOwnProperty('error')) { + return; + } + PAPI.getVault(inner_account, function (vault) { if (vault.hasOwnProperty('error')) { return; } @@ -219,7 +226,9 @@ var background = (function () { getSharedCredentials(inner_account); - }); + }); + }); + }(account)); /* jshint ignore:end */ } diff --git a/manifest.json b/manifest.json index e27da6bc..f1fc1b07 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_extName__", "short_name": "__MSG_extName__", - "version": "2.1.2", + "version": "2.1.7", "manifest_version": 2, "author": "Sander Brand", "default_locale": "en",