Skip to content

Commit

Permalink
feat(sync) Detect new brands Blackton, Temigereev and Detect devices …
Browse files Browse the repository at this point in the history
…for exist brands (matomo-org#7917)

feat(device) detect new brand Temigereev: TG 30, TG 15
feat(device) detect brand Samsung: Galaxy M55 5G (SM-M556B), Galaxy Tab S10 Ultra 14.6" 5G (SM-X926B)
feat(device) detect brand Motorola: Moto G8 Play (XT2015-2), Moto S50 (XT2409-5)
feat(device) detect brand Meizu: 20 Infinity
feat(device) detect brand Ace: Buzz 5 Lite
feat(device) detect brand W&O: WO7
feat(device) detect brand Tanix: TX3 Mini
feat(device) detect brand Lingbo: L24 Ultra, G15 Pro Max, G24 Mini, G15 Mini, Venus Pad 16, Venus Pad 15

* feat(device) detect new brand Blackton: Bt 32FS32B
feat(device) detect brand KENSHI: Armor I1 Slim
feat(device) detect brand HongTop: Smart TV
feat(device) detect brand Tecno Mobile: Spark 30 (TECNO KL6), Phantom V2 Flip (TECNO AE11)
feat(device) detect brand Huawei: Honor X7c (ALT-LX1), Honor Pad X8a WiFi (NDL-W09)
feat(device) detect brand Realme: 13 5G (RMX3951)
feat(device) detect brand Blackview: Tab 16 Pro
feat(device) detect brand Lenovo: Xiaoxin Pad Pro 12.7" (TB375FC)
feat(device) detect brand Vivo: X200 Pro (V2405A), V40 Lite (V2424, V2417)
feat(device) detect brand Lingbo: L16 Max
feat(device) detect brand Oukitel: WP52
feat(device) detect brand Motorola: Moto Razr 50 (XT2453-2), Moto G85 5G
---
feat(sync) Detect new brand: Biegedy And Detect devices for exist brands (matomo-org#7923)
feat(device) detect brand Samsung: Galaxy Z Fold 5 (SC-55D), Galaxy S23 (SC-51D), Galaxy S24 (SC-51E)
feat(device) detect brand POCO: C75 (2410FPCC5G)
feat(device) detect brand Xiaomi: Mix Flip (2405CPX3DG)
feat(device) detect brand Sony: Xperia 1 V (SO-51D)
feat(device) detect brand Oukitel: RT8
feat(device) detect brand Ugoos: TOX4, TOX3 Plus
feat(device) detect brand Realme: Narzo 70 Turbo 5G (RMX5003)
feat(device) detect brand DISH: Celero 5G SC (SN339D)
feat(device) detect brand Tecno Mobile: Spark Go (2024) (TECNO BG6s), Spark 30 Pro (TECNO KL7), Spark 20 Pro 5G (TECNO KJ8), Phantom V Fold 2 (TECNO AE10)
feat(device) detect new brand Biegedy: B22
feat(device) detect brand Blackview: Wave 8
feat(device) detect brand Sony: Xperia 1 VI (XQ-EC44)
feat(device) detect brand OPPO: A60 5G (CPH2683)
feat(device) detect brand Chuwi: Hi10 XPro Pad
feat(device) detect brand Motorola: Moto G Play (2023) (XT2271-5), Moto E14
---
feat(sync) Improves version detection for Azure Linux, macOS and Windows (matomo-org#7922)
* Adds detection for Cygwin
* Adds detection for Azure Blob Storage
* Improves version detection for Windows
* Improves version detection for macOS
* Improves platform detection
* Improves detection for Azure Linux
  • Loading branch information
sanchezzzhak committed Nov 20, 2024
1 parent 4aeba7f commit 0b8af5f
Show file tree
Hide file tree
Showing 21 changed files with 1,455 additions and 125 deletions.
8 changes: 4 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ export default class DeviceDetector {
setOsVersionTruncate(value: any): void;
setClientVersionTruncate(value: any): void;

set deviceTrusted(arg: boolean);
set deviceTrusted(stage: boolean);
get deviceTrusted(): boolean;

set deviceInfo(arg: boolean);
set deviceInfo(stage: boolean);
get deviceInfo(): boolean;

/**
* @param {boolean} arg - true use indexes, false not use indexes
* @param {boolean} stage - true use indexes, false not use indexes
*/
set deviceIndexes(arg: boolean);
set deviceIndexes(stage: boolean);

/**
* @return {boolean} - true use indexes, false not use indexes
Expand Down
26 changes: 18 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DeviceDetector {
/**
* @param {DeviceDetectorOptions} options
**/
constructor(options) {
constructor(options = {}) {
this.init();

this.skipBotDetection = attr(options, 'skipBotDetection', false);
Expand Down Expand Up @@ -116,8 +116,8 @@ class DeviceDetector {
this.addParseBot(BOT_PARSER, new BotParser());
}

set deviceTrusted(check) {
this.#deviceTrusted = check;
set deviceTrusted(stage) {
this.#deviceTrusted = stage;
}

get deviceTrusted() {
Expand Down Expand Up @@ -166,10 +166,10 @@ class DeviceDetector {
}

/**
* @param {boolean} status - true use indexes, false not use indexes
* @param {boolean} stage - true use indexes, false not use indexes
*/
set deviceIndexes(status) {
this.#deviceIndexes = status;
set deviceIndexes(stage) {
this.#deviceIndexes = stage;
}

/**
Expand Down Expand Up @@ -626,7 +626,7 @@ class DeviceDetector {
deviceType = DEVICE_TYPE.TV;
}
/**
* All devices that contain Andr0id in string are assumed to be a tv
* All devices that contain "Andr0id" in string are assumed to be a tv
*/
if (helper.hasAndroidTVFragment(userAgent)) {
deviceType = DEVICE_TYPE.TV;
Expand Down Expand Up @@ -695,6 +695,16 @@ class DeviceDetector {
return aliasDevice.parse(userAgent);
}

/**
* restore original userAgent from clientHints object
* @param {string} userAgent
* @param {ResultClientHints} clientHints
* @return {string}
*/
restoreUserAgentFromClientHints(userAgent, clientHints) {
return helper.restoreUserAgentFromClientHints(userAgent, clientHints)
}

/**
* parse device
* @param {string} userAgent
Expand All @@ -714,7 +724,7 @@ class DeviceDetector {
trusted: null
};

let ua = helper.restoreUserAgentFromClientHints(userAgent, clientHints);
const ua = this.restoreUserAgentFromClientHints(userAgent, clientHints);
// skip all parse is client-hints useragent and model not exist
if (!helper.hasDeviceModelByClientHints(clientHints) && helper.hasUserAgentClientHintsFragment(userAgent)) {
return Object.assign({}, result);
Expand Down
4 changes: 2 additions & 2 deletions parser/client/browser-families.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ module.exports = {
],
'Firefox': [
'FF', 'BI', 'BF', 'BH', 'BN', 'C0', 'CU', 'EI', 'F1',
'FB', 'FE', 'AX', 'FM', 'FR', 'FY', 'GZ', 'I4', 'IF',
'FB', 'FE', 'AX', 'FM', 'FR', 'FY', 'I4', 'IF', '8P',
'IW', 'LH', 'LY', 'MB', 'MN', 'MO', 'MY', 'OA', 'OS',
'PI', 'PX', 'QA', 'S5', 'SX', 'TF', 'TO', 'WF', 'ZV',
'FP', 'AD', '2I', 'P9', 'KJ', 'WY', 'VK', 'W5',
'7C', 'N7', 'W7', '8P',
'7C', 'N7', 'W7',
],
'Internet Explorer': ['IE', 'CZ', 'BZ', 'IM', 'PS', '3A', '4A', 'RN'],
'Konqueror': ['KO'],
Expand Down
3 changes: 3 additions & 0 deletions parser/device/brand-short.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,13 @@ module.exports = {
'BT': 'Bitel',
'B7': 'Bitmore',
'ZB': 'Bittium',
'BIE': 'Biegedy',
'BK': 'Bkav',
'5B': 'Black Bear',
'BLK': 'Black Box',
'BF': 'Black Fox',
'BPC': 'Blackpcs',
'BLT': 'Blackton',
'B2': 'Blackview',
'2Y': 'b2m',
'BP': 'Blaupunkt',
Expand Down Expand Up @@ -1611,6 +1613,7 @@ module.exports = {
'TX': 'TechniSat',
'TT': 'TechnoTrend',
'TTS': 'TECHNOSAT',
'TM1': 'Temigereev',
'TP': 'TechPad',
'TPS': 'TPS',
'9E': 'Techwood',
Expand Down
2 changes: 1 addition & 1 deletion parser/os-abstract-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class OsAbstractParser extends ParserAbstract {
if (this.getBaseRegExp('sparc64').test(userAgent)) {
return 'SPARC64';
}
if (this.getBaseRegExp('64-?bit|WOW64|(?:Intel)?x64|WINDOWS_64|win64|.*amd64|x86_?64').test(userAgent)) {
if (this.getBaseRegExp('64-?bit|WOW64|(?:Intel)?x64|WINDOWS_64|win64|.*amd64|.*x86_?64').test(userAgent)) {
return 'x64';
}
if (this.getBaseRegExp('.+32bit|.+win32|(?:i[0-9]|x)86|i86pc').test(userAgent)) {
Expand Down
3 changes: 0 additions & 3 deletions regexes/client/browser_engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
- regex: 'Servo'
name: 'Servo'

- regex: 'Goanna'
name: 'Goanna'

- regex: 'Ekioh(?:Flow)?'
name: 'EkiohFlow'

Expand Down
14 changes: 10 additions & 4 deletions regexes/client/libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@
name: 'OkHttp'
version: '$1'

- regex: 'HTTP_Request2(?:/(\d+[.\d]+))?'
name: 'HTTP_Request2'
version: '$1'

- regex: 'HTTP_Request2(?:/(\d+[.\d]+))?'
name: 'HTTP_Request2'
version: '$1'
Expand Down Expand Up @@ -643,3 +639,13 @@
name: 'ICAP Client'
version: '$1'
url: 'https://github.com/Peoplecantfly/icapserver'

- regex: 'Cygwin-Setup(?:/(\d+[.\d]+))?'
name: 'Cygwin'
version: '$1'
url: 'https://www.cygwin.com/'

- regex: 'azsdk-python-storage-blob(?:/(\d+[.\d]+))?'
name: 'Azure Blob Storage'
version: '$1'
url: 'https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python'
4 changes: 0 additions & 4 deletions regexes/client/mediaplayers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@
name: 'mpv'
version: '$1'

- regex: 'foobar2000(?:/([\w\.]+))?'
name: 'foobar2000'
version: '$1'

- regex: 'HTC Streaming Player'
name: 'HTC Streaming Player'
version: ''
Expand Down
Loading

0 comments on commit 0b8af5f

Please sign in to comment.