diff --git a/views/browser.pug b/views/rpc-browser.pug similarity index 100% rename from views/browser.pug rename to views/rpc-browser.pug diff --git a/views/rpc-terminal.pug b/views/rpc-terminal.pug new file mode 100644 index 0000000..fe53646 --- /dev/null +++ b/views/rpc-terminal.pug @@ -0,0 +1,68 @@ +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("
" + response + "