|
|
|
@ -193,7 +193,7 @@ const getViews = screen => {
|
|
|
|
|
height: tableHeight,
|
|
|
|
|
columnsWidth: [ 50, 50 ],
|
|
|
|
|
headers: [ 'Host', 'URI' ],
|
|
|
|
|
data: hosts.map(host => [ host.name, `${host.user}@${host.address}:${host.port}` ])
|
|
|
|
|
data: hosts.map(host => [ host.name, `${host.username}@${host.address}:${host.port}` ])
|
|
|
|
|
});
|
|
|
|
|
selectButton.on('press', () => {
|
|
|
|
|
hostsTable.focus();
|
|
|
|
@ -244,7 +244,7 @@ const getViews = screen => {
|
|
|
|
|
else
|
|
|
|
|
addButton.focus();
|
|
|
|
|
},
|
|
|
|
|
setHost: ({ name, address, port, user, password } = {}, callback) => {
|
|
|
|
|
setHost: ({ name, address, port, username, password } = {}, callback) => {
|
|
|
|
|
let action;
|
|
|
|
|
const hostForm = form();
|
|
|
|
|
text({ content: 'Add host' }, { borderBottom: true }, hostForm);
|
|
|
|
@ -256,7 +256,7 @@ const getViews = screen => {
|
|
|
|
|
text({ top: n += 4, content: 'Port :' }, hostForm);
|
|
|
|
|
textbox({ top: n += 2, name: 'port', content: port }, hostForm);
|
|
|
|
|
text({ top: n += 4, content: 'User :' }, hostForm);
|
|
|
|
|
const userInput = textbox({ top: n += 2, name: 'user', content: user }, hostForm);
|
|
|
|
|
const userInput = textbox({ top: n += 2, name: 'username', content: username }, hostForm);
|
|
|
|
|
text({ top: n += 4, content: 'Password :' }, hostForm);
|
|
|
|
|
textbox({ top: n += 2, name: 'password', censor: true, content: password }, hostForm);
|
|
|
|
|
const actions = flexContainer({ top: n += 4, width: 100 }, hostForm);
|
|
|
|
@ -281,7 +281,7 @@ const getViews = screen => {
|
|
|
|
|
{ color: 'red' },
|
|
|
|
|
hostForm
|
|
|
|
|
);
|
|
|
|
|
hostForm.on('submit', ({ name, address, port, user, password }) => {
|
|
|
|
|
hostForm.on('submit', ({ name, address, port, username, password }) => {
|
|
|
|
|
port = parseInt(port);
|
|
|
|
|
if(action === 'test'){
|
|
|
|
|
testButton.setContent('Testing');
|
|
|
|
@ -290,7 +290,7 @@ const getViews = screen => {
|
|
|
|
|
// noinspection JSUnusedGlobalSymbols
|
|
|
|
|
callback({
|
|
|
|
|
action,
|
|
|
|
|
host: { name, address, port, user, password },
|
|
|
|
|
host: { name, address, port, username, password },
|
|
|
|
|
res: res => {
|
|
|
|
|
if(action === 'test'){
|
|
|
|
|
testButton.setContent('Test');
|
|
|
|
@ -301,7 +301,7 @@ const getViews = screen => {
|
|
|
|
|
else {
|
|
|
|
|
successText.hide();
|
|
|
|
|
const error = ({
|
|
|
|
|
WRONG_CREDENTIALS: 'wrong user or password',
|
|
|
|
|
WRONG_CREDENTIALS: 'wrong username or password',
|
|
|
|
|
WRONG_DESTINATION: 'wrong address or port'
|
|
|
|
|
})[res];
|
|
|
|
|
errorText.setContent(`SSH connection failed : ${error || `unknown error (${res})`}`);
|
|
|
|
@ -511,9 +511,9 @@ const getControllers = (stream, end) => {
|
|
|
|
|
switch(action2){
|
|
|
|
|
case 'cancel': return _controllers.main(user);
|
|
|
|
|
case 'test': {
|
|
|
|
|
const { address, port, user, password } = host2;
|
|
|
|
|
const { address, port, username, password } = host2;
|
|
|
|
|
ssh.chainedSession(
|
|
|
|
|
[{ address, port, user, password }],
|
|
|
|
|
[{ address, port, username, password }],
|
|
|
|
|
() => res(true),
|
|
|
|
|
undefined,
|
|
|
|
|
({ level: error }) => {
|
|
|
|
|