From de4df43c7c02f2573fb617dfc411ee904e7c19c8 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Thu, 3 Nov 2016 16:19:39 -0500 Subject: [PATCH] not using tor anymore, add some more bot UAs --- app/controllers/application_controller.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 012a7a0..26a18ea 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -29,8 +29,7 @@ class ApplicationController < ActionController::Base traffic = traffic_kv.value.to_i # don't increase traffic counter for bots or api requests - unless agent_is_spider? || agent_via_tor? || - [ "json", "rss" ].include?(params[:format]) + unless agent_is_spider? || [ "json", "rss" ].include?(params[:format]) traffic += 100 end @@ -105,11 +104,7 @@ class ApplicationController < ActionController::Base def agent_is_spider? ua = request.env["HTTP_USER_AGENT"].to_s - (ua == "" || ua.match(/(Google|bing)bot|Slurp|crawler/)) - end - - def agent_via_tor? - request.remote_ip == "127.0.0.1" + (ua == "" || ua.match(/(Google|bing|Slack|Twitter)bot|Slurp|crawler|Feedly|FeedParser|RSS/)) end def find_user_from_rss_token