From 4a12562946c935266783db9feed5e1f35589842d Mon Sep 17 00:00:00 2001 From: Faisal Salman Date: Thu, 14 Nov 2024 22:51:41 +0700 Subject: [PATCH] [submodule:extensions] Add new CLI: ELinks, HTTPie --- src/extensions/ua-parser-extensions.js | 4 ++-- src/main/ua-parser.js | 2 +- test/specs/browser-clis.json | 30 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/extensions/ua-parser-extensions.js b/src/extensions/ua-parser-extensions.js index a6774ad..8734a2f 100644 --- a/src/extensions/ua-parser-extensions.js +++ b/src/extensions/ua-parser-extensions.js @@ -28,8 +28,8 @@ const LIBRARY = 'library'; const CLIs = Object.freeze({ browser : [ - // wget / curl / lynx - [/(wget|curl|lynx)[\/ ]([\w\.]+)/i], [NAME, VERSION, [TYPE, CLI]] + // wget / curl / Lynx / ELinks / HTTPie + [/(wget|curl|lynx|elinks|httpie)[\/ ]\(?([\w\.-]+)/i], [NAME, VERSION, [TYPE, CLI]] ] }); diff --git a/src/main/ua-parser.js b/src/main/ua-parser.js index c1f07cb..2c5fe6d 100755 --- a/src/main/ua-parser.js +++ b/src/main/ua-parser.js @@ -463,7 +463,7 @@ // Other /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser - /(links) \(([\w\.]+)/i // Links + /\b(links) \(([\w\.]+)/i // Links ], [NAME, [VERSION, /_/g, '.']], [ /(cobalt)\/([\w\.]+)/i // Cobalt diff --git a/test/specs/browser-clis.json b/test/specs/browser-clis.json index 7d344ff..ce89135 100644 --- a/test/specs/browser-clis.json +++ b/test/specs/browser-clis.json @@ -9,6 +9,36 @@ "type" : "cli" } }, + { + "desc" : "ELinks", + "ua" : "ELinks/0.11.4-3-lite (textmode; Debian; Linux 2.6.26-1-686 i686;", + "expect" : + { + "name" : "ELinks", + "version" : "0.11.4-3-lite", + "type" : "cli" + } + }, + { + "desc" : "ELinks", + "ua" : "ELinks (0.11.3; Linux 2.6.23-hardened-r4 i686; 166x55)", + "expect" : + { + "name" : "ELinks", + "version" : "0.11.3", + "type" : "cli" + } + }, + { + "desc" : "HTTPie", + "ua" : "HTTPie/0.9.9", + "expect" : + { + "name" : "HTTPie", + "version" : "0.9.9", + "type" : "cli" + } + }, { "desc" : "lynx", "ua" : "Lynx 2.8.8dev.3",