commit fad4632eb903ea6de9ecbec90df0ac6bd7410e68 parent 4b15aa04173871b08d13c3737ec5ba9921833812 Author: RobinLinus <robinlinus@users.noreply.github.com> Date: Wed, 10 Mar 2021 15:49:45 +0100 Handle undefined device names - simplify + minor fix Diffstat:
M | server/index.js | | | 16 | +++++++--------- |
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/server/index.js b/server/index.js @@ -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: ' ',