update jsthints
This commit is contained in:
parent
88f050bbcf
commit
f125085600
7 changed files with 28 additions and 6 deletions
6
index.js
6
index.js
|
@ -1,10 +1,12 @@
|
||||||
// index.js
|
'use strict'
|
||||||
|
/* jshint esversion: 6, asi: true, node: true */
|
||||||
/*
|
/*
|
||||||
|
* index.js
|
||||||
|
*
|
||||||
* WebSSH2 - Web to SSH2 gateway
|
* WebSSH2 - Web to SSH2 gateway
|
||||||
* Bill Church - https://github.com/billchurch/WebSSH2 - May 2017
|
* Bill Church - https://github.com/billchurch/WebSSH2 - May 2017
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
'use strict'
|
|
||||||
|
|
||||||
var config = require('./server/app').config
|
var config = require('./server/app').config
|
||||||
var server = require('./server/app').server
|
var server = require('./server/app').server
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict'
|
||||||
|
/* jshint esversion: 6, asi: true, node: true */
|
||||||
// app.js
|
// app.js
|
||||||
|
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict'
|
||||||
|
/* jshint esversion: 6, asi: true, node: true */
|
||||||
// socket.js
|
// socket.js
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict'
|
||||||
|
/* jshint esversion: 6, asi: true, node: true */
|
||||||
// util.js
|
// util.js
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict'
|
||||||
|
/* jshint esversion: 6, asi: true, node: true */
|
||||||
// app.js
|
// app.js
|
||||||
|
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
|
@ -35,6 +37,11 @@ app.disable('x-powered-by')
|
||||||
// static files
|
// static files
|
||||||
app.use(express.static(publicPath, expressOptions))
|
app.use(express.static(publicPath, expressOptions))
|
||||||
|
|
||||||
|
app.get('/reauth', function (req, res, next) {
|
||||||
|
var r = req.headers.referer || '/'
|
||||||
|
res.status(401).send('<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=' + r + '"></head><body bgcolor="#000"></body></html>')
|
||||||
|
})
|
||||||
|
|
||||||
app.get('/ssh/host/:host?', function (req, res, next) {
|
app.get('/ssh/host/:host?', function (req, res, next) {
|
||||||
res.sendFile(path.join(path.join(publicPath, 'client.htm')))
|
res.sendFile(path.join(path.join(publicPath, 'client.htm')))
|
||||||
// capture, assign, and validated variables
|
// capture, assign, and validated variables
|
||||||
|
@ -60,7 +67,8 @@ app.get('/ssh/host/:host?', function (req, res, next) {
|
||||||
tabStopWidth: (validator.isInt(req.query.tabStopWidth + '', {min: 1, max: 100}) && req.query.tabStopWidth) ? req.query.tabStopWidth : config.terminal.tabStopWidth,
|
tabStopWidth: (validator.isInt(req.query.tabStopWidth + '', {min: 1, max: 100}) && req.query.tabStopWidth) ? req.query.tabStopWidth : config.terminal.tabStopWidth,
|
||||||
bellStyle: ((req.query.bellStyle) && (['sound', 'none'].indexOf(req.query.bellStyle) > -1)) ? req.query.bellStyle : config.terminal.bellStyle
|
bellStyle: ((req.query.bellStyle) && (['sound', 'none'].indexOf(req.query.bellStyle) > -1)) ? req.query.bellStyle : config.terminal.bellStyle
|
||||||
},
|
},
|
||||||
allowreplay: (validator.isBoolean(req.headers.allowreplay + '') ? myutil.parseBool(req.headers.allowreplay) : false),
|
allowreplay: config.options.challengeButton || (validator.isBoolean(req.headers.allowreplay + '') ? myutil.parseBool(req.headers.allowreplay) : false),
|
||||||
|
allowreauth: config.options.allowreauth || false,
|
||||||
mrhsession: ((validator.isAlphanumeric(req.headers.mrhsession + '') && req.headers.mrhsession) ? req.headers.mrhsession : 'none'),
|
mrhsession: ((validator.isAlphanumeric(req.headers.mrhsession + '') && req.headers.mrhsession) ? req.headers.mrhsession : 'none'),
|
||||||
serverlog: {
|
serverlog: {
|
||||||
client: config.serverlog.client || false,
|
client: config.serverlog.client || false,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict'
|
||||||
|
/* jshint esversion: 6, asi: true, node: true */
|
||||||
// socket.js
|
// socket.js
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
@ -7,7 +9,8 @@ var SSH = require('ssh2').Client
|
||||||
// var fs = require('fs')
|
// var fs = require('fs')
|
||||||
// var hostkeys = JSON.parse(fs.readFileSync('./hostkeyhashes.json', 'utf8'))
|
// var hostkeys = JSON.parse(fs.readFileSync('./hostkeyhashes.json', 'utf8'))
|
||||||
var termCols, termRows
|
var termCols, termRows
|
||||||
var 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>'
|
var 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>'
|
||||||
|
|
||||||
// public
|
// public
|
||||||
module.exports = function socket (socket) {
|
module.exports = function socket (socket) {
|
||||||
|
@ -24,7 +27,7 @@ module.exports = function socket (socket) {
|
||||||
termRows = rows
|
termRows = rows
|
||||||
})
|
})
|
||||||
conn.on('banner', function connOnBanner (data) {
|
conn.on('banner', function connOnBanner (data) {
|
||||||
// need to convert to cr/lf for proper formatting
|
// need to convert to cr/lf for proper formatting
|
||||||
data = data.replace(/\r?\n/g, '\r\n')
|
data = data.replace(/\r?\n/g, '\r\n')
|
||||||
socket.emit('data', data.toString('utf-8'))
|
socket.emit('data', data.toString('utf-8'))
|
||||||
})
|
})
|
||||||
|
@ -40,6 +43,7 @@ module.exports = function socket (socket) {
|
||||||
socket.emit('status', 'SSH CONNECTION ESTABLISHED')
|
socket.emit('status', 'SSH CONNECTION ESTABLISHED')
|
||||||
socket.emit('statusBackground', 'green')
|
socket.emit('statusBackground', 'green')
|
||||||
socket.emit('allowreplay', socket.request.session.ssh.allowreplay)
|
socket.emit('allowreplay', socket.request.session.ssh.allowreplay)
|
||||||
|
socket.emit('allowreauth', socket.request.session.ssh.allowreauth)
|
||||||
conn.shell({
|
conn.shell({
|
||||||
term: socket.request.session.ssh.term,
|
term: socket.request.session.ssh.term,
|
||||||
cols: termCols,
|
cols: termCols,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict'
|
||||||
|
/* jshint esversion: 6, asi: true, node: true */
|
||||||
// util.js
|
// util.js
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
@ -12,7 +14,7 @@ exports.basicAuth = function basicAuth (req, res, next) {
|
||||||
req.session.userpassword = myAuth.pass
|
req.session.userpassword = myAuth.pass
|
||||||
debug('myAuth.name: ' + myAuth.name.yellow.bold.underline +
|
debug('myAuth.name: ' + myAuth.name.yellow.bold.underline +
|
||||||
' and password ' + ((myAuth.pass) ? 'exists'.yellow.bold.underline
|
' and password ' + ((myAuth.pass) ? 'exists'.yellow.bold.underline
|
||||||
: 'is blank'.underline.red.bold))
|
: 'is blank'.underline.red.bold))
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
res.statusCode = 401
|
res.statusCode = 401
|
||||||
|
|
Loading…
Reference in a new issue