You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.6 KiB
68 lines
1.6 KiB
5 years ago
|
extends layout
|
||
|
|
||
|
block headContent
|
||
|
title RPC Terminal
|
||
|
|
||
|
block content
|
||
|
div.row
|
||
|
div.col
|
||
|
h1.h3 RPC Terminal
|
||
|
|
||
|
div.col
|
||
|
if (!config.demoSite && (!config.credentials.rpc || !config.credentials.rpc.rpc))
|
||
|
span(style="float: right;")
|
||
|
a.btn.btn-secondary(href="/disconnect") Disconnect from node
|
||
|
|
||
|
hr
|
||
|
|
||
|
:markdown-it
|
||
|
Use this interactive terminal to send RPC commands to your node. Results will be shown inline. To browse all available RPC commands you can use the [RPC Browser](/rpc-browser).
|
||
|
|
||
|
div.card.shadow-sm.mb-3
|
||
|
div.card-body
|
||
|
form(id="terminal-form")
|
||
|
div.form-group
|
||
|
label(for="input-cmd") Command
|
||
|
input.form-control(type="text", id="input-cmd", name="cmd")
|
||
|
|
||
|
input.btn.btn-primary.btn-block(type="submit", value="Send")
|
||
|
|
||
|
hr
|
||
|
|
||
|
div(id="terminal-output")
|
||
|
|
||
|
block endOfBody
|
||
|
script.
|
||
|
var csrfToken = $('meta[name=csrf-token]').attr('content');
|
||
|
|
||
|
$(document).ready(function() {
|
||
|
$("#terminal-form").submit(function(e) {
|
||
|
e.preventDefault();
|
||
|
|
||
|
var cmd = $("#input-cmd").val()
|
||
|
|
||
|
var postData = {};
|
||
|
postData.cmd = cmd;
|
||
|
postData._csrf = csrfToken;
|
||
|
|
||
|
$.post(
|
||
|
"/rpc-terminal",
|
||
|
postData,
|
||
|
function(response, textStatus, jqXHR) {
|
||
|
var t = new Date().getTime();
|
||
|
|
||
|
$("#terminal-output").prepend("<div id='output-" + t + "' class='card mb-3 shadow-sm'><div class='card-body'><h5>" + cmd + "</h5><pre><code class='json'>" + response + "</code></pre></div></div>");
|
||
|
console.log(response);
|
||
|
|
||
|
$("#output-" + t + " pre code").each(function(i, block) {
|
||
|
hljs.highlightBlock(block);
|
||
|
});
|
||
|
|
||
|
return false;
|
||
|
})
|
||
|
.done(function(data) {
|
||
|
});
|
||
|
|
||
|
return false;
|
||
|
});
|
||
|
});
|