chore: stage one complete
This commit is contained in:
parent
25f52b3f1e
commit
b6e5089ee6
3 changed files with 7 additions and 14 deletions
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const compression = require("compression");
|
|
||||||
const session = require("express-session");
|
const session = require("express-session");
|
||||||
const logger = require("morgan");
|
const logger = require("morgan");
|
||||||
const socketIo = require("socket.io");
|
const socketIo = require("socket.io");
|
||||||
|
@ -28,7 +27,6 @@ const sessionMiddleware = session({
|
||||||
});
|
});
|
||||||
|
|
||||||
// Express middleware
|
// Express middleware
|
||||||
app.use(compression({ level: 9 }));
|
|
||||||
app.use(sessionMiddleware);
|
app.use(sessionMiddleware);
|
||||||
if (config.accesslog) app.use(logger("common"));
|
if (config.accesslog) app.use(logger("common"));
|
||||||
app.disable("x-powered-by");
|
app.disable("x-powered-by");
|
||||||
|
|
|
@ -5,11 +5,6 @@ const debug = require("debug");
|
||||||
const debugWebSSH2 = require("debug")("WebSSH2");
|
const debugWebSSH2 = require("debug")("WebSSH2");
|
||||||
const SSH = require("ssh2").Client;
|
const SSH = require("ssh2").Client;
|
||||||
|
|
||||||
const menuData = `
|
|
||||||
<a id="logBtn"><i class="fas fa-clipboard fa-fw"></i> Start Log</a>
|
|
||||||
<a id="downloadLogBtn"><i class="fas fa-download fa-fw"></i> Download Log</a>
|
|
||||||
`;
|
|
||||||
|
|
||||||
module.exports = function (io) {
|
module.exports = function (io) {
|
||||||
io.on("connection", (socket) => {
|
io.on("connection", (socket) => {
|
||||||
let conn = null;
|
let conn = null;
|
||||||
|
@ -72,7 +67,8 @@ module.exports = function (io) {
|
||||||
);
|
);
|
||||||
|
|
||||||
socket.emit("auth_result", { success: true });
|
socket.emit("auth_result", { success: true });
|
||||||
socket.emit("menu", menuData);
|
socket.emit("allowreauth", true);
|
||||||
|
socket.emit("allowreplay", true);
|
||||||
socket.emit("title", `ssh://${credentials.host}`);
|
socket.emit("title", `ssh://${credentials.host}`);
|
||||||
socket.emit("status", "SSH CONNECTION ESTABLISHED");
|
socket.emit("status", "SSH CONNECTION ESTABLISHED");
|
||||||
socket.emit("statusBackground", "green");
|
socket.emit("statusBackground", "green");
|
||||||
|
@ -81,7 +77,7 @@ module.exports = function (io) {
|
||||||
{
|
{
|
||||||
term: credentials.term,
|
term: credentials.term,
|
||||||
cols: credentials.cols,
|
cols: credentials.cols,
|
||||||
rows: credentials.rows,
|
rows: credentials.rows
|
||||||
},
|
},
|
||||||
(err, str) => {
|
(err, str) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -127,7 +123,7 @@ module.exports = function (io) {
|
||||||
readyTimeout: credentials.readyTimeout,
|
readyTimeout: credentials.readyTimeout,
|
||||||
keepaliveInterval: credentials.keepaliveInterval,
|
keepaliveInterval: credentials.keepaliveInterval,
|
||||||
keepaliveCountMax: credentials.keepaliveCountMax,
|
keepaliveCountMax: credentials.keepaliveCountMax,
|
||||||
debug: debug("ssh2"),
|
debug: debug("ssh2")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"basic-auth": "~2.0.1",
|
"basic-auth": "~2.0.1",
|
||||||
"colors": "~1.3.2",
|
|
||||||
"compression": "~1.7.3",
|
|
||||||
"debug": "~4.1.0",
|
"debug": "~4.1.0",
|
||||||
"express": "~4.16.4",
|
"express": "~4.16.4",
|
||||||
"express-session": "~1.15.6",
|
"express-session": "~1.15.6",
|
||||||
|
@ -47,7 +45,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.js",
|
"start": "node index.js",
|
||||||
"watch": "nodemon index.js",
|
"watch": "node_modules/.bin/nodemon index.js",
|
||||||
"standard": "standard --verbose --fix | snazzy",
|
"standard": "standard --verbose --fix | snazzy",
|
||||||
"cleanmac": "find . -name '.DS_Store' -type f -delete"
|
"cleanmac": "find . -name '.DS_Store' -type f -delete"
|
||||||
},
|
},
|
||||||
|
@ -58,7 +56,8 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodaemon": "0.0.5",
|
"colors": "~1.3.2",
|
||||||
|
"nodemon": "^1.12.1",
|
||||||
"snazzy": "^8.0.0",
|
"snazzy": "^8.0.0",
|
||||||
"standard": "^12.0.1"
|
"standard": "^12.0.1"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue