diff --git a/ui/lib/app.js b/ui/lib/app.js index 8502865..1ba16df 100644 --- a/ui/lib/app.js +++ b/ui/lib/app.js @@ -103,7 +103,7 @@ function fetchLatestState (cb) { // update observables app.observ.peers(app.peers) var stats = require('./util').getPubStats() - app.observ.hasSyncIssue(!stats.membersof || !stats.active) + app.observ.hasSyncIssue(stats.hasSyncIssue) for (var k in app.indexCounts) if (app.observ.indexCounts[k]) app.observ.indexCounts[k](app.indexCounts[k]) diff --git a/ui/lib/pages/sync.js b/ui/lib/pages/sync.js index 9de3046..c6f76fd 100644 --- a/ui/lib/pages/sync.js +++ b/ui/lib/pages/sync.js @@ -32,7 +32,7 @@ module.exports = function () { var warning if (stats.membersof === 0) warning = h('p', com.icon('warning-sign'), ' You need to join a pub if you want to communicate across the Internet!') - else if (stats.active === 0) + else if (stats.active === 0 && stats.untried === 0) warning = h('p', com.icon('warning-sign'), ' None of your pubs are responding! Are you connected to the Internet?') return h('.pub-status', diff --git a/ui/lib/util.js b/ui/lib/util.js index 24e0fb7..58bb5b0 100644 --- a/ui/lib/util.js +++ b/ui/lib/util.js @@ -284,7 +284,7 @@ exports.decryptThread = function (thread, cb) { } exports.getPubStats = function () { - var membersof=0, active=0 + var membersof=0, active=0, untried=0 app.peers.forEach(function (peer) { // filter out LAN peers if (peer.host == 'localhost' || peer.host.indexOf('192.168.') === 0) @@ -293,9 +293,12 @@ exports.getPubStats = function () { membersof++ if (peer.time && peer.time.connect && (peer.time.connect > peer.time.attempt) || peer.connected) active++ + if (!peer.time || !peer.time.attempt) + untried++ } }) - return { membersof: membersof, active: active } + + return { membersof: membersof, active: active, untried: untried, hasSyncIssue: (!membersof || (!untried && !active)) } } exports.getExtLinkName = function (link) { diff --git a/ui/main.js b/ui/main.js index ea5cf24..14b8a67 100644 --- a/ui/main.js +++ b/ui/main.js @@ -110,7 +110,7 @@ function onGossipEvent (e) { // update observables app.observ.peers(app.peers) - app.observ.hasSyncIssue(!stats.membersof || !stats.active) + app.observ.hasSyncIssue(stats.hasSyncIssue) } function onReplicationEvent (e) {