Updated packages:

Updated packages:

    "colors": "~1.4.0",
    "compression": "~1.7.4",
    "debug": "^4.1.1",
    "express": "~4.17.1",
    "express-session": "~1.17.0",
    "socket.io": "2.2.0",
    "ssh2": "~0.8.6",
    "terser-webpack-plugin": "^2.2.1",
    "validator": "~12.0.0",
    "xterm-addon-fit": "^0.3.0",
    "xterm-addon-search": "^0.3.0",
    "xterm-addon-web-links": "^0.2.1"
    "@fortawesome/fontawesome-svg-core": "^1.2.25",
    "@fortawesome/free-solid-svg-icons": "^5.11.2",
    "clean-webpack-plugin": "^3.0.0",
    "copy-webpack-plugin": "^5.0.5",
    "cross-env": "^6.0.3",
    "css-loader": "^3.2.0",
    "file-loader": "^4.2.0",
    "postcss-discard-comments": "^4.0.2",
    "standard": "^14.3.1",
    "style-loader": "^1.0.0",
    "url-loader": "^2.2.0",
    "webpack": "^4.41.2",
    "webpack-cli": "^3.3.10",
    "webpack-merge": "^4.2.2",
    "xterm": "^4.2.0"
This commit is contained in:
Bill Church 2019-11-15 10:50:15 -05:00
parent 1cbb195739
commit 93303ad132
10 changed files with 7748 additions and 94 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,8 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
/*! https://mths.be/utf8js v2.1.2 by @mathias */

View file

@ -55,7 +55,7 @@
* The z-index of the helpers must be higher than the canvases in order for * The z-index of the helpers must be higher than the canvases in order for
* IMEs to appear on top. * IMEs to appear on top.
*/ */
z-index: 10; z-index: 5;
} }
.xterm .xterm-helper-textarea { .xterm .xterm-helper-textarea {
@ -69,7 +69,7 @@
top: 0; top: 0;
width: 0; width: 0;
height: 0; height: 0;
z-index: -10; z-index: -5;
/** Prevent wrapping so the IME appears against the textarea at the correct position */ /** Prevent wrapping so the IME appears against the textarea at the correct position */
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -150,7 +150,7 @@
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
z-index: 100; z-index: 10;
color: transparent; color: transparent;
} }

View file

@ -1,18 +1,18 @@
'use strict' 'use strict'
import * as io from 'socket.io-client' import * as io from 'socket.io-client'
import * as Terminal from 'xterm/dist/xterm' import { Terminal } from 'xterm'
import * as fit from 'xterm/dist/addons/fit/fit' import { FitAddon } from 'xterm-addon-fit'
/* import * as fit from 'xterm/dist/addons/fit/fit'
*/
import { library, dom } from '@fortawesome/fontawesome-svg-core' import { library, dom } from '@fortawesome/fontawesome-svg-core'
import { faBars, faClipboard, faDownload, faKey, faCog } from '@fortawesome/free-solid-svg-icons' import { faBars, faClipboard, faDownload, faKey, faCog } from '@fortawesome/free-solid-svg-icons'
library.add(faBars, faClipboard, faDownload, faKey, faCog) library.add(faBars, faClipboard, faDownload, faKey, faCog)
dom.watch() dom.watch()
require('xterm/dist/xterm.css') require('xterm/css/xterm.css')
require('../css/style.css') require('../css/style.css')
Terminal.applyAddon(fit)
/* global Blob, logBtn, credentialsBtn, reauthBtn, downloadLogBtn */ /* global Blob, logBtn, credentialsBtn, reauthBtn, downloadLogBtn */
var sessionLogEnable = false var sessionLogEnable = false
var loggedData = false var loggedData = false
@ -20,21 +20,23 @@ var allowreplay = false
var allowreauth = false var allowreauth = false
var sessionLog, sessionFooter, logDate, currentDate, myFile, errorExists var sessionLog, sessionFooter, logDate, currentDate, myFile, errorExists
var socket, termid // eslint-disable-line var socket, termid // eslint-disable-line
var term = new Terminal() const term = new Terminal()
// DOM properties // DOM properties
var status = document.getElementById('status') var status = document.getElementById('status')
var header = document.getElementById('header') var header = document.getElementById('header')
var dropupContent = document.getElementById('dropupContent') var dropupContent = document.getElementById('dropupContent')
var footer = document.getElementById('footer') var footer = document.getElementById('footer')
var fitAddon = new FitAddon()
var terminalContainer = document.getElementById('terminal-container') var terminalContainer = document.getElementById('terminal-container')
term.loadAddon(fitAddon)
term.open(terminalContainer) term.open(terminalContainer)
term.focus() term.focus()
term.fit() fitAddon.fit()
window.addEventListener('resize', resizeScreen, false) window.addEventListener('resize', resizeScreen, false)
function resizeScreen () { function resizeScreen () {
term.fit() fitAddon.fit()
socket.emit('resize', { cols: term.cols, rows: term.rows }) socket.emit('resize', { cols: term.cols, rows: term.rows })
} }
@ -49,7 +51,7 @@ if (document.location.pathname) {
socket = io.connect() socket = io.connect()
} }
term.on('data', function (data) { term.onData(function (data) {
socket.emit('data', data) socket.emit('data', data)
}) })
@ -154,7 +156,7 @@ socket.on('reauth', function () {
(allowreauth) && reauthSession() (allowreauth) && reauthSession()
}) })
term.on('title', function (title) { term.onTitleChange(function (title) {
document.title = title document.title = title
}) })

View file

@ -11,8 +11,7 @@
var config = require('./server/app').config var config = require('./server/app').config
var server = require('./server/app').server var server = require('./server/app').server
server.listen({ host: config.listen.ip, port: config.listen.port server.listen({ host: config.listen.ip, port: config.listen.port })
})
console.log('WebSSH2 service listening on ' + config.listen.ip + ':' + config.listen.port) console.log('WebSSH2 service listening on ' + config.listen.ip + ':' + config.listen.port)

7633
app/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -28,16 +28,20 @@
}, },
"dependencies": { "dependencies": {
"basic-auth": "~2.0.1", "basic-auth": "~2.0.1",
"colors": "~1.3.2", "colors": "~1.4.0",
"compression": "~1.7.3", "compression": "~1.7.4",
"debug": "~4.1.0", "debug": "^4.1.1",
"express": "~4.16.4", "express": "~4.17.1",
"express-session": "~1.15.6", "express-session": "~1.17.0",
"morgan": "~1.9.1", "morgan": "~1.9.1",
"read-config": "git+https://github.com/billchurch/nodejs-read-config.git", "read-config": "git+https://github.com/billchurch/nodejs-read-config.git",
"socket.io": "~2.2.0", "socket.io": "2.2.0",
"ssh2": "~0.6.1", "ssh2": "~0.8.6",
"validator": "~10.9.0" "terser-webpack-plugin": "^2.2.1",
"validator": "~12.0.0",
"xterm-addon-fit": "^0.3.0",
"xterm-addon-search": "^0.3.0",
"xterm-addon-web-links": "^0.2.1"
}, },
"scripts": { "scripts": {
"start": "node index.js", "start": "node index.js",
@ -60,25 +64,24 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.12", "@fortawesome/fontawesome-svg-core": "^1.2.25",
"@fortawesome/free-solid-svg-icons": "^5.6.3", "@fortawesome/free-solid-svg-icons": "^5.11.2",
"clean-webpack-plugin": "^1.0.0", "clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^4.6.0", "copy-webpack-plugin": "^5.0.5",
"cross-env": "^5.2.0", "cross-env": "^6.0.3",
"css-loader": "^2.1.0", "css-loader": "^3.2.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0", "extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^3.0.1", "file-loader": "^4.2.0",
"nodaemon": "0.0.5", "nodaemon": "0.0.5",
"postcss-discard-comments": "^4.0.1", "postcss-discard-comments": "^4.0.2",
"snazzy": "^8.0.0", "snazzy": "^8.0.0",
"standard": "^12.0.1", "standard": "^14.3.1",
"style-loader": "^0.23.1", "style-loader": "^1.0.0",
"uglifyjs-webpack-plugin": "^2.1.1", "url-loader": "^2.2.0",
"url-loader": "^1.1.2", "webpack": "^4.41.2",
"webpack": "^4.28.4", "webpack-cli": "^3.3.10",
"webpack-cli": "^3.2.1", "webpack-merge": "^4.2.2",
"webpack-merge": "^4.2.1",
"webpack-stream": "^5.2.1", "webpack-stream": "^5.2.1",
"xterm": "^3.10.1" "xterm": "^4.2.0"
} }
} }

View file

@ -1,6 +1,6 @@
const webpack = require('webpack')
const path = require('path') const path = require('path')
const CleanWebpackPlugin = require('clean-webpack-plugin') const { CleanWebpackPlugin } = require('clean-webpack-plugin');
/* const CleanWebpackPlugin = require('clean-webpack-plugin') */
const CopyWebpackPlugin = require('copy-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin') const ExtractTextPlugin = require('extract-text-webpack-plugin')
module.exports = { module.exports = {
@ -9,10 +9,7 @@ module.exports = {
webssh2: './client/src/js/index.js' webssh2: './client/src/js/index.js'
}, },
plugins: [ plugins: [
new CleanWebpackPlugin(['client/public'], { new CleanWebpackPlugin(),
root: path.resolve('__dirname', '../'),
verbose: true
}),
new CopyWebpackPlugin([ new CopyWebpackPlugin([
'./client/src/client.htm', './client/src/client.htm',
'./client/src/favicon.ico' './client/src/favicon.ico'

View file

@ -1,18 +1,29 @@
const TerserPlugin = require('terser-webpack-plugin');
const merge = require('webpack-merge') const merge = require('webpack-merge')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin') // const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const common = require('./webpack.common.js') const common = require('./webpack.common.js')
module.exports = merge(common, { module.exports = merge(common, {
plugins: [ optimization: {
new UglifyJSPlugin({ minimize: true,
uglifyOptions: { minimizer: [new TerserPlugin({
terserOptions: {
parallel: 4,
ie8: false, ie8: false,
dead_code: true, safari10: false
output: {
comments: false,
beautify: false
}
} }
}) })],
] }
}) })
/* new UglifyJSPlugin({
uglifyOptions: {
ie8: false,
dead_code: true,
output: {
comments: false,
beautify: false
}
}
}) */

View file

@ -13,49 +13,49 @@ var logger = require('morgan')
// sane defaults if config.json or parts are missing // sane defaults if config.json or parts are missing
let config = { let config = {
'listen': { listen: {
'ip': '0.0.0.0', ip: '0.0.0.0',
'port': 2222 port: 2222
}, },
'user': { user: {
'name': null, name: null,
'password': null password: null
}, },
'ssh': { ssh: {
'host': null, host: null,
'port': 22, port: 22,
'term': 'xterm-color', term: 'xterm-color',
'readyTimeout': 20000, readyTimeout: 20000,
'keepaliveInterval': 120000, keepaliveInterval: 120000,
'keepaliveCountMax': 10 keepaliveCountMax: 10
}, },
'terminal': { terminal: {
'cursorBlink': true, cursorBlink: true,
'scrollback': 10000, scrollback: 10000,
'tabStopWidth': 8, tabStopWidth: 8,
'bellStyle': 'sound' bellStyle: 'sound'
}, },
'header': { header: {
'text': null, text: null,
'background': 'green' background: 'green'
}, },
'session': { session: {
'name': 'WebSSH2', name: 'WebSSH2',
'secret': 'mysecret' secret: 'mysecret'
}, },
'options': { options: {
'challengeButton': true, challengeButton: true,
'allowreauth': true allowreauth: true
}, },
'algorithms': { algorithms: {
'kex': [ kex: [
'ecdh-sha2-nistp256', 'ecdh-sha2-nistp256',
'ecdh-sha2-nistp384', 'ecdh-sha2-nistp384',
'ecdh-sha2-nistp521', 'ecdh-sha2-nistp521',
'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha256',
'diffie-hellman-group14-sha1' 'diffie-hellman-group14-sha1'
], ],
'cipher': [ cipher: [
'aes128-ctr', 'aes128-ctr',
'aes192-ctr', 'aes192-ctr',
'aes256-ctr', 'aes256-ctr',
@ -65,23 +65,23 @@ let config = {
'aes256-gcm@openssh.com', 'aes256-gcm@openssh.com',
'aes256-cbc' 'aes256-cbc'
], ],
'hmac': [ hmac: [
'hmac-sha2-256', 'hmac-sha2-256',
'hmac-sha2-512', 'hmac-sha2-512',
'hmac-sha1' 'hmac-sha1'
], ],
'compress': [ compress: [
'none', 'none',
'zlib@openssh.com', 'zlib@openssh.com',
'zlib' 'zlib'
] ]
}, },
'serverlog': { serverlog: {
'client': false, client: false,
'server': false server: false
}, },
'accesslog': false, accesslog: false,
'verify': false verify: false
} }
// test if config.json exists, if not provide error message but try to run // test if config.json exists, if not provide error message but try to run