Skip to content

Commit

Permalink
Update version to 2.0.0-rc.1
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Oct 29, 2024
1 parent aad163f commit 1e0175c
Show file tree
Hide file tree
Showing 14 changed files with 255 additions and 191 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# UAParser.js Changelog

## Version 2.0.0-rc.1

- Fix Python Request mistakenly identified as Meta Quest
- Add new browser: Helio
- Add new device: itel, Nothing, Pico, TCL
- Add new engine: ArkWeb
- Add new OS: OpenHarmony, Pico
- Improve browser detection: Quark
- Improve device detection: Xiaomi, Amazon Echo Show, Google Chromecast, Samsung Galaxy Watch
- `ua-parser-js/helpers` submodule:
- Add new method:
- `getDeviceVendor()` to guess for a device vendor based on its model name
- `isElectron()` to check if current window is running inside Electron
- `isFromEU()` to check if current window is from an EU (European Union) country
- `isStandalonePWA()` to check if current window is a standalone PWA
- Rename `isChromiumBased()` to `isChromeFamily()`
- Update `isAppleSilicon()` to also checks for WebGL renderer info
- `ua-parser-js/extensions` submodule:
- Restore `bots` as a compilation of all these browser types: `clis`, `crawlers`, `fetchers`, and `modules`

## Version 2.0.0-beta.3

- Breaking:
Expand Down
83 changes: 9 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,81 +19,14 @@ The most comprehensive, compact, & up-to-date isomorphic JavaScript library to d
user's Browser, Engine, OS, CPU, and Device type/model. Runs either in browser
(client-side) or node.js (server-side).

# Overview

```js
import { UAParser } from 'ua-parser-js';

// 1. Problem:
// Imagine getting this wild user-agent string from a visitor:
const ua = `Mozilla/5.0 (Linux; Android 10; STK-LX1
Build/HONORSTK-LX1; wv) AppleWebKit/537.36 (KHTML,
like Gecko) Version/4.0 Chrome/110.0.5481.153 Mobile
Safari/537.36 musical_ly_2022803040 JsSdk/1.0
NetType/WIFI Channel/huaweiadsglobal_int
AppName/musical_ly app_version/28.3.4 ByteLocale/en
ByteFullLocale/en Region/IQ Spark/1.2.7-alpha.8
AppVersion/28.3.4 PIA/1.5.11 BytedanceWebview/d8a21c6`;
// Note: this is a real user-agent (what???)

// 2. Solution:
// Just pass the complex user-agent string to `UAParser`
const parser = new UAParser(ua);

// 3. Result:
// And voila!
console.log(parser.getBrowser());
// { name : "TikTok", version : "28.3.4", major : "28", type: undefined }

console.log(parser.getCPU());
// { architecture : undefined }

console.log(parser.getEngine());
// { name : "Blink", version : "110.0.5481.153" }

console.log(parser.getDevice());
// { type : "mobile", vendor : "Huawei", model : "STK-LX1" }

console.log(parser.getOS());
// { name : "Android", version : "10" }

console.log(parser.getResult());
/*
{
ua: "Mozilla/5.0 (Linux; Android 10; STK-LX1 Build/HONORSTK-LX1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/110.0.5481.153 Mobile Safari/537.36 musical_ly_2022803040 JsSdk/1.0 NetType/WIFI Channel/huaweiadsglobal_int AppName/musical_ly app_version/28.3.4 ByteLocale/en ByteFullLocale/en Region/IQ Spark/1.2.7-alpha.8 AppVersion/28.3.4 PIA/1.5.11 BytedanceWebview/d8a21c6",
browser: {
name: "TikTok",
version: "28.3.4",
major: "28"
},
cpu: {},
device: {
type: "mobile",
model: "STK-LX1",
vendor: "Huawei"
},
engine: {
name: "Blink",
version: "110.0.5481.153"
},
os: {
name: "Android",
version: "10"
}
}
*/

// 4. Conclusion:
// The visitor is browsing from a TikTok app using an Android-powered Huawei device
// Phew! Thanks, UAParser.js!
```
# Demo

* Live demo: https://uaparser.dev

# Documentation

* v1.0: https://github.com/faisalman/ua-parser-js/tree/1.0.38#documentation
* v2.0: https://docs.uaparser.dev
* `version 1.x` : https://github.com/faisalman/ua-parser-js/tree/1.0.x#documentation
* `version 2.x` : https://docs.uaparser.dev

Before upgrading from `v0.7` / `v1.0`, please read [CHANGELOG](CHANGELOG.md) to
see what's new & breaking.
Expand Down Expand Up @@ -234,7 +167,7 @@ see what's new & breaking.
<td>✅</td>
<td>✅</td>
<td>✅</td>
<td><strong title="1 project per 1 license">️</strong></td>
<td><strong title="1 project per 1 license">️</strong></td>
<td>✅</td>
</tr>
<tr>
Expand All @@ -257,9 +190,9 @@ see what's new & breaking.
<td>Price</td>
<td><strong title="Pay as you want">FREE (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/1.0.x/license.md">License</a>)</strong></td>
<td><strong title="Pay as you want">FREE (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/master/LICENSE.md">License</a>)</strong></td>
<td><strong title="$12 (one-time fee)">$12 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-personal/LICENSE.md">License</a>)</strong></td>
<td><strong title="$25 (one-time fee)">$25 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-business/LICENSE.md">License</a>)</strong></td>
<td><strong title="$500 (one-time fee)">$500 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-enterprise/LICENSE.md">License</a>)</strong></td>
<td><strong title="$14 (one-time fee)">$14 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-personal/LICENSE.md">License</a>)</strong></td>
<td><strong title="$29 (one-time fee)">$29 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-business/LICENSE.md">License</a>)</strong></td>
<td><strong title="$588 (one-time fee)">$588 (<a target="_blank" href="https://raw.githubusercontent.com/faisalman/ua-parser-js/pro-enterprise/LICENSE.md">License</a>)</strong></td>
</tr>
</tbody>
<tfoot>
Expand Down Expand Up @@ -287,3 +220,5 @@ Made with [contributors-img](https://contrib.rocks).

<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/organizations.svg?avatarHeight=64"></a>
<a href="https://opencollective.com/ua-parser-js"><img src="https://opencollective.com/ua-parser-js/individuals.svg?avatarHeight=64"></a>

Support the open-source versions of UAParser.js on [OpenCollective](https://opencollective.com/ua-parser-js) or [GitHub Sponsors](https://github.com/sponsors/faisalman).
4 changes: 2 additions & 2 deletions dist/ua-parser.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/ua-parser.pack.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "UAParser.js",
"name": "ua-parser-js",
"version": "2.0.0-beta.3",
"version": "2.0.0-rc.1",
"author": "Faisal Salman <[email protected]> (http://faisalman.com)",
"description": "Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent & Client Hints data. Supports browser & node.js environment",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/enums/ua-parser-enums.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////
/* Enums for UAParser.js v2.0.0-beta.3
/* Enums for UAParser.js v2.0.0-rc.1
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <[email protected]>
AGPLv3 License */
Expand Down
15 changes: 10 additions & 5 deletions src/enums/ua-parser-enums.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Source: /src/enums/ua-parser-enums.js

///////////////////////////////////////////////
/* Enums for UAParser.js v2.0.0-beta.3
/* Enums for UAParser.js v2.0.0-rc.1
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <[email protected]>
AGPLv3 License */
Expand All @@ -12,8 +12,8 @@
/*jshint esversion: 6 */

const Browser = Object.freeze({
_2345_EXPLORER: '2345Explorer',
_360: '360 Browser',
'2345_EXPLORER': '2345Explorer',
'360': '360 Browser',
ALIPAY: 'Alipay',
AMAYA: 'Amaya',
ANDROID: 'Android Browser',
Expand Down Expand Up @@ -56,6 +56,7 @@ const Browser = Object.freeze({
FLOW: 'Flow',
GO: 'GoBrowser',
GOOGLE_SEARCH: 'GSA',
HELIO: 'Helio',
HEYTAP: 'HeyTap',
HUAWEI: 'Huawei Browser',
ICAB: 'iCab',
Expand Down Expand Up @@ -161,6 +162,7 @@ const BrowserType = Object.freeze({
});

const CPU = Object.freeze({
'68K': '68k',
ARM : 'arm',
ARM_64: 'arm64',
ARM_HF: 'armhf',
Expand All @@ -171,7 +173,6 @@ const CPU = Object.freeze({
IRIX_64: 'irix64',
MIPS: 'mips',
MIPS_64: 'mips64',
M68K: '68k',
PA_RISC: 'pa-risc',
PPC: 'ppc',
SPARC: 'sparc',
Expand Down Expand Up @@ -212,6 +213,7 @@ const Vendor = Object.freeze({
HTC: 'HTC',
HUAWEI: 'Huawei',
INFINIX: 'Infinix',
ITEL: 'itel',
JOLLA: 'Jolla',
KOBO: 'Kobo',
LENOVO: 'Lenovo',
Expand All @@ -222,6 +224,7 @@ const Vendor = Object.freeze({
NEXIAN: 'Nexian',
NINTENDO: 'Nintendo',
NOKIA: 'Nokia',
NOTHING: 'Nothing',
NVIDIA: 'Nvidia',
ONEPLUS: 'OnePlus',
OPPO: 'OPPO',
Expand All @@ -239,6 +242,7 @@ const Vendor = Object.freeze({
SIEMENS: 'Siemens',
SONY: 'Sony',
SPRINT: 'Sprint',
TCL: 'TCL',
TECHNISAT: 'TechniSAT',
TECNO: 'Tecno',
TESLA: 'Tesla',
Expand All @@ -255,6 +259,7 @@ const Vendor = Object.freeze({

const Engine = Object.freeze({
AMAYA: 'Amaya',
ARKWEB: 'ArkWeb',
BLINK: 'Blink',
EDGEHTML: 'EdgeHTML',
FLOW: 'Flow',
Expand Down Expand Up @@ -321,6 +326,7 @@ const OS = Object.freeze({
NETRANGE: 'NetRange',
NETTV: 'NetTV',
NINTENDO: 'Nintendo',
OPENHARMONY: 'OpenHarmony',
OPENBSD: 'OpenBSD',
OPENVMS: 'OpenVMS',
OS2: 'OS/2',
Expand All @@ -347,7 +353,6 @@ const OS = Object.freeze({
UBUNTU: 'Ubuntu',
UNIX: 'Unix',
VECTORLINUX: 'VectorLinux',
VIERA: 'Viera',
WATCHOS: 'watchOS',
WEBOS: 'WebOS',
WINDOWS: 'Windows',
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/ua-parser-extensions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////
/* Extensions for UAParser.js v2.0.0-beta.3
/* Extensions for UAParser.js v2.0.0-rc.1
https://github.com/faisalman/ua-parser-js
Author: Faisal Salman <[email protected]>
AGPLv3 License */
Expand Down
Loading

0 comments on commit 1e0175c

Please sign in to comment.