mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 08:34:39 +08:00
f6fdc1ebe8
You can use the crawler user agents site setting to amend what user agents are considered crawlers based on a string match in the user agent Also improves performance of crawler detection slightly
10 lines
246 B
Ruby
10 lines
246 B
Ruby
unless ::Regexp.instance_methods.include?(:match?)
|
|
class ::Regexp
|
|
# this is the fast way of checking a regex (zero string allocs) added in Ruby 2.4
|
|
# backfill it for now
|
|
def match?(string)
|
|
!!(string =~ self)
|
|
end
|
|
end
|
|
end
|