webssh_plus/index.html
2019-09-03 15:31:27 +02:00

39 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>webssh_plus</title>
<script src="/socket.io/socket.io.js"></script>
<link rel="stylesheet" href="node_modules/xterm/dist/xterm.css" />
<script src="node_modules/xterm/dist/xterm.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="terminal">
<!-- ! Here will be the terminal stuff -->
</div>
<script>
var term = new Terminal();
term.open(document.getElementById('terminal'))
// Connect to the socket.io server
var socket = io.connect('http://localhost:9774');
// Wait for data from the server
socket.on('output', function (data) {
term.write(data);
});
// Listen for user input and pass it to the server
term.on('data', function(data) {
console.log(data);
socket.emit('input', data);
});
</script>
</body>
</html>