repsheet_visualizer 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -49,9 +49,10 @@ class RepsheetVisualizer < Sinatra::Base
|
|
49
49
|
|
50
50
|
if connection.exists("offenders")
|
51
51
|
connection.zrevrangebyscore("offenders", "+inf", "0").each do |actor|
|
52
|
+
next if connection.get("#{actor}:repsheet:blacklist") == "true"
|
52
53
|
suspects[actor] = Hash.new 0
|
53
54
|
suspects[actor][:detected] = connection.smembers("#{actor}:detected").join(", ")
|
54
|
-
suspects[actor][:total] = connection.zscore("offenders", actor)
|
55
|
+
suspects[actor][:total] = connection.zscore("offenders", actor).to_i
|
55
56
|
end
|
56
57
|
|
57
58
|
connection.keys("*:*:blacklist").map {|d| d.split(":").first}.reject {|ip| ip.empty?}.each do |actor|
|
@@ -142,7 +143,7 @@ class RepsheetVisualizer < Sinatra::Base
|
|
142
143
|
post '/action' do
|
143
144
|
connection = redis_connection
|
144
145
|
if params["action"] == "allow"
|
145
|
-
connection.
|
146
|
+
connection.del("#{params[:ip]}:repsheet:blacklist")
|
146
147
|
else
|
147
148
|
connection.set("#{params[:ip]}:repsheet:blacklist", "true")
|
148
149
|
connection.expire("#{params[:ip]}:repsheet:blacklist", redis_expiry)
|