VNC-232 refactored getSetting (#152)

Co-authored-by: matt <matt@kasmsweb.com>
This commit is contained in:
Matt McClaskey 2025-07-29 05:58:54 -04:00 committed by GitHub
parent 6212a9c806
commit df061dc3d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -1165,13 +1165,17 @@ const UI = {
getSetting(name) { getSetting(name) {
const ctrl = document.getElementById('noVNC_setting_' + name); const ctrl = document.getElementById('noVNC_setting_' + name);
let val = WebUtil.readSetting(name); let val = WebUtil.readSetting(name);
if (typeof val !== 'undefined' && val !== null && ctrl.type === 'checkbox') {
if (val.toString().toLowerCase() in {'0': 1, 'no': 1, 'false': 1}) { if (val != null && ctrl.type === 'checkbox') {
const str = String(val).toLowerCase();
const falseStrings = [ '0', 'no', 'false'];
if (falseStrings.includes(str)) {
val = false; val = false;
} else { } else {
val = true; val = true;
} }
} }
return val; return val;
}, },
@ -3051,4 +3055,4 @@ if (l10n.language === "en" || l10n.dictionary !== undefined) {
.then(UI.prime); .then(UI.prime);
} }
export default UI; export default UI;