Handle undefined device names - simplify + minor fix

This commit is contained in:
RobinLinus 2021-03-10 15:49:45 +01:00
parent 4b15aa0417
commit fad4632eb9

View file

@ -213,18 +213,16 @@ class Peer {
if (ua.os && ua.os.name) {
deviceName = ua.os.name.replace('Mac OS', 'Mac') + ' ';
}
if(ua.device){
if (ua.device.model) {
deviceName += ua.device.model;
} else {
deviceName += ua.browser.name;
}
if (ua.device.model) {
deviceName += ua.device.model;
} else {
if(!deviceName)
deviceName = 'Unknown Device';
deviceName += ua.browser.name;
}
if(!deviceName)
deviceName = 'Unknown Device';
const displayName = uniqueNamesGenerator({
length: 2,
separator: ' ',