From 3912442c613ef1d5a74a1f3b65f472b2e87b3bba Mon Sep 17 00:00:00 2001 From: a5ob7r <12132068+a5ob7r@users.noreply.github.com> Date: Thu, 12 Oct 2023 02:03:48 +0900 Subject: [PATCH] Fix missing detection for many Kindle Fire devices The previous regex to detect Kindle Fire devices is incomplete, so it can only detect Kindle Fire (1st Gen) and Kindle Fire HD 7 (2nd Gen). The reason why is that it uses a device specific identifier, which is referenced as Build Model in the document. We can fix this problem by using the more generalized regex to detect many other Kindle Fire devices. The regex is from the official document, but with a little tweaking for simplification. The original regex is for not only detecting the devices but also extracting Build Models and version number of the browser, which we do not need to do them. https://docs.aws.amazon.com/silk/latest/developerguide/detecting-silk-ua.html --- lib/browser/device/kindle_fire.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser/device/kindle_fire.rb b/lib/browser/device/kindle_fire.rb index 10ee07b1..d65e93ec 100644 --- a/lib/browser/device/kindle_fire.rb +++ b/lib/browser/device/kindle_fire.rb @@ -12,7 +12,7 @@ def name end def match? - ua.match?(/Kindle Fire|KFTT/) + ua.match?(%r{Kindle Fire|; [^;)]+ Build/.*\bSilk/[0-9._-]+\b}) end end end