Преглед изворни кода

Check for SMTP and XMPP too

master
Aeris пре 4 година
родитељ
комит
11c86006b7
38 измењених фајлова са 352 додато и 116 уклоњено
  1. 0
    2
      Gemfile
  2. 0
    0
      app/assets/javascripts/check.coffee
  3. 0
    0
      app/assets/javascripts/https.coffee
  4. 10
    3
      app/assets/javascripts/site.coffee.erb
  5. 3
    0
      app/assets/javascripts/smtp.coffee
  6. 3
    0
      app/assets/javascripts/xmpp.coffee
  7. 0
    0
      app/assets/stylesheets/check.scss
  8. 0
    0
      app/assets/stylesheets/https.scss
  9. 3
    0
      app/assets/stylesheets/smtp.scss
  10. 3
    0
      app/assets/stylesheets/xmpp.scss
  11. 39
    0
      app/controllers/check_controller.rb
  12. 10
    0
      app/controllers/https_controller.rb
  13. 1
    36
      app/controllers/site_controller.rb
  14. 10
    0
      app/controllers/smtp_controller.rb
  15. 10
    0
      app/controllers/xmpp_controller.rb
  16. 2
    0
      app/helpers/check_helper.rb
  17. 2
    0
      app/helpers/https_helper.rb
  18. 30
    11
      app/helpers/site_helper.rb
  19. 2
    0
      app/helpers/smtp_helper.rb
  20. 2
    0
      app/helpers/xmpp_helper.rb
  21. 3
    0
      app/views/application/_headers.erb
  22. 0
    0
      app/views/check/no_tls.html.erb
  23. 2
    2
      app/views/check/processing.html.erb
  24. 2
    2
      app/views/check/show.html.erb
  25. 35
    0
      app/views/site/ciphers.html.erb
  26. 11
    10
      app/views/site/index.html.erb
  27. 48
    0
      app/workers/check_worker.rb
  28. 10
    35
      app/workers/https_worker.rb
  29. 12
    0
      app/workers/smtp_worker.rb
  30. 12
    0
      app/workers/xmpp_worker.rb
  31. 15
    4
      config/application.rb
  32. 0
    6
      config/environments/development.rb
  33. 0
    3
      config/environments/production.rb
  34. 16
    2
      config/routes.rb
  35. 14
    0
      test/controllers/check_controller_test.rb
  36. 14
    0
      test/controllers/https_controller_test.rb
  37. 14
    0
      test/controllers/smtp_controller_test.rb
  38. 14
    0
      test/controllers/xmpp_controller_test.rb

+ 0
- 2
Gemfile Прегледај датотеку

@@ -2,11 +2,9 @@ source 'https://rubygems.org'
2 2
 
3 3
 gem 'rails', '4.2.1'
4 4
 
5
-gem 'sqlite3'
6 5
 gem 'cryptcheck', '~> 1.0.0', path: File.expand_path(File.join File.dirname(__FILE__), '../cryptcheck')
7 6
 gem 'sidekiq', '~> 3.4.2'
8 7
 gem 'stretcher', '~> 1.21.1'
9
-#gem 'mongo', '~> 2.0.6'
10 8
 gem 'faraday', '~> 0.8.9' # For stretcher compatibility
11 9
 gem 'simpleidn', '~> 0.0.5'
12 10
 

+ 0
- 0
app/assets/javascripts/check.coffee Прегледај датотеку


+ 0
- 0
app/assets/javascripts/https.coffee Прегледај датотеку


+ 10
- 3
app/assets/javascripts/site.coffee.erb Прегледај датотеку

@@ -1,5 +1,12 @@
1 1
 $ ->
2
-	$('#check_form').submit ->
2
+	submit = ->
3 3
 		host = $('#check_host').val()
4
-		window.location.href = "<%= path :result, %i(host) %>"
5
-		false
4
+		type = $('#check_type').val()
5
+		window.location.href = "<%= Rails.configuration.relative_url_root %>/#{type}/#{host}"
6
+
7
+	$('#check_host').keypress (e) ->
8
+		submit() if e.which == 13
9
+		return
10
+	$('#check_submit').click ->
11
+		submit()
12
+		return

+ 3
- 0
app/assets/javascripts/smtp.coffee Прегледај датотеку

@@ -0,0 +1,3 @@
1
+# Place all the behaviors and hooks related to the matching controller here.
2
+# All this logic will automatically be available in application.js.
3
+# You can use CoffeeScript in this file: http://coffeescript.org/

+ 3
- 0
app/assets/javascripts/xmpp.coffee Прегледај датотеку

@@ -0,0 +1,3 @@
1
+# Place all the behaviors and hooks related to the matching controller here.
2
+# All this logic will automatically be available in application.js.
3
+# You can use CoffeeScript in this file: http://coffeescript.org/

+ 0
- 0
app/assets/stylesheets/check.scss Прегледај датотеку


+ 0
- 0
app/assets/stylesheets/https.scss Прегледај датотеку


+ 3
- 0
app/assets/stylesheets/smtp.scss Прегледај датотеку

@@ -0,0 +1,3 @@
1
+// Place all the styles related to the Smtp controller here.
2
+// They will automatically be included in application.css.
3
+// You can use Sass (SCSS) here: http://sass-lang.com/

+ 3
- 0
app/assets/stylesheets/xmpp.scss Прегледај датотеку

@@ -0,0 +1,3 @@
1
+// Place all the styles related to the Xmpp controller here.
2
+// They will automatically be included in application.css.
3
+// You can use Sass (SCSS) here: http://sass-lang.com/

+ 39
- 0
app/controllers/check_controller.rb Прегледај датотеку

@@ -0,0 +1,39 @@
1
+class CheckController < ApplicationController
2
+	before_action :check_host
3
+
4
+	def check_host
5
+		@host = params[:id]
6
+		@idn  = SimpleIDN.to_ascii @host
7
+		if /[^a-zA-Z0-9.-]/.match @idn
8
+			flash[:danger] = "Hôte #{@host} invalide"
9
+			redirect_to :root
10
+			return false
11
+		end
12
+		@result = Datastore.host self.type, @idn
13
+	end
14
+
15
+	def show
16
+		enqueue_host unless @result
17
+		return render :processing if @result.pending
18
+		return render :no_tls if @result.no_tls
19
+	end
20
+
21
+	def refresh
22
+		unless @result.pending
23
+			refresh_allowed = @result.date + Rails.configuration.refresh_delay
24
+			if Time.now < refresh_allowed
25
+				flash[:warning] = "Merci d’attendre au moins #{l refresh_allowed} pour rafraîchir"
26
+				return redirect_to result_path @host
27
+			end
28
+			enqueue_host
29
+		end
30
+		redirect_to action: :show
31
+	end
32
+
33
+	protected
34
+	def enqueue_host
35
+		Datastore.pending self.type, @host
36
+		self.worker.perform_async @idn
37
+		@result = OpenStruct.new pending: true , date: Time.now
38
+	end
39
+end

+ 10
- 0
app/controllers/https_controller.rb Прегледај датотеку

@@ -0,0 +1,10 @@
1
+class HttpsController < CheckController
2
+	protected
3
+	def type
4
+		:https
5
+	end
6
+
7
+	def worker
8
+		HTTPSWorker
9
+	end
10
+end

+ 1
- 36
app/controllers/site_controller.rb Прегледај датотеку

@@ -1,42 +1,7 @@
1 1
 class SiteController < ApplicationController
2
-	before_action :check_host, only: %i(result refresh)
3
-
4
-	def check_host
5
-		@host = params[:id]
6
-		@idn  = SimpleIDN.to_ascii @host
7
-		if /[^a-zA-Z0-9.-]/.match @idn
8
-			flash[:danger] = "Hôte #{@host} invalide"
9
-			redirect_to :root
10
-			return false
11
-		end
12
-		@result = Datastore.host :https, @idn
13
-	end
14
-
15 2
 	def index
16 3
 	end
17 4
 
18
-	def result
19
-		enqueue_host unless @result
20
-		return render :processing if @result.pending
21
-		return render :no_tls if @result.no_tls
22
-	end
23
-
24
-	def refresh
25
-		unless @result.pending
26
-			refresh_allowed = @result.date + Rails.configuration.refresh_delay
27
-			if Time.now < refresh_allowed
28
-				flash[:warning] = "Merci d’attendre au moins #{l refresh_allowed} pour rafraîchir"
29
-				return redirect_to result_path @host
30
-			end
31
-			enqueue_host
32
-		end
33
-		redirect_to :result
34
-	end
35
-
36
-	private
37
-	def enqueue_host
38
-		Datastore.pending :https, @host
39
-		HTTPSWorker.perform_async @idn
40
-		@result = OpenStruct.new pending: true , date: Time.now
5
+	def ciphers
41 6
 	end
42 7
 end

+ 10
- 0
app/controllers/smtp_controller.rb Прегледај датотеку

@@ -0,0 +1,10 @@
1
+class SmtpController < CheckController
2
+	protected
3
+	def type
4
+		:smtp
5
+	end
6
+
7
+	def worker
8
+		SMTPWorker
9
+	end
10
+end

+ 10
- 0
app/controllers/xmpp_controller.rb Прегледај датотеку

@@ -0,0 +1,10 @@
1
+class XmppController < CheckController
2
+	protected
3
+	def type
4
+		:xmpp
5
+	end
6
+
7
+	def worker
8
+		XMPPWorker
9
+	end
10
+end

+ 2
- 0
app/helpers/check_helper.rb Прегледај датотеку

@@ -0,0 +1,2 @@
1
+module CheckHelper
2
+end

+ 2
- 0
app/helpers/https_helper.rb Прегледај датотеку

@@ -0,0 +1,2 @@
1
+module HttpsHelper
2
+end

+ 30
- 11
app/helpers/site_helper.rb Прегледај датотеку

@@ -35,7 +35,7 @@ module SiteHelper
35 35
 	end
36 36
 
37 37
 	def protocol_label(protocol)
38
-		color = case protocol
38
+		color = case protocol.to_s
39 39
 			when 'TLSv1_2' then :success
40 40
 			when 'SSLv3', 'SSLv2' then :danger
41 41
 			else :default
@@ -57,8 +57,9 @@ module SiteHelper
57 57
 		keys.sort { |a, b| -1 * (a.rsa_size <=> b.rsa_size)} .collect { |k| key_label k }.join("\n").html_safe
58 58
 	end
59 59
 
60
-	def cipher_label(cipher)
61
-		"<span class=\"label label-#{cipher_color cipher['size']} %>\">#{cipher['size']} bits</span>".html_safe
60
+	def cipher_size_label(cipher)
61
+		size = cipher.kind_of?(CryptCheck::Tls::Cipher) ? cipher.size : cipher['size']
62
+		"<span class=\"label label-#{cipher_color size} %>\">#{size} bits</span>".html_safe
62 63
 	end
63 64
 
64 65
 	def color_key(key)
@@ -72,20 +73,38 @@ module SiteHelper
72 73
 
73 74
 	def cipher_color(key)
74 75
 		case key
75
-			when 0...112 then :error
76
+			when 0...112 then :danger
76 77
 			when 112...128 then :warning
77 78
 			when 128...256 then :success
78 79
 			else :primary
79 80
 		end
80 81
 	end
81 82
 
83
+	def cipher_name_label(cipher, state)
84
+		color = case
85
+			when !state[:danger].empty? then :danger
86
+			when !state[:warning].empty? then :warning
87
+			when !state[:success].empty? then :success
88
+			else :default
89
+		end
90
+		color = :primary if color == :success and cipher.size >= 256
91
+		"<span class=\"label label-#{color} %>\">#{cipher.name}</span>".html_safe
92
+	end
93
+
82 94
 	def cipher_labels(cipher)
83
-		{ success: %i(pfs),
84
-		  warning: %i(des3 sha1),
85
-		  danger: %i(md5 psk srp anonymous null export des rc2 rc4)
86
-		}.collect do |color, types|
87
-			types.select { |t| CryptCheck::Tls::Cipher.send "#{t}?", cipher.name }
88
-					.collect { |t| "<span class=\"label label-#{color}\">#{t.upcase}</span>" }
89
-		end.flatten(1).join("\n").html_safe
95
+		case cipher
96
+			when Hashie::Mash
97
+				{ success: %i(pfs),
98
+				  warning: %i(des3 sha1),
99
+				  danger: %i(md5 psk srp anonymous null export des rc2 rc4)
100
+				}.collect do |c, ts|
101
+					ts.select { |t| CryptCheck::Tls::Cipher.send "#{t}?", cipher.name }.collect { |t| [c, t] }
102
+				end
103
+			when Hash
104
+				cipher.collect { |c, ts| ts.collect { |t| [c, t] } }
105
+		end
106
+		.flatten(1)
107
+		.collect { |c, t| "<span class=\"label label-#{c}\">#{t.upcase}</span>" }
108
+		.join("\n").html_safe
90 109
 	end
91 110
 end

+ 2
- 0
app/helpers/smtp_helper.rb Прегледај датотеку

@@ -0,0 +1,2 @@
1
+module SmtpHelper
2
+end

+ 2
- 0
app/helpers/xmpp_helper.rb Прегледај датотеку

@@ -0,0 +1,2 @@
1
+module XmppHelper
2
+end

+ 3
- 0
app/views/application/_headers.erb Прегледај датотеку

@@ -4,6 +4,9 @@
4 4
 			<div class="navbar-header">
5 5
 				<%= link_to 'CryptCheck', root_path, class: %i(navbar-brand) %>
6 6
 			</div>
7
+			<ul class="nav navbar-nav">
8
+				<li><%= link_to 'Ciphers', ciphers_path %></li>
9
+			</ul>
7 10
 			<!--
8 11
 			<ul class="nav navbar-nav navbar-right">
9 12
 				<li class="dropdown">

app/views/site/no_tls.html → app/views/check/no_tls.html.erb Прегледај датотеку


app/views/site/processing.html.erb → app/views/check/processing.html.erb Прегледај датотеку

@@ -1,5 +1,5 @@
1 1
 <% content_for :head do %>
2
-	<meta http-equiv="refresh" content="60">
2
+	<meta http-equiv="refresh" content="10">
3 3
 <% end %>
4 4
 <div id="check" class="container">
5 5
 	<div class="row">
@@ -13,7 +13,7 @@
13 13
 			</p>
14 14
 			<p class="pull-right">
15 15
 				Merci de patienter…
16
-				<span class="small">(Cette page se rafraîchit automatiquement toutes les minutes)</span>
16
+				<span class="small">(Cette page se rafraîchit automatiquement toutes les 10 secondes)</span>
17 17
 			</p>
18 18
 		</div>
19 19
 	</div>

app/views/site/result.html.erb → app/views/check/show.html.erb Прегледај датотеку

@@ -8,7 +8,7 @@
8 8
 		</div>
9 9
 		<% if Time.now - @result.date >= Rails.configuration.refresh_delay %>
10 10
 		<div class="col-sm-1">
11
-			<%= link_to 'Rafraîchir', refresh_path, class: %i(btn btn-default) %>
11
+			<%= link_to 'Rafraîchir', {action: :refresh}, class: %i(btn btn-default) %>
12 12
 		</div>
13 13
 		<% end %>
14 14
 	</div>
@@ -92,7 +92,7 @@
92 92
 							<% ciphers.each do |cipher| %>
93 93
 					<tr>
94 94
 						<td><%= cipher.name %></td>
95
-						<td><%= cipher_label cipher %></td>
95
+						<td><%= cipher_size_label cipher %></td>
96 96
 						<td><%= key_label cipher.dh if cipher.dh %></td>
97 97
 						<td><%= cipher_labels cipher %></td>
98 98
 					</tr>

+ 35
- 0
app/views/site/ciphers.html.erb Прегледај датотеку

@@ -0,0 +1,35 @@
1
+<div class="container">
2
+	<div class="row">
3
+		<table class="table-bordered table-condensed table-striped col-sm-12">
4
+			<thead>
5
+				<tr>
6
+					<th class="col-sm-4">Algorithme</th>
7
+					<th class="col-sm-1">Taille</th>
8
+					<td class="col-sm-7"></td>
9
+				</tr>
10
+			</thead>
11
+			<tbody>
12
+			<% %i(TLSv1_2).each do |protocol|
13
+				context = OpenSSL::SSL::SSLContext.new protocol rescue next
14
+			%>
15
+				<!--
16
+				<tr>
17
+					<th colspan="3"><h1><%= protocol %><h1></th>
18
+				</tr>
19
+				-->
20
+				<%
21
+				   context.ciphers = 'ALL:COMPLEMENTOFALL'
22
+				   context.ciphers.collect { |c| CryptCheck::Tls::Cipher.new protocol, c }
23
+						   .sort { |a, b| -1 * (a.size <=> b.size)}.each do |cipher| %>
24
+				<tr>
25
+					<% state = cipher.state %>
26
+					<th><%= cipher_name_label cipher, state %></th>
27
+					<th><%= cipher_size_label cipher %></th>
28
+					<th><%= cipher_labels state %></th>
29
+				</tr>
30
+				   <% end %>
31
+			<% end %>
32
+			</tbody>
33
+		</table>
34
+	</div>
35
+</div>

+ 11
- 10
app/views/site/index.html.erb Прегледај датотеку

@@ -1,17 +1,18 @@
1 1
 <div id="check" class="container">
2 2
 	<div class="row">
3
-		<div class="col-sm-8 col-sm-offset-2">
3
+		<div class="col-sm-12">
4 4
 			<h1>Vérifier votre domaine</h1>
5
-			<form id="check_form" class="form form-horizontal">
6
-				<div class="form-group">
7
-					<div class="col-sm-9">
8
-						<%= text_field_tag :check_host, nil, class: %i(form-control input-lg), placeholder: 'your-site.com' %>
9
-					</div>
10
-					<div class="col-sm-3">
11
-						<%= submit_tag 'Test-moi !', class: %i(form-control btn btn-primary input-lg pull-right) %>
12
-					</div>
5
+			<div class="form-group">
6
+				<div class="col-sm-8">
7
+					<%= text_field_tag :check_host, nil, class: %i(form-control input-lg), placeholder: 'your-site.com' %>
13 8
 				</div>
14
-			</form>
9
+				<div class="col-sm-2">
10
+					<%= select_tag :check_type, options_for_select({'HTTPS' => :https, 'SMTP' => :smtp, 'XMPP' => :xmpp}), class: %i(form-control input-lg) %>
11
+				</div>
12
+				<div class="col-sm-2">
13
+					<%= submit_tag 'Test-moi !', id: 'check_submit', class: %i(form-control btn btn-primary input-lg pull-right) %>
14
+				</div>
15
+			</div>
15 16
 		</div>
16 17
 	</div>
17 18
 </div>

+ 48
- 0
app/workers/check_worker.rb Прегледај датотеку

@@ -0,0 +1,48 @@
1
+require 'simpleidn'
2
+require 'cryptcheck'
3
+
4
+class CheckWorker
5
+	include Sidekiq::Worker
6
+	sidekiq_options retry: false
7
+
8
+	def key_to_json(key)
9
+		key.nil? ? nil : { type: key.type, size: key.size, rsa_size: key.rsa_equivalent_size }
10
+	end
11
+
12
+	def perform(host)
13
+		idn    = SimpleIDN.to_ascii host
14
+		result = begin
15
+			server = self.module::Server.new idn
16
+			grade  = self.module::Grade.new server
17
+			result = {
18
+					key:       key_to_json(server.key),
19
+					dh:        server.dh.collect { |k| key_to_json k },
20
+					protocols: server.supported_protocols,
21
+					ciphers:   server.supported_ciphers.collect { |c| { protocol: c.protocol, name: c.name, size: c.size, dh: key_to_json(c.dh) } },
22
+					score:     {
23
+							rank:    grade.grade,
24
+							details: {
25
+									score:            grade.score,
26
+									protocol:         grade.protocol_score,
27
+									key_exchange:     grade.key_exchange_score,
28
+									cipher_strengths: grade.cipher_strengths_score
29
+							},
30
+							error:   grade.error,
31
+							warning: grade.warning,
32
+							success: grade.success
33
+					}
34
+			}
35
+
36
+
37
+			self.result server, grade, result
38
+		rescue CryptCheck::Tls::Server::TLSNotAvailableException
39
+			{ no_tls: true }
40
+		end
41
+		Datastore.post self.type, host, result
42
+	end
43
+
44
+	protected
45
+	def result(_, _, result)
46
+		result
47
+	end
48
+end

+ 10
- 35
app/workers/https_worker.rb Прегледај датотеку

@@ -1,42 +1,17 @@
1
-require 'simpleidn'
2
-require 'cryptcheck'
3
-
4
-class HTTPSWorker
5
-	include Sidekiq::Worker
1
+class HTTPSWorker < CheckWorker
6 2
 	sidekiq_options retry: false
7 3
 
8
-	def key_to_json(key)
9
-		key.nil? ? nil : { type: key.type, size: key.size, rsa_size: key.rsa_equivalent_size }
4
+	protected
5
+	def module
6
+		CryptCheck::Tls::Https
10 7
 	end
11 8
 
12
-	def perform(host)
13
-		idn    = SimpleIDN.to_ascii host
14
-		result = begin
15
-			server = CryptCheck::Tls::Https::Server.new idn
16
-			grade  = CryptCheck::Tls::Https::Grade.new server
9
+	def type
10
+		:https
11
+	end
17 12
 
18
-			{
19
-					key:       key_to_json(server.key),
20
-					dh:        server.dh.collect { |k| key_to_json k },
21
-					protocols: server.supported_protocols,
22
-					ciphers:   server.supported_ciphers.collect { |c| { protocol: c.protocol, name: c.name, size: c.size, dh: key_to_json(c.dh) } },
23
-					hsts:      server.hsts,
24
-					score:     {
25
-							rank:    grade.grade,
26
-							details: {
27
-									score:            grade.score,
28
-									protocol:         grade.protocol_score,
29
-									key_exchange:     grade.key_exchange_score,
30
-									cipher_strengths: grade.cipher_strengths_score
31
-							},
32
-							error:   grade.error,
33
-							warning: grade.warning,
34
-							success: grade.success
35
-					}
36
-			}
37
-		rescue CryptCheck::Tls::Server::TLSNotAvailableException
38
-			{ no_tls: true }
39
-		end
40
-		Datastore.post :https, host, result
13
+	def result(server, _, hash)
14
+		hash[:hsts] = server.hsts
15
+		hash
41 16
 	end
42 17
 end

+ 12
- 0
app/workers/smtp_worker.rb Прегледај датотеку

@@ -0,0 +1,12 @@
1
+class SMTPWorker < CheckWorker
2
+	sidekiq_options retry: false
3
+
4
+	protected
5
+	def module
6
+		CryptCheck::Tls::Smtp
7
+	end
8
+
9
+	def type
10
+		:smtp
11
+	end
12
+end

+ 12
- 0
app/workers/xmpp_worker.rb Прегледај датотеку

@@ -0,0 +1,12 @@
1
+class XMPPWorker < CheckWorker
2
+	sidekiq_options retry: false
3
+
4
+	protected
5
+	def module
6
+		CryptCheck::Tls::Xmpp
7
+	end
8
+
9
+	def type
10
+		:xmpp
11
+	end
12
+end

+ 15
- 4
config/application.rb Прегледај датотеку

@@ -1,6 +1,20 @@
1 1
 require File.expand_path('../boot', __FILE__)
2 2
 
3
-require 'rails/all'
3
+%w(
4
+  action_controller
5
+  action_view
6
+  active_job
7
+  rails/test_unit
8
+  sprockets
9
+).each do |framework|
10
+	begin
11
+		require "#{framework}/railtie"
12
+	rescue LoadError
13
+	end
14
+end
15
+
16
+
17
+
4 18
 
5 19
 # Require the gems listed in Gemfile, including any gems
6 20
 # you've limited to :test, :development, or :production.
@@ -26,9 +40,6 @@ module CryptcheckRails
26 40
 		# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
27 41
 		config.i18n.default_locale = :fr
28 42
 
29
-		# Do not swallow errors in after_commit/after_rollback callbacks.
30
-		config.active_record.raise_in_transactional_callbacks = true
31
-
32 43
 		config.refresh_delay = 1.hour
33 44
 	end
34 45
 end

+ 0
- 6
config/environments/development.rb Прегледај датотеку

@@ -13,15 +13,9 @@ Rails.application.configure do
13 13
 	config.consider_all_requests_local         = true
14 14
 	config.action_controller.perform_caching   = false
15 15
 
16
-	# Don't care if the mailer can't send.
17
-	config.action_mailer.raise_delivery_errors = false
18
-
19 16
 	# Print deprecation notices to the Rails logger.
20 17
 	config.active_support.deprecation          = :log
21 18
 
22
-	# Raise an error on page load if there are pending migrations.
23
-	config.active_record.migration_error       = :page_load
24
-
25 19
 	# Debug mode disables concatenation and preprocessing of assets.
26 20
 	# This option may cause significant delays in view rendering with a large
27 21
 	# number of complex assets.

+ 0
- 3
config/environments/production.rb Прегледај датотеку

@@ -73,7 +73,4 @@ Rails.application.configure do
73 73
 
74 74
   # Use default logging formatter so that PID and timestamp are not suppressed.
75 75
   config.log_formatter = ::Logger::Formatter.new
76
-
77
-  # Do not dump schema after migrations.
78
-  config.active_record.dump_schema_after_migration = false
79 76
 end

+ 16
- 2
config/routes.rb Прегледај датотеку

@@ -1,5 +1,19 @@
1 1
 Rails.application.routes.draw do
2
+	namespace :https, id: /[^\/]*/ do
3
+		get ':id/', action: :show
4
+		get ':id/refresh', action: :refresh, as: :refresh
5
+	end
6
+
7
+	namespace :smtp, id: /[^\/]*/ do
8
+		get ':id/', action: :show
9
+		get ':id/refresh', action: :refresh, as: :refresh
10
+	end
11
+
12
+	namespace :xmpp, id: /[^\/]*/ do
13
+		get ':id/', action: :show
14
+		get ':id/refresh', action: :refresh, as: :refresh
15
+	end
16
+
2 17
 	root 'site#index'
3
-	get '/:id/refresh' => 'site#refresh', as: :refresh, id: /.*/
4
-	get '/:id' => 'site#result', as: :result, id: /.*/
18
+	get '/ciphers' => 'site#ciphers'
5 19
 end

+ 14
- 0
test/controllers/check_controller_test.rb Прегледај датотеку

@@ -0,0 +1,14 @@
1
+require 'test_helper'
2
+
3
+class CheckControllerTest < ActionController::TestCase
4
+  test "should get result" do
5
+    get :show
6
+    assert_response :success
7
+  end
8
+
9
+  test "should get refresh" do
10
+    get :refresh
11
+    assert_response :success
12
+  end
13
+
14
+end

+ 14
- 0
test/controllers/https_controller_test.rb Прегледај датотеку

@@ -0,0 +1,14 @@
1
+require 'test_helper'
2
+
3
+class HttpsControllerTest < ActionController::TestCase
4
+  test "should get result" do
5
+    get :show
6
+    assert_response :success
7
+  end
8
+
9
+  test "should get refresh" do
10
+    get :refresh
11
+    assert_response :success
12
+  end
13
+
14
+end

+ 14
- 0
test/controllers/smtp_controller_test.rb Прегледај датотеку

@@ -0,0 +1,14 @@
1
+require 'test_helper'
2
+
3
+class SmtpControllerTest < ActionController::TestCase
4
+  test "should get show" do
5
+    get :show
6
+    assert_response :success
7
+  end
8
+
9
+  test "should get refresh" do
10
+    get :refresh
11
+    assert_response :success
12
+  end
13
+
14
+end

+ 14
- 0
test/controllers/xmpp_controller_test.rb Прегледај датотеку

@@ -0,0 +1,14 @@
1
+require 'test_helper'
2
+
3
+class XmppControllerTest < ActionController::TestCase
4
+  test "should get show" do
5
+    get :show
6
+    assert_response :success
7
+  end
8
+
9
+  test "should get refresh" do
10
+    get :refresh
11
+    assert_response :success
12
+  end
13
+
14
+end

Loading…
Откажи
Сачувај