mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 07:05:05 -04:00
Handle undefined device names
This commit is contained in:
parent
dcf46bd600
commit
4b15aa0417
1 changed files with 14 additions and 4 deletions
|
@ -208,12 +208,22 @@ class Peer {
|
||||||
let ua = parser(req.headers['user-agent']);
|
let ua = parser(req.headers['user-agent']);
|
||||||
|
|
||||||
|
|
||||||
let deviceName = ua.os.name.replace('Mac OS', 'Mac') + ' ';
|
let deviceName = '';
|
||||||
|
|
||||||
|
if (ua.os && ua.os.name) {
|
||||||
|
deviceName = ua.os.name.replace('Mac OS', 'Mac') + ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ua.device){
|
||||||
if (ua.device.model) {
|
if (ua.device.model) {
|
||||||
deviceName += ua.device.model;
|
deviceName += ua.device.model;
|
||||||
} else {
|
} else {
|
||||||
deviceName += ua.browser.name;
|
deviceName += ua.browser.name;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(!deviceName)
|
||||||
|
deviceName = 'Unknown Device';
|
||||||
|
}
|
||||||
|
|
||||||
const displayName = uniqueNamesGenerator({
|
const displayName = uniqueNamesGenerator({
|
||||||
length: 2,
|
length: 2,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue