fix: enable autoConnect only on /ssh/host/

This commit is contained in:
Bill Church 2024-08-19 11:36:34 +00:00
parent 9cfccb109a
commit c9591d637d
No known key found for this signature in database

View file

@ -1,13 +1,13 @@
// server
// app/connectionHandler.js
const createDebug = require("debug")
var path = require("path")
var fs = require("fs")
var extend = require("util")._extend
const debug = createDebug("webssh2:connectionHandler")
const createDebug = require('debug')
const path = require('path')
const fs = require('fs')
const extend = require('util')._extend
const debug = createDebug('webssh2:connectionHandler')
function handleConnection(req, res, urlParams) {
debug("Handling connection")
debug('Handling connection')
urlParams = urlParams || {}
const clientPath = path.resolve(
@ -24,7 +24,12 @@ function handleConnection(req, res, urlParams) {
url: req.protocol + '://' + req.get('host'),
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(