enjoy_cms_goto 0.3.6 → 0.3.7

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: 46ff6a0dd7e6a8b5be871adaeaf59c61533552a3
4
- data.tar.gz: f12b1c6a868b98d5b295ea03366f331fa9b9b707
3
+ metadata.gz: ac37e01d38bd2f30b7a1386733bac3989a21ad05
4
+ data.tar.gz: 960fd4f624f441a30aec6a2c8a3b60579c4aa6a2
5
5
  SHA512:
6
- metadata.gz: f5494059e3b5cd68dccc02f32c56c373d1be73dc2ae771368afc903ff949e306cb2d634ddf7a30c29ce84e2f04cad170c9812f026e45c7704e3371fcb42eeca3
7
- data.tar.gz: 1b5e57b43ad0d148f222e6fa29b095aaa6e3e7cc8296e138e652914f51ba581fa1718bc42a1f49bd4e0ef8554c78ab714ef9b7c982e3037399fcabfc04128002
6
+ metadata.gz: 2f718d039cdd527dcc7f1844182720aae509313c640f37ef33254bea3aa254b4ef21c2df3a5b21b7eb7e73ad5e48a7700e828c93b0012e001f670a54ded14c09
7
+ data.tar.gz: 3582d133bdb0f82f9f5ae338881338e51cd8b6a34fdb49592aff673dc402347553ad52d7d725f6b2b7215deb3afb43be9138b4d807e500491dbb59191e710c4a
@@ -5,7 +5,7 @@ ru:
5
5
  attributes:
6
6
  enjoy/goto/transfer:
7
7
  url: URL перехода
8
- received_url: Принятый URL
8
+ recieved_url: Принятый URL
9
9
  host: Хост перехода
10
10
  referer: Страница, с которой перешли
11
11
  source_ip: IP пользователя
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "bundler", "~> 1.10"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
 
33
- spec.add_dependency 'enjoy_cms', "~> 0.3.5"
33
+ spec.add_dependency 'enjoy_cms', "~> 0.3.7"
34
34
  spec.add_dependency 'nokogiri'
35
35
  spec.add_dependency 'addressable'
36
36
  end
@@ -5,6 +5,7 @@ module Enjoy::Goto
5
5
  Proc.new {
6
6
 
7
7
  field :creator do
8
+ filterable true
8
9
  pretty_value do
9
10
  unless bindings[:object].creator.blank?
10
11
  route = (bindings[:view] || bindings[:controller])
@@ -17,6 +18,7 @@ module Enjoy::Goto
17
18
  end
18
19
  field :created_at
19
20
  field :url do
21
+ searchable true
20
22
  pretty_value do
21
23
  unless bindings[:object].url.blank?
22
24
  route = (bindings[:view] || bindings[:controller])
@@ -27,6 +29,7 @@ module Enjoy::Goto
27
29
  end
28
30
  field :recieved_url
29
31
  field :host do
32
+ searchable true
30
33
  pretty_value do
31
34
  unless bindings[:object].host.blank?
32
35
  route = (bindings[:view] || bindings[:controller])
@@ -36,6 +39,7 @@ module Enjoy::Goto
36
39
  end
37
40
  end
38
41
  field :referer do
42
+ searchable true
39
43
  pretty_value do
40
44
  unless bindings[:object].referer.blank?
41
45
  route = (bindings[:view] || bindings[:controller])
@@ -44,7 +48,9 @@ module Enjoy::Goto
44
48
  end
45
49
  end
46
50
  end
47
- field :source_ip
51
+ field :source_ip do
52
+ searchable true
53
+ end
48
54
 
49
55
  if block_given?
50
56
  yield self
@@ -12,6 +12,7 @@ module Enjoy::Goto
12
12
  @transfer.url = url.to_s
13
13
  @transfer.host = url.host.to_s if url
14
14
  @transfer.referer = referer.to_s
15
+ @transfer.source_ip = request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip
15
16
  @transfer.save
16
17
 
17
18
  redirect_to @transfer.url, code: 303
@@ -15,20 +15,24 @@ module Enjoy::Goto
15
15
  status, headers, body = @app.call(env)
16
16
 
17
17
  if headers['Content-Type'].to_s.include?('text/html')
18
- doc = Nokogiri::HTML.parse(body.body)
19
- doc.css("a[href]").each do |a|
20
- _href = a['href']
21
- if _href =~ /^(https?:)?\/\//i
22
- begin
23
- _host = Addressable::URI.parse(_href).host
24
- unless @excluded_hosts.include?(_host)
25
- a['href'] = Rails.application.routes.url_helpers.enjoy_goto_path(url: _href)
18
+ begin
19
+ doc = Nokogiri::HTML.parse(body.body)
20
+ doc.css("a[href]").each do |a|
21
+ _href = a['href']
22
+ if _href =~ /^(https?:)?\/\//i
23
+ begin
24
+ _host = Addressable::URI.parse(_href).host
25
+ unless @excluded_hosts.include?(_host)
26
+ a['href'] = Rails.application.routes.url_helpers.enjoy_goto_path(url: _href)
27
+ a['target'] = '_blank' if a['target'].blank?
28
+ end
29
+ rescue
26
30
  end
27
- rescue
28
31
  end
29
32
  end
33
+ return [status, headers, [doc.to_html]]
34
+ rescue
30
35
  end
31
- return [status, headers, [doc.to_html]]
32
36
  end
33
37
 
34
38
  [status, headers, body]
@@ -1,5 +1,5 @@
1
1
  module Enjoy
2
2
  module Goto
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enjoy_cms_goto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.3.5
47
+ version: 0.3.7
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.3.5
54
+ version: 0.3.7
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,7 +94,6 @@ files:
94
94
  - README.md
95
95
  - Rakefile
96
96
  - app/controllers/concerns/enjoy/goto/decorators/transfers.rb
97
- - app/controllers/enjoy/catalog/transfers_controller.rb
98
97
  - app/controllers/enjoy/goto/transfers_controller.rb
99
98
  - app/models/concerns/enjoy/goto/decorators/transfer.rb
100
99
  - app/models/enjoy/goto/transfer.rb
@@ -1,7 +0,0 @@
1
- module Enjoy::Goto
2
- class TransfersController < ApplicationController
3
- include Enjoy::Goto::Controllers::Transfers
4
-
5
- include Enjoy::Goto::Decorators::Transfers
6
- end
7
- end