Browse Source

add new "blocks rescan" tab in the maintenance tool

umbrel
kenshin-samourai 5 years ago
parent
commit
dd34678b78
  1. 16
      static/admin/lib/api-wrapper.js
  2. 5
      static/admin/tool/index.html
  3. 11
      static/admin/tool/index.js

16
static/admin/lib/api-wrapper.js

@ -133,7 +133,23 @@ var lib_api = {
return this.sendGetUriEncoded(uri, {});
},
/**
* Rescans a range of blocks
*/
getBlocksRescan: function(fromHeight, toHeight) {
let prefix = conf['prefixes']['support'];
let uri = this.baseUri + '/tracker/' + prefix + '/rescan';
//let uri = 'http://127.0.0.1:8082/' + prefix + '/rescan';
return this.sendGetUriEncoded(
uri,
{
'fromHeight': fromHeight,
'toHeight': toHeight
}
);
},
/**
* HTTP requests methods
*/

5
static/admin/tool/index.html

@ -71,7 +71,10 @@
<a href="#">UNSPENT</a>
</li>
<li id="link-tx">
<a href="#">TRANSACTION</a>
<a href="#">TX</a>
</li>
<li id="link-rescan-blocks">
<a href="#">BLOCKS RESCAN</a>
</li>
</ul>
</div>

11
static/admin/tool/index.js

@ -48,6 +48,7 @@ function initTabs() {
'#link-xpub',
'#link-info-address',
'#link-rescan-address',
'#link-rescan-blocks',
'#link-multiaddr',
'#link-unspent',
'#link-tx'
@ -110,6 +111,12 @@ function preparePage() {
placeholder = 'ENTER A BITCOIN ADDRESS';
} else if (activeTab == '#link-rescan-address') {
placeholder = 'ENTER A BITCOIN ADDRESS';
} else if (activeTab == '#link-rescan-blocks') {
$("#cell-args").removeClass('fullwidth');
$("#cell-args").addClass('halfwidth');
$("#cell-args2").show();
placeholder = 'RESCAN BLOCKS FROM HEIGHT...';
placeholder2 = '...TO HEIGHT (OPTIONAL)';
} else if (activeTab == '#link-multiaddr') {
placeholder = 'ENTER /MULTIADDR URL ARGUMENTS (e.g.: active=xpub0123456789&new=address2|address3&pubkey=pubkey4)';
} else if (activeTab == '#link-unspent') {
@ -164,6 +171,10 @@ function processAction(activeTab, args, args2, args3) {
return lib_api.getAddressInfo(args);
} else if (activeTab == '#link-rescan-address') {
return lib_api.getAddressRescan(args);
} else if (activeTab == '#link-rescan-blocks') {
const fromHeight = parseInt(args);
const toHeight = (args2) ? parseInt(args2) : fromHeight;
return lib_api.getBlocksRescan(fromHeight, toHeight);
} else if (activeTab == '#link-tx') {
return lib_api.getTransaction(args);
}

Loading…
Cancel
Save