Skip to content

Commit

Permalink
Fix missing detection for many Kindle Fire devices
Browse files Browse the repository at this point in the history
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
  • Loading branch information
a5ob7r committed Oct 11, 2023
1 parent fa4f685 commit 3912442
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/browser/device/kindle_fire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3912442

Please sign in to comment.