-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex-vm.html
26 lines (26 loc) · 985 Bytes
/
index-vm.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="node_modules/xterm/css/xterm.css" />
<script src="node_modules/xterm/lib/xterm.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js" integrity="sha512-v8ng/uGxkge3d1IJuEo6dJP8JViyvms0cly9pnbfRxT6/31c3dRWxIiwGnMSWwZjHKOuY3EVmijs7k1jz/9bLA==" crossorigin="anonymous"></script>
</head>
<body>
<div id="terminal"></div>
<script>
let config = {msgId: "server01", ip: "200.200.200.180", username: "service", password: "service"};
const socket = io('http://localhost:8000');
const term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m')
term.onData(function(data) {
socket.emit(config.msgId, data);
})
socket.on(config.msgId, function (data) {
console.log(data)
term.write(data)
})
socket.emit('createNewServer', config);
</script>
</body>
</html>