From 17c5040104894546cc8c7ff4f687e5064d042b39 Mon Sep 17 00:00:00 2001 From: kyouk4n Date: Thu, 5 Dec 2024 11:41:42 +0800 Subject: [PATCH 1/4] feat: add Huawei HarmonyOS parser --- regexes.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/regexes.yaml b/regexes.yaml index 3ab1b1f4..09467a1c 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -1915,6 +1915,13 @@ os_parsers: os_v2_replacement: '$2' os_v3_replacement: '$3' + # Huawei HarmonyOS + - regex: 'HarmonyOS\s?(\d*).?(\d*).?(\d*)' + os_replacement: 'Harmony' + os_v1_replacement: '$1' + os_v2_replacement: '$2' + os_v3_replacement: '$3' + device_parsers: ######### From 21b25f9a616508713a1cbec9f56eeb1f796bc7a3 Mon Sep 17 00:00:00 2001 From: kyouk4n Date: Thu, 5 Dec 2024 12:01:32 +0800 Subject: [PATCH 2/4] feat: add HarmonyOS parser unit test --- tests/test_os.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_os.yaml b/tests/test_os.yaml index 38ed3005..cfdb8af5 100644 --- a/tests/test_os.yaml +++ b/tests/test_os.yaml @@ -3369,3 +3369,9 @@ test_cases: patch: patch_minor: + - user_agent_string: 'Mozilla/5.0 (TAS-AL00 Build/HUAWEITAS-AL00; 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' + family: 'Harmony' + major: '3' + minor: '0' + patch: '0' + patch_minor: From e90664b383e476d25229a63b2717054076d1aad8 Mon Sep 17 00:00:00 2001 From: kyouk4n Date: Fri, 6 Dec 2024 16:25:52 +0800 Subject: [PATCH 3/4] fix: optional HarmonyOS version number --- regexes.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/regexes.yaml b/regexes.yaml index 09467a1c..53f3e423 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -1916,11 +1916,7 @@ os_parsers: os_v3_replacement: '$3' # Huawei HarmonyOS - - regex: 'HarmonyOS\s?(\d*).?(\d*).?(\d*)' - os_replacement: 'Harmony' - os_v1_replacement: '$1' - os_v2_replacement: '$2' - os_v3_replacement: '$3' + - regex: '(HarmonyOS)\s?(\d+|)\.?(\d+|)\.?(\d+|)' device_parsers: From 9815f8f6bebb138a2f4989ddcfb779309857c04d Mon Sep 17 00:00:00 2001 From: kyouk4n Date: Fri, 6 Dec 2024 16:39:13 +0800 Subject: [PATCH 4/4] fix: modify HarmonyOS regex --- regexes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regexes.yaml b/regexes.yaml index 53f3e423..f6427026 100644 --- a/regexes.yaml +++ b/regexes.yaml @@ -1916,7 +1916,7 @@ os_parsers: os_v3_replacement: '$3' # Huawei HarmonyOS - - regex: '(HarmonyOS)\s?(\d+|)\.?(\d+|)\.?(\d+|)' + - regex: '(HarmonyOS)[\s;]+(\d+|)\.?(\d+|)\.?(\d+|)' device_parsers: