Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect device for exist brands #212

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions parser/device/alias-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,22 @@ class AliasDevice extends AbstractParser {
} catch (err) {}

for (let cursor in this.collection) {
let item = this.collection[cursor];
let match = this.getBaseRegExp(item['regex']).exec(decodeUserAgent);
const item = this.collection[cursor];
const match = this.getBaseRegExp(item['regex']).exec(decodeUserAgent);
if (match) {
result.name = this.buildByMatch(item['name'], match);
const name = this.buildByMatch(item['name'], match);
if (name) {
result.name = name;
}
if (this.hasReplaceBrand()) {
result.name = result.name.replace(REPLACE_BRAND_REGEXP, '');
}
break;
}
}

result.name = result.name.trim();

if (result.name) {
result.name = result.name.trim();
}
return result;
}

Expand Down
50 changes: 50 additions & 0 deletions regexes/device-index-hash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,8 @@ sc-55d:
- SU
meizu note21:
- M1
tecno kl8:
- TB
gi-626:
- A5
5039d_ru:
Expand Down Expand Up @@ -39705,6 +39707,42 @@ lyn-an00:
- HU
alt-lx2:
- HU
jdy-lx3:
- HU
alt-nx3:
- HU
gfy-lx2p:
- HU
alt-nx1:
- HU
m2001j2i:
- XI
tecno kl5n:
- TB
pkd110:
- OP
mde5:
- XI
ubs1:
- OY
pjt110:
- OP
t7 pro:
- HV
t5 max:
- HV
t506t:
- TC
t506k:
- TC
t506g:
- TC
pags0005in:
- MR
t507d:
- TC
t506a:
- TC
gs55-6:
- GS
gs57-6:
Expand Down Expand Up @@ -49181,6 +49219,18 @@ g10_us:
- GOO
a130-2024:
- ACP
pad 80 wifi:
- OSC
pad 70 wifi:
- OSC
tab 10 wifi:
- B2
mt16:
- UM
tab r5:
- HV
kst103sd-l:
- KIS
jdn-al00:
- HU
ags2-al00hn:
Expand Down
84 changes: 59 additions & 25 deletions regexes/device/mobiles.yml

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions tests/fixtures/devices/phablet-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5472,3 +5472,21 @@
model: Note 21
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 14; TECNO KL8 Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/130.0.6723.58 Mobile Safari/537.36 YandexSearch/7.54 YandexSearchBrowser/7.54
os:
name: Android
version: "14"
platform: ""
client:
type: browser
name: Yandex Browser
version: "7.54"
engine: Blink
engine_version: 130.0.6723.58
device:
type: phablet
brand: Tecno Mobile
model: Pova 6 Neo 5G
os_family: Android
browser_family: Unknown
Loading
Loading