faisalman / ua-parser-js

"Unmask Your Traffic" - UAParser.js: The Essential Web Development Tool for User-Agent Detection
https://uaparser.dev/
GNU Affero General Public License v3.0
9.28k stars 1.2k forks source link

Please add support for new Opreating System (Linux Distro) : PiluX #617

Closed hasanmerkit closed 1 year ago

hasanmerkit commented 1 year ago

Hi,

We have been creating Operating System (Ubuntu based) for few years. We have planned to release it to public in summer 2023.

Our OS is using its own "User Agent String" in browsers, so can ua-parser-js add support? You can learn with this examples written below how to detect PiluX operating system.

Examples used HTML page: https://www.teteos.net/test (This page using ua-parser-js javascript library.)

Ubuntu 22.04, Firefox 108: User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0

OS - Name : Ubuntu
OS - Version : undefined
CPU - Arch : amd64

Browser - Name : Firefox
Browser - Version : 108.0

Engine - Name : Gecko
Engine - Version : 108.0

PiluX version v2.1, Firefox 108: This should be: User Agent: Mozilla/5.0 (X11; PiluX; Ubuntu; Linux x86_64; rv:108.0) PiluX/2.1 PiluXServer/2.1 Gecko/20100101 Firefox/108.0

OS - Name : PiluX
OS - Version : 2.1
CPU - Arch : amd64

Browser - Name : Firefox
Browser - Version : 108.0

Engine - Name : Gecko
Engine - Version : 108.0

PiluX Server version v2.1, Firefox 108: This should be: User Agent: Mozilla/5.0 (X11; PiluX; Ubuntu; Linux x86_64; rv:108.0) PiluX/2.1 PiluXServer/2.1 Gecko/20100101 Firefox/108.0

OS - Name : PiluX Server
OS - Version : 2.1
CPU - Arch : amd64

Browser - Name : Firefox
Browser - Version : 108.0

Engine - Name : Gecko
Engine - Version : 108.0

UA string usage from PiluX: Mozilla/5.0 ([Window System, "X11" or "Wayland"]; PiluX; [PiluX some versions Ubuntu, Debian, PopOS or Linux Mint Based], Linux [arch]; rv:[Firefox or Engine Version]) PiluX/[VersionNo Integer] Gecko/[Gecko Version] Firefox/[Firefox Version]

If InString("PiluXServer"){ "PiluX Server" } else { "PiluX" }

faisalman commented 1 year ago

In the meantime there is no support for PiluX, but you can add it now using extension: https://github.com/faisalman/ua-parser-js#extending-regex

const result = UAParser("Mozilla/5.0 (X11; PiluX; Ubuntu; Linux x86_64; rv:108.0) PiluX/2.1 PiluXServer/2.1 Gecko/20100101 Firefox/108.0", 
{ 
  os : [[/(pilux)\/([\d\.]+)/i], [UAParser.OS.NAME, UAParser.OS.VERSION]]
});
console.log(result.os); // { name: "PiluX", version: "2.1" }
hasanmerkit commented 1 year ago

Thanks for reply @faisalman , Do we have to wait for the operating system to become popular for PiluX support to be added?