Module: Shugoi

Defined in:
lib/shugoi.rb,
lib/shugoi/pow.rb,
lib/shugoi/core.rb,
lib/shugoi/utils.rb,
lib/shugoi/config.rb,
lib/shugoi/errors.rb,
lib/shugoi/notice.rb,
lib/shugoi/version.rb,
lib/shugoi/constants.rb,
lib/shugoi/api_client.rb,
lib/shugoi/html_store.rb,
lib/shugoi/guard_cache.rb,
lib/shugoi/config_cache.rb,
lib/shugoi/token_signer.rb,
lib/shugoi/rails/railtie.rb,
lib/shugoi/render_handler.rb,
lib/shugoi/rack/middleware.rb,
lib/shugoi/skeleton_generator.rb,
lib/shugoi/rails/configuration.rb

Defined Under Namespace

Modules: Rack, Rails, Utils Classes: ApiClient, Config, ConfigCache, ConfigError, Core, Error, GuardCache, HtmlStore, InvalidSignature, Notice, Pow, RenderHandler, SkeletonGenerator, TokenSigner

Constant Summary collapse

VERSION =
"0.1.3"
BLOCK_PAGE =
[
  "+---------------------------------------------+",
  "|           BLOCKED BY SHUGOI                 |",
  "+---------------------------------------------+",
  "|  Bots, scrapers and headless clients        |",
  "|  are blocked by Shugoi protection.          |",
  "|                                             |",
  "|  Use a standard browser to access           |",
  "|  this site.                                 |",
  "|                                             |",
  "|  - web: https://shugoi.com -                |",
  "+---------------------------------------------+"
].join("\n") + "\n"
DEFAULT_HEADLESS_PATTERNS =
[
  /^curl/i, /^wget/i, /^python/i, /^Go-http-client/i, /^Java\//,
  /HTTPie/i, /^node-fetch/i, /axios/i, /^okhttp/i, /^scrapy/i,
  /PowerShell/i, /WinHttp/i
].freeze
DEFAULT_BOT_WHITELIST =
[
  /Googlebot/i, /Bingbot/i, /Slurp/i, /DuckDuckBot/i, /YandexBot/i, /Applebot/i,
  /facebookexternalhit/i, /Twitterbot/i, /LinkedInBot/i, /Discordbot/i, /Slackbot/i,
  /WhatsApp/i, /TelegramBot/i
].freeze

Class Method Summary collapse

Class Method Details

.configObject



28
29
30
# File 'lib/shugoi.rb', line 28

def config
  @config ||= Shugoi::Rails::Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



32
33
34
# File 'lib/shugoi.rb', line 32

def configure
  yield(config)
end

.new(app, options = {}) ⇒ Object



23
24
25
# File 'lib/shugoi.rb', line 23

def self.new(app, options = {})
  Shugoi::Rack::Middleware.new(app, options)
end