firebug 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 265efc6f37e57f982967eb40761fb60e60531bd0
4
- data.tar.gz: 054e3fe42e2e3676a7cbc7ec36bfe1091730ad80
3
+ metadata.gz: 5bf90b694d5688ace43fb531d31216567031e06e
4
+ data.tar.gz: f288b37697c98a382964584e7615851541aa085e
5
5
  SHA512:
6
- metadata.gz: 12b0f337d394a104b9b76ae1dc60f932395e2725b2fe502e641500cf418c1969c11832b724f0e36fabf8ab1b375bc6c7b674b819e1dc428a466eb4bb3621642f
7
- data.tar.gz: b637fdbcdb4b97bdfbfbe94d5ef71f416571f39fc680d585adf9645b1d6d1d1daf61298ef9ae84ed3ece6090d8fe4369528c4b0a776d69c450b716d43afbdde1
6
+ metadata.gz: d7b1d536b012704b0fec305424c05f81426494023f064816941f056f9553a125f4f3050a28aef1d979fe36784739a5a0b00a6c801b7b9b1d9fc751d528659b4f
7
+ data.tar.gz: afb6a295079c61ee39530b773711227c90e1422e8fc8b9d1e55f2ce494a3c2d0c985c38e63c5e2b7e479bed11f7b163ccef29f92ab23325f246977ec6f8adc7a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- firebug (0.1.7)
4
+ firebug (0.1.8)
5
5
  actionpack (~> 5.0)
6
6
  activerecord (~> 5.0)
7
7
  ruby-mcrypt (~> 0.2)
@@ -76,10 +76,7 @@ module ActionDispatch
76
76
  # @return [Firebug::Session]
77
77
  def find_session_model(req, sid=nil)
78
78
  if sid
79
- p = { session_id: sid }
80
- p[:user_agent] = req.user_agent if Firebug.configuration.match_user_agent
81
- p[:ip_address] = req.remote_ip if Firebug.configuration.match_ip_address
82
- model = Firebug::Session.find_by(p)
79
+ model = Firebug::Session.find_by(find_by_params(req, sid))
83
80
  return model if model
84
81
  # use a different session ID in case the reason for not finding the record is because the user_agent
85
82
  # or ip_address didn't match.
@@ -93,6 +90,18 @@ module ActionDispatch
93
90
  ip_address: req.remote_ip
94
91
  )
95
92
  end
93
+
94
+ # @param [ActionDispatch::Request] req
95
+ # @param [String] sid
96
+ # @return [Hash]
97
+ def find_by_params(req, sid)
98
+ params = { session_id: sid }
99
+ params[:ip_address] = req.remote_ip if Firebug.configuration.match_ip_address
100
+ if Firebug.configuration.match_user_agent
101
+ params[:user_agent] = Firebug.configuration.truncate_user_agent ? req.user_agent[0...120] : req.user_agent
102
+ end
103
+ params
104
+ end
96
105
  end
97
106
  end
98
107
  end
@@ -5,14 +5,14 @@ module Firebug
5
5
  #
6
6
  # @attr [String] key the encryption key used to encrypt and decrypt cookies.
7
7
  # @attr [String] table_name the name of the sessions table.
8
- # @attr [Boolean] truncate_useragent truncate the user-agent to 120 characters.
8
+ # @attr [Boolean] truncate_user_agent truncate the user-agent to 120 characters.
9
9
  # @attr [Boolean] match_user_agent use the user-agent in addition to the session ID.
10
10
  # @attr [Boolean] match_ip_address use the remote ip address in addition to the session ID.
11
11
  class Configuration
12
12
  attr_reader :table_name
13
13
 
14
14
  attr_accessor :key
15
- attr_accessor :truncate_useragent
15
+ attr_accessor :truncate_user_agent
16
16
  attr_accessor :match_user_agent
17
17
  attr_accessor :match_ip_address
18
18
 
@@ -21,7 +21,7 @@ module Firebug
21
21
  def user_agent=(value)
22
22
  # Pyro seems to truncate the value and since it also uses this value when finding the session, it's important
23
23
  # we do the same.
24
- super(Firebug.configuration.truncate_useragent ? value[0...120] : value)
24
+ super(Firebug.configuration.truncate_user_agent ? value[0...120] : value)
25
25
  end
26
26
 
27
27
  # @return [String]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Firebug
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.8'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Frase