fix on getByname

This commit is contained in:
rustdesk 2022-01-31 00:48:04 +08:00
parent a75bef9791
commit 1e13484c26
2 changed files with 13 additions and 9 deletions

View File

@ -424,8 +424,8 @@ export default class Connection {
}
}
getRemember(): any {
return this._options["remember"];
getRemember(): Boolean {
return this._options["remember"] || false;
}
setRemember(v: Boolean) {
@ -566,9 +566,9 @@ export default class Connection {
const misc = message.Misc.fromPartial({ option });
this._ws?.sendMessage({ misc });
}
getImageQuality() {
return this.getOption("image-quality");
return this.getOption('image-quality');
}
getImageQualityEnum(

View File

@ -229,14 +229,18 @@ window.setByName = (name, value) => {
}
window.getByName = (name, arg) => {
try {
arg = JSON.parse(arg);
} catch (e) { }
let v = _getByName(name, arg);
if (typeof v == 'string' || v instanceof String) return v;
if (v == undefined || v == null) return '';
return JSON.stringify(v);
}
function _getByName(name, arg) {
switch (name) {
case 'peers':
return localStorage.getItem('peers') || '[]';
case 'remote_id':
return localStorage.getItem('remote-id') || '';
return localStorage.getItem('remote-id');
case 'remember':
return curConn.getRemember();
case 'event':
@ -247,7 +251,7 @@ window.getByName = (name, arg) => {
}
break;
case 'toggle_option':
return curConn.getOption(arg);
return curConn.getOption(arg) || false;
case 'option':
return localStorage.getItem(arg);
case 'image_quality':