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 +4 -4
- data/config/locales/enjoy.goto.ru.yml +1 -1
- data/enjoy_cms_goto.gemspec +1 -1
- data/lib/enjoy/goto/admin/transfer.rb +7 -1
- data/lib/enjoy/goto/controllers/transfers.rb +1 -0
- data/lib/enjoy/goto/middleware.rb +14 -10
- data/lib/enjoy/goto/version.rb +1 -1
- metadata +4 -5
- data/app/controllers/enjoy/catalog/transfers_controller.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac37e01d38bd2f30b7a1386733bac3989a21ad05
|
4
|
+
data.tar.gz: 960fd4f624f441a30aec6a2c8a3b60579c4aa6a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f718d039cdd527dcc7f1844182720aae509313c640f37ef33254bea3aa254b4ef21c2df3a5b21b7eb7e73ad5e48a7700e828c93b0012e001f670a54ded14c09
|
7
|
+
data.tar.gz: 3582d133bdb0f82f9f5ae338881338e51cd8b6a34fdb49592aff673dc402347553ad52d7d725f6b2b7215deb3afb43be9138b4d807e500491dbb59191e710c4a
|
data/enjoy_cms_goto.gemspec
CHANGED
@@ -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.
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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]
|
data/lib/enjoy/goto/version.rb
CHANGED
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.
|
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-
|
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.
|
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.
|
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
|