summaryrefslogtreecommitdiff
path: root/ui/app/models/account.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/models/account.js')
-rw-r--r--ui/app/models/account.js33
1 files changed, 32 insertions, 1 deletions
diff --git a/ui/app/models/account.js b/ui/app/models/account.js
index 14773602..34104f62 100644
--- a/ui/app/models/account.js
+++ b/ui/app/models/account.js
@@ -98,7 +98,12 @@ export default class Account {
})
// failing that, search by domain
if (!account) {
- let domain = '@' + address.split('@')[1]
+ let domain = null
+ if (address.indexOf('@') == -1) {
+ domain = '@' + address
+ } else {
+ domain = '@' + address.split('@')[1]
+ }
account = Account.list.find(i => {
return i.address == domain
})
@@ -133,6 +138,32 @@ export default class Account {
)
}
+ static vpnReady() {
+ return Provider.list(false).then(domains => {
+ let promises = domains.map(domain => {
+ return new Promise((resolve, reject) => {
+ bitmask.vpn.check(domain).then(status => {
+ if (status.vpn != 'disabled' && status.installed && status.vpn_ready) {
+ resolve(domain)
+ } else {
+ resolve("")
+ }
+ }, error => {
+ resolve("")
+ })
+ })
+ })
+ return Promise.all(promises).then(domains => {
+ domains = domains.filter(i => {
+ return i != ""
+ })
+ return domains.map(domain => {
+ return Account.find(domain)
+ })
+ })
+ })
+ }
+
static add(account) {
if (!Account.list.find(i => {return i.id == account.id})) {
Account.list.push(account)