27 lines
820 B
HTML
27 lines
820 B
HTML
<body>
|
|
<button onclick="window.location.reload()">Run Program</button>
|
|
<div id="terminal"></div>
|
|
|
|
<script>
|
|
var term = new Terminal({
|
|
cols: 80,
|
|
rows: 24
|
|
});
|
|
term.open(document.getElementById('terminal'));
|
|
term.writeln('Running startup command: python3 run.py');
|
|
term.writeln('');
|
|
|
|
var ws = new WebSocket(location.protocol.replace('http', 'ws') + '//' + location.hostname + (location.port ? (
|
|
':' + location.port) : '') + '/');
|
|
|
|
ws.onopen = function () {
|
|
new attach.attach(term, ws);
|
|
};
|
|
|
|
ws.onerror = function (e) {
|
|
console.log(e);
|
|
};
|
|
// Set focus in the terminal
|
|
document.getElementsByClassName("xterm-helper-textarea")[0].focus();
|
|
</script>
|
|
</body> |