webssh_plus/index.html

39 lines
1.2 KiB
HTML
Raw Normal View History

2019-09-03 15:04:18 +02:00
<!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>
2019-09-03 15:31:27 +02:00
<link rel="stylesheet" href="node_modules/xterm/dist/xterm.css" />
<script src="node_modules/xterm/dist/xterm.js"></script>
2019-09-03 15:08:05 +02:00
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
}
</style>
2019-09-03 15:04:18 +02:00
</head>
<body>
2019-09-03 15:31:27 +02:00
<div id="terminal">
2019-09-03 15:08:05 +02:00
<!-- ! Here will be the terminal stuff -->
</div>
2019-09-03 15:04:18 +02:00
<script>
2019-09-03 15:31:27 +02:00
var term = new Terminal();
term.open(document.getElementById('terminal'))
2019-09-03 15:04:18 +02:00
// Connect to the socket.io server
2019-09-03 15:08:05 +02:00
var socket = io.connect('http://localhost:9774');
// Wait for data from the server
socket.on('output', function (data) {
2019-09-03 15:31:27 +02:00
term.write(data);
2019-09-03 15:08:05 +02:00
});
// Listen for user input and pass it to the server
2019-09-03 15:31:27 +02:00
term.on('data', function(data) {
console.log(data);
socket.emit('input', data);
2019-09-03 15:08:05 +02:00
});
2019-09-03 15:04:18 +02:00
</script>
</body>
</html>