-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add detect LeafOS #7862
Comments
original UA: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Mobile Safari/537.36
client hints:
brands:
- brand: Not/A)Brand
version: '8'
- brand: Chromium
version: '126'
fullVersionList:
- brand: Not/A)Brand
version: 8.0.0.0
- brand: Chromium
version: 126.0.6478.71
mobile: '1'
model: LeafOS on ARM64
platform: Android
platformVersion: 14.0.0
uaFullVersion: 126.0.6478.71
wow64: '0' |
liviuconcioiu
added a commit
to liviuconcioiu/device-detector
that referenced
this issue
Oct 14, 2024
@sanchezzzhak do you know an easier way to get the OS from model? This code https://github.com/matomo-org/device-detector/pull/7853/files#diff-7683a6d465c7fc908120453c3c475e476aa9c54f7de8c810ca45af9c752c816cR394-R405 works, but I don't like it. |
sanchezzzhak
pushed a commit
that referenced
this issue
Oct 14, 2024
create common method from AbstractParser and move code public function restoreUserAgentFromClientHints(): void
{
$deviceModel = $this->clientHints?->getModel() ?? '';
if ('' === $deviceModel) {
return;
}
// is freeze user-agent then restoring the original UA for the device definition
if ($this->hasUserAgentClientHintsFragment()) {
$osVersion = $this->clientHints->getOperatingSystemVersion();
$this->setUserAgent((string) \preg_replace(
'(Android (?:10[.\d]*; K|1[1-5]))',
\sprintf('Android %s; %s', '' !== $osVersion ? $osVersion : '10', $deviceModel),
$this->userAgent
));
}
// is freeze user-agent then restoring the original UA for the device definition
if ($this->hasDesktopFragment()) {
$this->setUserAgent((string) \preg_replace(
'(X11; Linux x86_64)',
\sprintf('X11; Linux x86_64; %s', $deviceModel),
$this->userAgent
));
}
} |
This was referenced Oct 15, 2024
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
current parse result:
expected result
site https://leafos.org/
The text was updated successfully, but these errors were encountered: