mirror of
https://github.com/owncast/owncast.git
synced 2024-11-26 06:46:01 +03:00
Fallback to displaying full user-agent string if a pretty version cannot be determined
This commit is contained in:
parent
3e5f99cf19
commit
ca050d7990
1 changed files with 6 additions and 0 deletions
|
@ -55,6 +55,12 @@ export function formatUAstring(uaString: string) {
|
|||
const { major: browserVersion, name } = browser;
|
||||
const { version: osVersion, name: osName } = os;
|
||||
const { model, type } = device;
|
||||
|
||||
// Fallback to just displaying the raw agent string.
|
||||
if (!name || !browserVersion || !osName) {
|
||||
return uaString;
|
||||
}
|
||||
|
||||
const deviceString = model || type ? ` (${model || type})` : '';
|
||||
return `${name} ${browserVersion} on ${osName} ${osVersion}
|
||||
${deviceString}`;
|
||||
|
|
Loading…
Reference in a new issue