-
Notifications
You must be signed in to change notification settings - Fork 449
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
feat: add Huawei HarmonyOS parser #604
base: master
Are you sure you want to change the base?
Conversation
regexes.yaml
Outdated
os_replacement: 'Harmony' | ||
os_v1_replacement: '$1' | ||
os_v2_replacement: '$2' | ||
os_v3_replacement: '$3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os_v1 / v2 / v3 replacements are not needed, as it will take the capture groups above in order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see
regexes.yaml
Outdated
@@ -1915,6 +1915,13 @@ os_parsers: | |||
os_v2_replacement: '$2' | |||
os_v3_replacement: '$3' | |||
|
|||
# Huawei HarmonyOS | |||
- regex: 'HarmonyOS\s?(\d*).?(\d*).?(\d*)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use \d+
, as otherwise this might mess up the capture groups - also, are those actually optional? if not, let's enforce a format such as \d+\.\d+\.\d+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some Harmony OS User-Agent strings may not explicitly include the version number. Here are two examples:
e.g.
- with version
Mozilla/5.0 (Linux; Android 12; LIO-AN00 Build/HUAWEILIO-AN00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/97.0.4692.98 Mobile Safari/537.36 T7/13.76 BDOS/1.0 (HarmonyOS 3.0.0) SP-engine/3.17.0 baiduboxapp/13.76.0.10 (Baidu; P1 12) NABar/1.0
- without version
Mozilla/5.0 (Linux; Android 12; HarmonyOS; CET-AL00; HMSCore 6.14.0.322) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.196 HuaweiBrowser/15.0.9.300 Mobile Safari/537.36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this regex: (HarmonyOS)[\s;]+(\d+|)\.?(\d+|)\.?(\d+|)
Add Huawei HarmonyOS parser