fix: enable autoConnect
only on /ssh/host/
This commit is contained in:
parent
9cfccb109a
commit
c9591d637d
1 changed files with 13 additions and 8 deletions
|
@ -1,13 +1,13 @@
|
||||||
// server
|
// server
|
||||||
// app/connectionHandler.js
|
// app/connectionHandler.js
|
||||||
const createDebug = require("debug")
|
const createDebug = require('debug')
|
||||||
var path = require("path")
|
const path = require('path')
|
||||||
var fs = require("fs")
|
const fs = require('fs')
|
||||||
var extend = require("util")._extend
|
const extend = require('util')._extend
|
||||||
const debug = createDebug("webssh2:connectionHandler")
|
const debug = createDebug('webssh2:connectionHandler')
|
||||||
|
|
||||||
function handleConnection(req, res, urlParams) {
|
function handleConnection(req, res, urlParams) {
|
||||||
debug("Handling connection")
|
debug('Handling connection')
|
||||||
urlParams = urlParams || {}
|
urlParams = urlParams || {}
|
||||||
|
|
||||||
const clientPath = path.resolve(
|
const clientPath = path.resolve(
|
||||||
|
@ -24,7 +24,12 @@ function handleConnection(req, res, urlParams) {
|
||||||
url: req.protocol + '://' + req.get('host'),
|
url: req.protocol + '://' + req.get('host'),
|
||||||
path: '/ssh/socket.io'
|
path: '/ssh/socket.io'
|
||||||
},
|
},
|
||||||
autoConnect: true
|
autoConnect: false // Default to false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the current route is /host/:host
|
||||||
|
if (req.path.startsWith('/ssh/host/')) {
|
||||||
|
tempConfig.autoConnect = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.readFile(
|
fs.readFile(
|
||||||
|
|
Loading…
Reference in a new issue