mirror of
https://github.com/janoside/btc-rpc-explorer.git
synced 2026-08-13 12:33:13 +02:00
59 lines
1.3 KiB
Text
59 lines
1.3 KiB
Text
extends layout
|
|
|
|
block headContent
|
|
title Terminal
|
|
|
|
block content
|
|
+pageTitle("Terminal")
|
|
|
|
+dismissableInfoAlert
|
|
.mb-3 This is an internal developer tool.
|
|
|
|
+contentSection
|
|
form(id="terminal-form")
|
|
.mb-3
|
|
label(for="input-cmd") Command
|
|
input.form-control(type="text", id="input-cmd", name="cmd")
|
|
|
|
input.btn.btn-primary.w-100(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(
|
|
"./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;
|
|
});
|
|
});
|