Added system menu method to choose encoding

This commit is contained in:
Nathan Byrd 2022-07-28 15:47:51 -05:00
parent 0b9b08eded
commit a1d4a90e05
1 changed files with 18 additions and 0 deletions

View File

@ -16,6 +16,7 @@ const iconv = require('iconv-lite');
exports.login = login; exports.login = login;
exports.login2FA_OTP = login2FA_OTP; exports.login2FA_OTP = login2FA_OTP;
exports.setClientEncoding = setClientEncoding;
exports.logoff = logoff; exports.logoff = logoff;
exports.prevMenu = prevMenu; exports.prevMenu = prevMenu;
exports.nextMenu = nextMenu; exports.nextMenu = nextMenu;
@ -241,6 +242,23 @@ function nextArea(callingMenu, formData, extraArgs, cb) {
); );
} }
function setClientEncoding(callingMenu, formData, extraArgs, cb) {
// TODO: Also add other encoding types
const client = callingMenu.client;
let encoding = formData.value.encoding;
client.log.info(
{ encoding: encoding, currentEncoding: client.term.outputEncoding },
'Setting client encoding.'
);
encoding = encoding || client.term.outputEncoding;
client.term.outputEncoding = encoding;
return callingMenu.nextMenu(cb);
}
function sendForgotPasswordEmail(callingMenu, formData, extraArgs, cb) { function sendForgotPasswordEmail(callingMenu, formData, extraArgs, cb) {
const username = formData.value.username || callingMenu.client.user.username; const username = formData.value.username || callingMenu.client.user.username;