firebug 0.1.0 → 0.1.1

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: 796b86c8a6af3f8a9bf29550ababbfa8832800ea
4
- data.tar.gz: e6a76a738061ecb0e85e1933c74c25b0c39bcef1
3
+ metadata.gz: 45efa98f665949bc503297c7f4f8c46ff43d60fc
4
+ data.tar.gz: 4a93d2a74d29ded79c048796d04ebd38c8ef11ae
5
5
  SHA512:
6
- metadata.gz: fc490c46299de656fc4f3fa42807e9f7b4a3b501d6e25a75c98d838a4ead98cf77e479b41d9a05809722791aee212d01284fbda9b1c761934dc53d9c62ee8d2a
7
- data.tar.gz: 91eceecffd4cb36e4772d6fe8952fc794b93a008a3eeb260d014c715a8a11b34c87d95a78e1f23343260e9a746219ddd3040e2148e4abac07932327274e9394a
6
+ metadata.gz: b8820e847d97883e5ed050d7195c0a48bd0e32ba586af32bbeb2c146325659eee6102fec7d305d9df3d7372c6dcc654c6975607b94a5b1416b90813ee55e2786
7
+ data.tar.gz: 2f66962cda34ed35ca59255af7338c5fb7318d43cc3aa0939ce33260a61dbbbae7764dde927b8ba0aded2f813c8192d96903db4089d23c4fa9495d1b3350c6ad
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- firebug (0.1.0)
4
+ firebug (0.1.1)
5
5
  actionpack (~> 5.0)
6
6
  activerecord (~> 5.0)
7
7
  ruby-mcrypt (~> 0.2)
@@ -34,7 +34,7 @@ module ActionDispatch
34
34
  model_params = {
35
35
  session_id: model.session_id,
36
36
  user_agent: req.user_agent || '', # user_agent can't be null
37
- ip_address: req.remote_ip || '', # ip_address can't be null
37
+ ip_address: req.ip || '', # ip_address can't be null
38
38
  user_data: session
39
39
  }
40
40
  # Returning false will cause Rack to output a warning.
@@ -76,7 +76,10 @@ module ActionDispatch
76
76
  # @return [Firebug::Session]
77
77
  def find_session_model(req, sid=nil)
78
78
  if sid
79
- model = Firebug::Session.find_by(session_id: sid)
79
+ p = { session_id: sid }
80
+ p[:ip_address] = req.ip if Firebug.configuration.match_ip
81
+ p[:user_agent] = req.user_agent if Firebug.configuration.match_useragent
82
+ model = Firebug::Session.find_by(p)
80
83
  return model if model
81
84
  end
82
85
 
@@ -84,7 +87,7 @@ module ActionDispatch
84
87
  session_id: sid || generate_sid,
85
88
  last_activity: Time.current.to_i,
86
89
  user_agent: req.user_agent,
87
- ip_address: req.remote_ip
90
+ ip_address: req.ip
88
91
  )
89
92
  end
90
93
  end
@@ -5,10 +5,22 @@ 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
9
+ # @attr [Boolean] match_useragent
10
+ # @attr [Boolean] match_ip
8
11
  class Configuration
9
12
  attr_reader :table_name
10
13
 
11
14
  attr_accessor :key
15
+ attr_accessor :truncate_useragent
16
+ attr_accessor :match_useragent
17
+ attr_accessor :match_ip
18
+
19
+ # def initialize
20
+ # @truncate_useragent = false
21
+ # @match_useragent = false
22
+ # @match_ip = false
23
+ # end
12
24
 
13
25
  # Sets the table name for +Firebug::Session+
14
26
  #
@@ -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(value[0...120])
24
+ super(Firebug.configuration.truncate_useragent ? 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.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Frase
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-02 00:00:00.000000000 Z
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack