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
2020-11-14 23:00:35 +08:00
parent 530570abc0
commit a2d9419989
4 changed files with 33 additions and 5 deletions

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: {},
});
}