|
|
@ -70,17 +70,20 @@ export async function calculateActualConfig(config: FileSystemConfig): Promise<F
|
|
|
|
logging.warning(`\tConfigurating uses putty, but platform is ${process.platform}`);
|
|
|
|
logging.warning(`\tConfigurating uses putty, but platform is ${process.platform}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let nameOnly = true;
|
|
|
|
let nameOnly = true;
|
|
|
|
if (config.putty === true) {
|
|
|
|
let mandatory = true;
|
|
|
|
|
|
|
|
if (config.putty === true || config.putty === '<TRY>') {
|
|
|
|
|
|
|
|
// ^ '<TRY>' is a special case used in parseConnectionString in fileSystemConfig.ts
|
|
|
|
await promptFields(config, 'host');
|
|
|
|
await promptFields(config, 'host');
|
|
|
|
// TODO: `config.putty === true` without config.host should prompt the user with *all* PuTTY sessions
|
|
|
|
// TODO: `config.putty === true` without config.host should prompt the user with *all* PuTTY sessions
|
|
|
|
if (!config.host) throw new Error(`'putty' was true but 'host' is empty/missing`);
|
|
|
|
if (!config.host) throw new Error(`'putty' was true but 'host' is empty/missing`);
|
|
|
|
|
|
|
|
mandatory = config.putty === true;
|
|
|
|
config.putty = config.host;
|
|
|
|
config.putty = config.host;
|
|
|
|
nameOnly = false;
|
|
|
|
nameOnly = false;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
config.putty = replaceVariables(config.putty);
|
|
|
|
config.putty = replaceVariables(config.putty);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const session = await (await import('./putty')).getSession(config.putty, config.host, config.username, nameOnly);
|
|
|
|
const session = await (await import('./putty')).getSession(config.putty, config.host, config.username, nameOnly);
|
|
|
|
if (!session) throw new Error(`Couldn't find the requested PuTTY session`);
|
|
|
|
if (session) {
|
|
|
|
if (session.protocol !== 'ssh') throw new Error(`The requested PuTTY session isn't a SSH session`);
|
|
|
|
if (session.protocol !== 'ssh') throw new Error(`The requested PuTTY session isn't a SSH session`);
|
|
|
|
config.username = config.username || session.username;
|
|
|
|
config.username = config.username || session.username;
|
|
|
|
if (!config.username && session.hostname && session.hostname.indexOf('@') >= 1) {
|
|
|
|
if (!config.username && session.hostname && session.hostname.indexOf('@') >= 1) {
|
|
|
@ -111,6 +114,11 @@ export async function calculateActualConfig(config: FileSystemConfig): Promise<F
|
|
|
|
throw new Error(`The requested PuTTY session uses an unsupported proxy method`);
|
|
|
|
throw new Error(`The requested PuTTY session uses an unsupported proxy method`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logging.debug(`\tReading PuTTY configuration lead to the following configuration:\n${JSON.stringify(config, null, 4)}`);
|
|
|
|
logging.debug(`\tReading PuTTY configuration lead to the following configuration:\n${JSON.stringify(config, null, 4)}`);
|
|
|
|
|
|
|
|
} else if (mandatory) {
|
|
|
|
|
|
|
|
throw new Error(`Couldn't find the requested PuTTY session`);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
logging.debug(`\tConfig suggested finding a PuTTY configuration, did not find one`);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (config.privateKeyPath) {
|
|
|
|
if (config.privateKeyPath) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|