Browse Source

Use SSH wrapper only if no username is known otherwise (#137)

pull/143/head
Oleg Kurapov 6 years ago
committed by Cian Butler
parent
commit
f606ca98b3
  1. 3
      wetty.mjs

3
wetty.mjs

@ -40,9 +40,10 @@ function getCommand(socket, sshuser, sshhost, sshport, sshauth, sshkey) {
const { request } = socket;
const match = request.headers.referer.match('.+/ssh/.+$');
const sshAddress = sshuser ? `${sshuser}@${sshhost}` : sshhost;
const sshPath = sshuser || match ? 'ssh' : path.join(__dirname, 'bin/ssh');
const ssh = match ? `${match[0].split('/ssh/').pop()}@${sshhost}` : sshAddress;
const sshRemoteOptsBase = [
path.join(__dirname, 'bin/ssh'),
sshPath,
ssh,
'-p',
sshport,

Loading…
Cancel
Save