Skip to content

Commit

Permalink
hotfix: proxy connection on failed (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgithubprofile authored Nov 3, 2022
1 parent 9f3aa22 commit 16fe8cc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/registration/templates/captcha.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="ucaptcha">
<div class="subcaption"><%=e('e13109')%></div>
<div class="subcaption"><%= app.pkoindisable ? e('e13109lg') : e('e13109')%></div>



Expand Down
20 changes: 18 additions & 2 deletions js/lib/client/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ var Proxy16 = function(meta, app, api){
self.ping = rdate.addSeconds(60)
self.successping = true
self.session = r.session
delete self.pingerror

if (r.height && self.currentBlock < r.height){
self.currentBlock = r.height
Expand All @@ -388,6 +389,7 @@ var Proxy16 = function(meta, app, api){
var rdate = new Date()

self.ping = rdate.addSeconds(10)
self.pingerror = true

return Promise.reject(e)
})
Expand All @@ -397,11 +399,20 @@ var Proxy16 = function(meta, app, api){

var promise = null


if(!freshping()){
promise = self.api.ping()
}
else{
promise = Promise.resolve(true)

if(self.pingerror){
promise = Promise.reject()

}
else{
promise = Promise.resolve(true)

}
}

return promise.catch(e => {
Expand Down Expand Up @@ -1320,14 +1331,19 @@ var Api = function(app){
var pr = getproxyas()
var promise = null



if (pr){
promise = pr.api.actualping()
promise = pr.api.actualping().catch(e => {
return Promise.resolve(false)
})
}
else {
promise = Promise.resolve(false)
}

return promise.then(r => {

if(r){
return Promise.resolve(1)
}
Expand Down
8 changes: 4 additions & 4 deletions js/satolist.js
Original file line number Diff line number Diff line change
Expand Up @@ -24394,7 +24394,7 @@ Platform = function (app, listofnodes) {
//var FirebasePlugin = new FakeFirebasePlugin()

var using = typeof window != 'undefined' && window.cordova && typeof FirebasePlugin != 'undefined';
var usingWeb = typeof window != 'undefined' && typeof _Electron === 'undefined' && !window.cordova && typeof firebase != 'undefined'
var usingWeb = false // typeof window != 'undefined' && typeof _Electron === 'undefined' && !window.cordova && typeof firebase != 'undefined'

var currenttoken = null;

Expand Down Expand Up @@ -24934,7 +24934,7 @@ Platform = function (app, listofnodes) {

if(clbk) clbk()

/*app.user.isState(function (state) {
app.user.isState(function (state) {

if(state){
self.prepare(function(token){
Expand All @@ -24948,7 +24948,7 @@ Platform = function (app, listofnodes) {
}


})*/
})

}

Expand Down Expand Up @@ -29194,7 +29194,7 @@ Platform = function (app, listofnodes) {
initOnlineListener() // /remove for test


self.app.api.wait.ready('use', 10000).then(r => {
self.app.api.wait.ready('use', 6000).then(r => {


return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 16fe8cc

Please sign in to comment.