app/controllers/search_controller.rb
# Count requests coming from same-IP origin.
#
Count requests coming from same-IP origin.
Count requests coming from same - IP origin .
def count_requests
    return if user_signed_in? || Rails.application.secrets.recaptcha_site_key.nil?
    session[ request.ip ] = session[ request.ip ] ? session[ request.ip ] + 1 : 1
    redirect_to search_smart_with_captcha_path( q: params['q'], u: params['u'], e: params['e'], f: 1 ) and return if session[ request.ip ] > MAX_FREE_REQUESTS_BEFORE_CAPTCHA
  end
def count_requests return if user_signed_in? || Rails . application . secrets . recaptcha_site_key . nil? session [ request . ip ] = session [ request . ip ] ? session [ request . ip ] + 1 : 1 redirect_to search_smart_with_captcha_path ( q : params [ 'q' ] , u : params [ 'u' ] , e : params [ 'e' ] , f : 1 ) and return if session [ request . ip ] > MAX_FREE_REQUESTS_BEFORE_CAPTCHA end
Count requests coming from same-IP origin.
Count requests coming from same - IP origin .
# Don't count requests for legitimate and logged-in users: # (but only if captcha key is defined) # DEBUG #    logger.debug( "\r\n------------------------------------------" ) #    logger.debug( "- IP: #{ request.ip }" ) #    logger.debug( "- Remote IP: #{ request.remote_ip }" ) #    logger.debug( "- Headers: #{ request.headers['HTTP_USER_AGENT'].inspect }" ) #    logger.debug( "- Session Req. count: #{ session[ request.ip ] }" ) #    logger.debug( "------------------------------------------" ) # Increase request count: