update jsthints

This commit is contained in:
Bill Church 2018-09-11 15:13:32 -04:00
parent 88f050bbcf
commit f125085600
7 changed files with 28 additions and 6 deletions

View file

@ -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

View file

@ -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')

View file

@ -1,3 +1,5 @@
'use strict'
/* jshint esversion: 6, asi: true, node: true */
// socket.js // socket.js
// private // private

View file

@ -1,3 +1,5 @@
'use strict'
/* jshint esversion: 6, asi: true, node: true */
// util.js // util.js
// private // private

View file

@ -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,

View file

@ -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) {
@ -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,

View file

@ -1,3 +1,5 @@
'use strict'
/* jshint esversion: 6, asi: true, node: true */
// util.js // util.js
// private // private