Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marius-wieschollek/passwords-webextension.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Readme.md4
-rw-r--r--src/js/Manager/BadgeManager.js36
-rw-r--r--src/js/Search/Index/SearchIndex.js17
-rw-r--r--src/platform/chrome/js/Platform/BrowserApi.js4
-rw-r--r--src/vue/Components/Popup/Authorisation.vue6
5 files changed, 39 insertions, 28 deletions
diff --git a/Readme.md b/Readme.md
index 513eb48..5e963ea 100644
--- a/Readme.md
+++ b/Readme.md
@@ -25,7 +25,7 @@ The Passwords App can be downloaded for free from the [Nextcloud app store](http
See [contributing](Contributing.md).
##### Notes for AMO reviewers
-1. This extension uses Vue.js, jQuery, UglifyJS and webpack
-2. This extension requires a Nextcloud 17 server with the Passwords app 2020.1.0 or later
+1. This extension uses Vue.js and webpack
+2. This extension requires a Nextcloud 17+ server with Passwords 2020.1.0+
3. This extension and all required software is available for free
4. See [contributing](Contributing.md). \ No newline at end of file
diff --git a/src/js/Manager/BadgeManager.js b/src/js/Manager/BadgeManager.js
index 2008b9b..ee45a09 100644
--- a/src/js/Manager/BadgeManager.js
+++ b/src/js/Manager/BadgeManager.js
@@ -1,8 +1,8 @@
import SystemService from '@js/Services/SystemService';
import RecommendationManager from '@js/Manager/RecommendationManager';
import TabManager from '@js/Manager/TabManager';
-import QueueService from '@js/Services/QueueService';
import ServerManager from '@js/Manager/ServerManager';
+import ErrorManager from '@js/Manager/ErrorManager';
class BadgeManager {
@@ -13,8 +13,8 @@ class BadgeManager {
init() {
this._api = SystemService.getBrowserApi();
RecommendationManager.listen.on(
- (r) => {
- this._updateBadge(r);
+ async (r) => {
+ await this._updateBadge(r);
}
);
ServerManager.isAuthorized.onChange(
@@ -30,22 +30,26 @@ class BadgeManager {
* @param {Password[]} recommended
* @private
*/
- _updateBadge(recommended) {
+ async _updateBadge(recommended) {
let tabId = TabManager.currentTabId;
+ if(tabId === 0) return;
+
+ try {
+ if(!ServerManager.isAuthorized.get()) {
+ await this._api.browserAction.setBadgeText({text: '!', tabId});
+ } else if(recommended.length !== 0) {
+ await this._api.browserAction.setBadgeText({text: recommended.length.toString(), tabId});
+ } else {
+ await this._api.browserAction.setBadgeText({text: '', tabId});
+ }
- if(!ServerManager.isAuthorized.get()) {
- this._api.browserAction.setBadgeText({text: '!', tabId});
- } else if(recommended.length !== 0) {
- this._api.browserAction.setBadgeText({text: recommended.length.toString(), tabId});
- } else {
- this._api.browserAction.setBadgeText({text: '', tabId});
- }
-
- if(SystemService.getBrowserPlatform() === 'firefox') {
- this._api.browserAction.setBadgeTextColor({color: '#fff'});
+ if(SystemService.getBrowserPlatform() === 'firefox') {
+ await this._api.browserAction.setBadgeTextColor({color: '#fff'});
+ }
+ await this._api.browserAction.setBadgeBackgroundColor({color: '#0082c9'});
+ } catch(e) {
+ ErrorManager.logError(e);
}
-
- this._api.browserAction.setBadgeBackgroundColor({color: '#0082c9'});
}
}
diff --git a/src/js/Search/Index/SearchIndex.js b/src/js/Search/Index/SearchIndex.js
index e2ad781..3470337 100644
--- a/src/js/Search/Index/SearchIndex.js
+++ b/src/js/Search/Index/SearchIndex.js
@@ -4,6 +4,7 @@ import Server from '@js/Models/Server/Server';
import Folder from 'passwords-client/src/Model/Folder';
import Tag from 'passwords-client/src/Model/Tag';
import EventQueue from '@js/Event/EventQueue';
+import ErrorManager from '@js/Manager/ErrorManager';
class SearchIndex {
@@ -17,8 +18,8 @@ class SearchIndex {
};
this._indexes = {
password: [],
- folder: [],
- tag: []
+ folder : [],
+ tag : []
};
this._items = {};
this._onUpdate = new EventQueue();
@@ -96,11 +97,15 @@ class SearchIndex {
let type = this._getItemType(item);
- let index = this._indexers[type].indexItem(item);
- this._indexes[type].push(index);
- this._items[item.getId()] = item;
+ try {
+ let index = this._indexers[type].indexItem(item);
+ this._indexes[type].push(index);
+ this._items[item.getId()] = item;
- if(update) this._onUpdate.emit(this._items);
+ if(update) this._onUpdate.emit(this._items);
+ } catch(e) {
+ ErrorManager.logError(e);
+ }
}
/**
diff --git a/src/platform/chrome/js/Platform/BrowserApi.js b/src/platform/chrome/js/Platform/BrowserApi.js
index 71fa3a8..25695e5 100644
--- a/src/platform/chrome/js/Platform/BrowserApi.js
+++ b/src/platform/chrome/js/Platform/BrowserApi.js
@@ -6,11 +6,11 @@ class BrowserApi {
}
getContextMenu() {
- return browser.contextMenus;
+ return this.getBrowserApi().contextMenus;
}
hasContextMenu() {
- return browser.hasOwnProperty('contextMenus');
+ return this.getBrowserApi().hasOwnProperty('contextMenus');
}
}
diff --git a/src/vue/Components/Popup/Authorisation.vue b/src/vue/Components/Popup/Authorisation.vue
index 0ad1206..5de03c2 100644
--- a/src/vue/Components/Popup/Authorisation.vue
+++ b/src/vue/Components/Popup/Authorisation.vue
@@ -1,5 +1,5 @@
<template>
- <form id="authorisation" @submit.prevent="submit">
+ <form id="authorisation" @submit.prevent="submit" autocomplete="off">
<h2>{{authRequest.getLabel()}}</h2>
<div v-if="authRequest.requiresPassword()" class="password-container">
<input type="password" id="password" v-model="password" placeholder="Password">
@@ -85,7 +85,7 @@
}
);
- this.state = result.getPayload().success ? 'token request failed':'ready';
+ this.state = result.getPayload().success ? 'ready':'token request failed';
}
},
@@ -95,10 +95,12 @@
if(provider.id === value) {
this.tokenField = provider.hasInput;
this.tokenRequest = provider.hasRequest;
+ break;
}
}
this.token = null;
this.authRequest.setProvider(value);
+ if(this.tokenRequest) this.requestToken();
},
token(value) {
this.authRequest.setToken(value);