Allow Fingerprint to be defined in SSH Preset. Once defined, Sshwifty will use the fingerprint value to verify the public key fingerprint of the connecting SSH host

This commit is contained in:
NI committed 2020-11-14 23:00:35 +08:00
1 parent 530570abc0
commit a2d9419989
4 files changed
+33 -5

No files matched your search

+21 -2
View File
@@ -25,7 +25,7 @@ const presetItem = {
title: "",
type: "",
host: "",
meta: {}
meta: {},
};
/**
@@ -153,6 +153,25 @@ export class Preset {
return this.preset.meta[name];
}
/**
* Return the given meta of current preset, and if failed, return the given
* default value
*
* @param {string} name name of the meta data
* @param {string} defaultValue default value to be returned when the meta was
* not found
*
* @returns {string}
*
*/
metaDefault(name, defaultValue) {
try {
return this.meta(name);
} catch (e) {
return defaultValue;
}
}
/**
* Insert new meta item
*
@@ -182,7 +201,7 @@ export function emptyPreset() {
title: "Default",
type: "Default",
host: "",
meta: {}
meta: {},
});
}
+4 -2
View File
@@ -732,7 +732,9 @@ class Wizard {
authentication: r.authentication,
host: r.host,
charset: r.encoding,
fingerprint: "",
fingerprint: self.preset
? self.preset.metaDefault("Fingerprint", "")
: "",
},
self.session
);
@@ -855,7 +857,7 @@ class Wizard {
default:
throw new Exception(
"Prompt is not support by auth method: " + config.auth
'Auth method "' + config.auth + '" was unsupported'
);
}