From 7a4b5ecc5ed37812bdd712115d68505bd6930531 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 3 Sep 2019 16:31:37 +0200 Subject: [PATCH] It works now :D --- index.html | 4 ---- main.js | 6 +++--- package-lock.json | 18 ++++++++++++++++++ package.json | 1 + 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index c0c6de5..93b3f76 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,6 @@ -
@@ -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); diff --git a/main.js b/main.js index 9577537..559a2a1 100644 --- a/main.js +++ b/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) => { diff --git a/package-lock.json b/package-lock.json index 0a28f26..bc4e1f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 0fd44ba..34474e3 100644 --- a/package.json +++ b/package.json @@ -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"