It works now :D
This commit is contained in:
parent
8d90f32921
commit
7a4b5ecc5e
@ -12,7 +12,6 @@
|
||||
<script src="/node_modules/xterm/dist/xterm.js"></script>
|
||||
<script src="/node_modules/xterm/dist/addons/fit/fit.js"></script>
|
||||
<script src="/node_modules/xterm/dist/addons/attach/attach.js"></script>
|
||||
<script src="/node_modules/xterm/dist/addons/winptyCompat/winptyCompat.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="terminal"></div>
|
||||
@ -20,11 +19,8 @@
|
||||
// No idea what these are about. Just copied them from the demo code
|
||||
Terminal.applyAddon(attach);
|
||||
Terminal.applyAddon(fit);
|
||||
Terminal.applyAddon(winptyCompat);
|
||||
// The terminal
|
||||
const term = new Terminal();
|
||||
// No idea what this does
|
||||
term.winptyCompatInit();
|
||||
// This kinda makes sense
|
||||
const container = document.getElementById('terminal');
|
||||
term.open(container);
|
||||
|
6
main.js
6
main.js
@ -1,11 +1,11 @@
|
||||
import * as express from 'express';
|
||||
import * as pty from 'node-pty';
|
||||
var express = require('express');
|
||||
var pty = require('node-pty');
|
||||
|
||||
const app = express();
|
||||
const expressWs = require('express-ws')(app);
|
||||
|
||||
// Serve static assets from ./static
|
||||
app.use(express.static(`${__dirname}/static`));
|
||||
app.use(express.static('./'));
|
||||
|
||||
// Instantiate shell and set up data handlers
|
||||
expressWs.app.ws('/shell', (ws, req) => {
|
||||
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -269,6 +269,24 @@
|
||||
"vary": "~1.1.2"
|
||||
}
|
||||
},
|
||||
"express-ws": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/express-ws/-/express-ws-4.0.0.tgz",
|
||||
"integrity": "sha512-KEyUw8AwRET2iFjFsI1EJQrJ/fHeGiJtgpYgEWG3yDv4l/To/m3a2GaYfeGyB3lsWdvbesjF5XCMx+SVBgAAYw==",
|
||||
"requires": {
|
||||
"ws": "^5.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ws": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
|
||||
"integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
|
||||
|
@ -18,6 +18,7 @@
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1",
|
||||
"express-ws": "^4.0.0",
|
||||
"node-pty": "^0.8.1",
|
||||
"socket.io": "^2.2.0",
|
||||
"xterm": "^3.14.5"
|
||||
|
Loading…
Reference in New Issue
Block a user