block search bots

This commit is contained in:
Pete Matsyburka committed 2026-11-08 09:48:22 +02:00
1 parent 621431166b
commit dbf446efe1
3 files changed
+55

No files matched your search

+40
View File
@@ -63,6 +63,42 @@ module DetectBrowserDevice
NetBSD
/ix
SEARCH_BOT_USER_AGENT_REGEXP = /
Googlebot |
Google-InspectionTool|
Storebot-Google |
AdsBot-Google |
Mediapartners-Google |
bingbot |
BingPreview |
adidxbot |
msnbot |
Slurp |
DuckDuckBot |
Baiduspider |
YandexBot |
YandexImages |
Applebot |
PetalBot |
SeznamBot |
Sogou |
Exabot |
Qwantify |
YisouSpider |
Bytespider |
AhrefsBot |
SemrushBot |
MJ12bot |
DotBot |
GPTBot |
OAI-SearchBot |
ClaudeBot |
Claude-SearchBot |
PerplexityBot |
CCBot |
Amazonbot
/ix
SDK_USER_AGENT_REGEXP = /\ADocuSeal (?<sdk>Ruby|Python|PHP|Java|C#|JS|Go|CLI) v/i
def call(user_agent)
@@ -74,6 +110,10 @@ module DetectBrowserDevice
'desktop'
end
def search_bot?(user_agent)
SEARCH_BOT_USER_AGENT_REGEXP.match?(user_agent.to_s)
end
def os(user_agent)
return if user_agent.blank?