Skip to content

Commit eea72c7

Browse files
committed
polling fallbacks
1 parent d47c795 commit eea72c7

9 files changed

+442
-542
lines changed

assets_js_bitrequest_config.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
let glob_socket_attempt = {},
22
glob_api_attempt = {},
33
glob_api_attempts = {},
4-
glob_scan_attempts = {},
54
glob_statuspush = [],
65
glob_tx_list = [],
76
glob_rpc_attempts = {},
@@ -289,7 +288,7 @@ const glob_apptitle = "Bitrequest",
289288
},
290289
{
291290
"name": "blockchain.info websocket",
292-
"url": "wss://ws.blockchain.info/inv",
291+
"url": "wss://ws.blockchain.infos/inv",
293292
"display": true
294293
}
295294
],
@@ -425,7 +424,8 @@ const glob_apptitle = "Bitrequest",
425424
"display": true
426425
}
427426
],
428-
"options": []
427+
"options": [],
428+
"poll_fallback": true
429429
},
430430
"Xpub": {
431431
"active": true,
@@ -543,7 +543,8 @@ const glob_apptitle = "Bitrequest",
543543
"display": true
544544
}
545545
],
546-
"options": []
546+
"options": [],
547+
"poll_fallback": true
547548
},
548549
"Xpub": {
549550
"active": true,
@@ -623,18 +624,12 @@ const glob_apptitle = "Bitrequest",
623624
"apis": {
624625
"icon": "sphere",
625626
"selected": {
626-
"name": "blockchair",
627-
"url": "blockchair.com",
627+
"name": "dash.org",
628+
"url": "insight.dash.org",
628629
"api": true,
629630
"display": true
630631
},
631632
"apis": [{
632-
"name": "blockchair",
633-
"url": "blockchair.com",
634-
"api": true,
635-
"display": true
636-
},
637-
{
638633
"name": "dash.org",
639634
"url": "insight.dash.org",
640635
"api": true,
@@ -645,6 +640,12 @@ const glob_apptitle = "Bitrequest",
645640
"url": "blockcypher.com",
646641
"api": true,
647642
"display": true
643+
},
644+
{
645+
"name": "blockchair",
646+
"url": "blockchair.com",
647+
"api": true,
648+
"display": true
648649
}
649650
]
650651
},
@@ -670,7 +671,8 @@ const glob_apptitle = "Bitrequest",
670671
"url": glob_main_bc_ws,
671672
"display": false
672673
}
673-
]
674+
],
675+
"poll_fallback": true
674676
},
675677
"Xpub": {
676678
"active": true,
@@ -776,7 +778,8 @@ const glob_apptitle = "Bitrequest",
776778
"url": "wss://ws.blockchain.info/bch/inv",
777779
"display": true
778780
}],
779-
"options": []
781+
"options": [],
782+
"poll_fallback": true
780783
},
781784
"Xpub": {
782785
"active": true,
@@ -1124,7 +1127,8 @@ const glob_apptitle = "Bitrequest",
11241127
"display": true
11251128
}
11261129
],
1127-
"options": []
1130+
"options": [],
1131+
"poll_fallback": true
11281132
},
11291133
"Xpub": {
11301134
"active": true,
@@ -1335,7 +1339,8 @@ const glob_apptitle = "Bitrequest",
13351339
"url": glob_sec_kas_wss,
13361340
"display": true
13371341
}
1338-
]
1342+
],
1343+
"poll_fallback": true
13391344
},
13401345
"Xpub": {
13411346
"active": false,

assets_js_bitrequest_core.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const glob_ls_support = check_local(),
3636
(glob_thishostname == "bitrequest.github.io") ? "hosted" :
3737
(glob_thishostname == glob_localhostname) ? "selfhosted" : "unknown",
3838
glob_wl = navigator.wakeLock,
39-
glob_after_scan_timeout = 15000,
39+
glob_after_scan_timeout = 120000, // offer a blockexplorer lookup after 2 minutes without detection
4040
glob_xss_alert = "xss attempt detected",
4141
glob_langcode = setlangcode(); // set saved or system language
4242

@@ -1936,6 +1936,8 @@ function check_recent() {
19361936
"url": thisurl
19371937
}));
19381938
if (result) {
1939+
canceldialog();
1940+
close_paymentdialog();
19391941
open_share_url("location", thisurl);
19401942
}
19411943
return
@@ -2685,8 +2687,11 @@ function canceldialog(pass) {
26852687
}, 600, function() {
26862688
clearTimeout(timeout);
26872689
});
2688-
if (request) { // reset after_scan
2689-
request.rq_timer = now();
2690+
if (glob_paymentpopup.hasClass("active")) {
2691+
if (request) { // reset after_scan
2692+
request.rq_timer = now();
2693+
}
2694+
set_request_timer();
26902695
}
26912696
}
26922697

@@ -2733,7 +2738,7 @@ function unfocus_inputs() {
27332738

27342739
// Checks polling conditions and closes payment dialog if necessary
27352740
function cpd_pollcheck() {
2736-
if (glob_paymentdialogbox.attr("data-lswitch") == "lnd_ao") {
2741+
if (glob_paymentdialogbox.attr("data-lswitch") === "lnd_ao") {
27372742
close_paymentdialog();
27382743
return
27392744
}
@@ -2742,7 +2747,7 @@ function cpd_pollcheck() {
27422747
rq_timer = request.rq_timer,
27432748
rq_time = now() - rq_timer;
27442749
if (rq_time > glob_after_scan_timeout) {
2745-
after_scan(rq_init);
2750+
close_paymentdialog(true);
27462751
return
27472752
}
27482753
}

assets_js_bitrequest_fetchblocks.js

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ function blockcypher_fetch(rd, api_data, rdo) {
465465
api_proxy({
466466
"api": "blockcypher",
467467
"search": rd.currencysymbol + "/main/addrs/" + rd.address,
468-
"cachetime": 25,
468+
"cachetime": rdo.cachetime,
469469
"cachefolder": "1h",
470470
"params": {
471471
"method": "GET"
@@ -516,7 +516,7 @@ function blockcypher_fetch(rd, api_data, rdo) {
516516
api_proxy({
517517
"api": "blockcypher",
518518
"search": rd.currencysymbol + "/main/txs/" + rd.txhash,
519-
"cachetime": 25,
519+
"cachetime": rdo.cachetime,
520520
"cachefolder": "1h",
521521
"params": {
522522
"method": "GET"
@@ -569,7 +569,7 @@ function ethplorer_fetch(rd, api_data, rdo) {
569569
api_proxy({
570570
"api": api_name,
571571
"search": "getAddressHistory/" + rd.address + "?type=transfer",
572-
"cachetime": 25,
572+
"cachetime": rdo.cachetime,
573573
"cachefolder": "1h",
574574
"params": {
575575
"method": "GET"
@@ -617,7 +617,7 @@ function ethplorer_fetch(rd, api_data, rdo) {
617617
api_proxy({
618618
"api": api_name,
619619
"search": "getTxInfo/" + txhash,
620-
"cachetime": 25,
620+
"cachetime": rdo.cachetime,
621621
"cachefolder": "1h",
622622
"params": {
623623
"method": "GET"
@@ -682,7 +682,7 @@ function arbiscan_fetch(rd, api_data, rdo) {
682682
eth_payload = {
683683
"api": api_name,
684684
"search": "?module=account&action=txlist&address=" + rd.address + "&startblock=0&endblock=latest&page=1&offset=1000&sort=desc&apikey=" + apikeytoken,
685-
"cachetime": 25,
685+
"cachetime": rdo.cachetime,
686686
"cachefolder": "1h",
687687
"params": {
688688
"method": "GET"
@@ -691,7 +691,7 @@ function arbiscan_fetch(rd, api_data, rdo) {
691691
erc20_payload = {
692692
"api": api_name,
693693
"search": "?module=account&action=tokentx&contractaddress=" + arb_contract + "&address=" + rd.address + "&page=1&offset=100&startblock=0&endblock=99999999&sort=asc&apikey=" + apikeytoken,
694-
"cachetime": 25,
694+
"cachetime": rdo.cachetime,
695695
"cachefolder": "1h",
696696
"params": {
697697
"method": "GET"
@@ -876,7 +876,7 @@ function blockchair_fetch(rd, api_data, rdo) {
876876
api_proxy({
877877
"api": api_name,
878878
"search": scan_url,
879-
"cachetime": 25,
879+
"cachetime": rdo.cachetime,
880880
"cachefolder": "1h",
881881
"params": {
882882
"method": "GET"
@@ -958,7 +958,7 @@ function blockchair_fetch(rd, api_data, rdo) {
958958
api_proxy({
959959
"api": api_name,
960960
"search": rd.payment + "/dashboards/transactions/" + txarray.slice(0, 6), // get last 5 transactions
961-
"cachetime": 25,
961+
"cachetime": rdo.cachetime,
962962
"cachefolder": "1h",
963963
"params": {
964964
"method": "GET"
@@ -1004,7 +1004,7 @@ function blockchair_fetch(rd, api_data, rdo) {
10041004
api_proxy({
10051005
"api": api_name,
10061006
"search": poll_url,
1007-
"cachetime": 25,
1007+
"cachetime": rdo.cachetime,
10081008
"cachefolder": "1h",
10091009
"params": {
10101010
"method": "GET"
@@ -1070,7 +1070,7 @@ function nimiq_fetch(rd, api_data, rdo) {
10701070
api_proxy({
10711071
"api": "nimiq.watch",
10721072
"search": "account-transactions/" + rd.address,
1073-
"cachetime": 25,
1073+
"cachetime": rdo.cachetime,
10741074
"cachefolder": "1h",
10751075
"params": {
10761076
"method": "GET"
@@ -1120,7 +1120,7 @@ function nimiq_fetch(rd, api_data, rdo) {
11201120
api_proxy({
11211121
"api": api_name,
11221122
"search": "transaction/" + nimiqhash(rd.txhash),
1123-
"cachetime": 25,
1123+
"cachetime": rdo.cachetime,
11241124
"cachefolder": "1h",
11251125
"params": {
11261126
"method": "GET"
@@ -1160,7 +1160,7 @@ function nimiq_fetch(rd, api_data, rdo) {
11601160
api_proxy({
11611161
"api": api_name,
11621162
"search": "tx/" + rd.txhash,
1163-
"cachetime": 25,
1163+
"cachetime": rdo.cachetime,
11641164
"cachefolder": "1h",
11651165
"params": {
11661166
"method": "GET"
@@ -1175,7 +1175,7 @@ function nimiq_fetch(rd, api_data, rdo) {
11751175
api_proxy({
11761176
"api": api_name,
11771177
"search": "quick-stats/",
1178-
"cachetime": 25,
1178+
"cachetime": rdo.cachetime,
11791179
"cachefolder": "1h",
11801180
"params": {
11811181
"method": "GET"
@@ -1236,7 +1236,7 @@ function kaspa_fetch(rd, api_data, rdo) {
12361236
api_proxy({
12371237
"api": api_name,
12381238
"search": "info/virtual-chain-blue-score",
1239-
"cachetime": 25,
1239+
"cachetime": rdo.cachetime,
12401240
"cachefolder": "1h",
12411241
"params": {
12421242
"method": "GET"
@@ -1249,7 +1249,7 @@ function kaspa_fetch(rd, api_data, rdo) {
12491249
api_proxy({
12501250
"api": api_name,
12511251
"search": "addresses/" + rd.address + "/full-transactions",
1252-
"cachetime": 25,
1252+
"cachetime": rdo.cachetime,
12531253
"cachefolder": "1h",
12541254
"proxy": true,
12551255
"params": {
@@ -1305,7 +1305,7 @@ function kaspa_fetch(rd, api_data, rdo) {
13051305
api_proxy({
13061306
"api": api_name,
13071307
"search": "info/virtual-chain-blue-score",
1308-
"cachetime": 25,
1308+
"cachetime": rdo.cachetime,
13091309
"cachefolder": "1h",
13101310
"params": {
13111311
"method": "GET"
@@ -1318,7 +1318,7 @@ function kaspa_fetch(rd, api_data, rdo) {
13181318
api_proxy({
13191319
"api": api_name,
13201320
"search": "transactions/" + rd.txhash,
1321-
"cachetime": 25,
1321+
"cachetime": rdo.cachetime,
13221322
"cachefolder": "1h",
13231323
"params": {
13241324
"method": "GET"
@@ -1368,7 +1368,7 @@ function kaspa_fetch(rd, api_data, rdo) {
13681368
api_proxy({
13691369
"api": api_name,
13701370
"search": "transactions/" + rd.txhash,
1371-
"cachetime": 25,
1371+
"cachetime": rdo.cachetime,
13721372
"cachefolder": "1h",
13731373
"params": {
13741374
"method": "GET"
@@ -1421,7 +1421,7 @@ function insight_fetch_dash(rd, api_data, rdo) {
14211421
api_proxy({
14221422
"api": "dash.org",
14231423
"search": "txs?address=" + rd.address,
1424-
"cachetime": 25,
1424+
"cachetime": rdo.cachetime,
14251425
"cachefolder": "1h",
14261426
"params": {
14271427
"method": "GET"
@@ -1466,7 +1466,7 @@ function insight_fetch_dash(rd, api_data, rdo) {
14661466
api_proxy({
14671467
"api": "dash.org",
14681468
"search": "tx/" + rd.txhash,
1469-
"cachetime": 25,
1469+
"cachetime": rdo.cachetime,
14701470
"cachefolder": "1h",
14711471
"params": {
14721472
"method": "GET"
@@ -1765,7 +1765,7 @@ function nano_rpc(rd, api_data, rdo) {
17651765
api_proxy({
17661766
"api": "nano",
17671767
"search": "account",
1768-
"cachetime": 25,
1768+
"cachetime": rdo.cachetime,
17691769
"cachefolder": "1h",
17701770
"custom": "nano_txd",
17711771
"api_url": api_data.url,
@@ -1785,7 +1785,7 @@ function nano_rpc(rd, api_data, rdo) {
17851785
const data = br_result(e).result;
17861786
if (data) {
17871787
const nano_data = data.data;
1788-
if (nano_data) {
1788+
if (nano_data && !$.isEmptyObject(nano_data)) {
17891789
const pending_array_node = nano_data[0] ? nano_data[0].pending : [],
17901790
pending_array = $.isEmptyObject(pending_array_node) ? [] : pending_array_node,
17911791
history_array_node = nano_data[1] ? nano_data[1].history : [],
@@ -1824,7 +1824,7 @@ function nano_rpc(rd, api_data, rdo) {
18241824
api_proxy({
18251825
"api": "nano",
18261826
"search": "block",
1827-
"cachetime": 25,
1827+
"cachetime": rdo.cachetime,
18281828
"cachefolder": "1h",
18291829
"api_url": api_data.url,
18301830
"params": {
@@ -2806,6 +2806,7 @@ function tx_data(rd) {
28062806
"statuspanel": statuspanel,
28072807
"transactionlist": transactionlist,
28082808
"erc20": erc20,
2809-
"source": "list"
2809+
"source": "list",
2810+
"cachetime": 25
28102811
}
28112812
}

assets_js_bitrequest_lang_en.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,6 @@ function lang_en(id, data) {
561561
"loadingcamera": "Loading camera",
562562
"generatebu": "Generate system backup",
563563
"installationpackage": "Generate installation package",
564-
"closingrequest": "Closing request",
565-
"scanningforincoming": "scanning for incoming transactions",
566564

567565
// RANDOM TERMS
568566
"address": "address",

assets_js_bitrequest_lang_fr.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,6 @@ function lang_fr(id, data) {
561561
"loadingcamera": "Caméra à ouvrir",
562562
"generatebu": "Générer une sauvegarde du système",
563563
"installationpackage": "Générer le package d'installation",
564-
"closingrequest": "Paiement de clôture",
565-
"scanningforincoming": "analyse des transactions entrantes",
566564

567565
// RANDOM TERMS
568566
"address": "adresse",

0 commit comments

Comments
 (0)