bizside 2.2.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49502df4872c3de14b3ad2024d7371dbeec9c4762b2b9e63b36d8ee7892fbdd0
4
- data.tar.gz: 1389bdd6a7bffe5f46ead6fec1a6bfe3c9d750450c1f9b2d3108e09db8420597
3
+ metadata.gz: d4c22002eada30e8bb21db240f3c28c346c7049ccc375ff6f7afd3cfb8fb713e
4
+ data.tar.gz: 6357dee7fe2d59e8619cc0937d6fd0ccc204dcf7387cbc0cf4871681e0cf22bd
5
5
  SHA512:
6
- metadata.gz: ebabb7d63d49861032dfb0f714775fe408d6b0eae43509255f67ad4778b7011ef59b6428bd25e82534f59de651c0322c7474c79b4530c218a20ff74c28a05468
7
- data.tar.gz: 42b12132c4a9afdcc748e1276fe9409f23fb4dd287987d135155375542b2092b7022fd1b8c9261e1f32870fcfffd2586effc7a88d43b46d5e25a39917b87097e
6
+ metadata.gz: bd28798fd692aef8e7fe202a5de9375362d29a226b19517f1ada70f39f69d94110a260b4cb4c14c3b7c5b6f0d5f92f223f33cd01aff19176b310e491b2de2040
7
+ data.tar.gz: b32b86fa1b621e70b37cf237dfcf7c09dc4fb868fde37727f5f19214f12e207ffc5d9db697ab3210083fd2c1c7dc3c67470e99dac7167460475d9a7d5c8fa4d4
@@ -24,12 +24,12 @@ module Bizside
24
24
 
25
25
  def call(env)
26
26
  start = Time.now.strftime('%Y-%m-%dT%H:%M:%S.%3N%z')
27
- @status, @headers, @response = @app.call(env)
27
+ status, headers, response = @app.call(env)
28
28
  stop = Time.now.strftime('%Y-%m-%dT%H:%M:%S.%3N%z')
29
29
  exception = env[Bizside::ShowExceptions::BIZSIDE_EXCEPTION_ENV_KEY]
30
30
 
31
31
  if env['BIZSIDE_SUPPRESS_AUDIT']
32
- return @status, @headers, @response
32
+ return status, headers, response
33
33
  end
34
34
 
35
35
  if @@ignore_paths.any? do |path|
@@ -40,25 +40,25 @@ module Bizside
40
40
  env['REQUEST_URI'] == path
41
41
  end
42
42
  end
43
- return @status, @headers, @response
43
+ return status, headers, response
44
44
  end
45
45
 
46
46
  if Bizside.rails_env&.development?
47
- return @status, @headers, @response if env['REQUEST_URI'] =~ /\/[^\/]+\/assets\/.*/
47
+ return status, headers, response if env['REQUEST_URI'] =~ /\/[^\/]+\/assets\/.*/
48
48
  elsif Bizside.rails_env&.test?
49
- return @status, @headers, @response
49
+ return status, headers, response
50
50
  end
51
51
 
52
- info = build_loginfo(env, start, stop, @status, exception)
52
+ info = build_loginfo(env, start, stop, status, exception)
53
53
  logger.record(info)
54
54
 
55
- return @status, @headers, @response
55
+ return status, headers, response
56
56
  end
57
57
 
58
58
  private
59
59
 
60
60
  def logger
61
- @logger ||= Bizside::Audit::Logger.logger
61
+ Bizside::Audit::Logger.logger
62
62
  end
63
63
 
64
64
  def build_loginfo(env, start, stop, status, exception)
@@ -33,11 +33,13 @@ module Bizside
33
33
  end
34
34
 
35
35
  if Bizside.config.user_agent.enabled?
36
+ if Bizside.config.user_agent.to_h.has_key?('use_variant')
37
+ raise "ERROR: 'use_variant' is obsolete. Delete it from config/bizside.yml"
38
+ end
39
+
36
40
  require_relative 'user_agent'
37
41
 
38
42
  initializer 'user_agent' do
39
- require_relative 'user_agent/action_view'
40
-
41
43
  ActiveSupport.on_load(:action_controller) do
42
44
  include Bizside::UserAgent::ControllerHelper
43
45
  end
@@ -23,7 +23,7 @@ module Bizside
23
23
  self.user_agent = ::Bizside::UserAgent.parse(request.env['HTTP_USER_AGENT'])
24
24
  end
25
25
 
26
- set_request_variant if Bizside.config.user_agent.use_variant?
26
+ set_request_variant
27
27
 
28
28
  request.env['BIZSIDE_DEVICE'] = self.user_agent.name
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Bizside
2
- VERSION = '2.2.2'
2
+ VERSION = '2.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bizside
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bizside-developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2022-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -442,10 +442,6 @@ files:
442
442
  - lib/bizside/uploader/extension_whitelist.rb
443
443
  - lib/bizside/uploader/filename_validator.rb
444
444
  - lib/bizside/user_agent.rb
445
- - lib/bizside/user_agent/action_view.rb
446
- - lib/bizside/user_agent/action_view/action_view_4.rb
447
- - lib/bizside/user_agent/action_view/action_view_6.rb
448
- - lib/bizside/user_agent/action_view/use_variant.rb
449
445
  - lib/bizside/user_agent/controller_helper.rb
450
446
  - lib/bizside/validations.rb
451
447
  - lib/bizside/version.rb
@@ -1,56 +0,0 @@
1
- require 'action_view'
2
-
3
- class ActionView::TemplateRenderer
4
-
5
- def render(context, options)
6
- @view = context
7
- @details = extract_details(options)
8
- template = get_template_by_user_agent(context, options)
9
- context = @lookup_context
10
-
11
- prepend_formats(template.formats)
12
-
13
- unless context.rendered_format
14
- context.rendered_format = template.formats.first || formats.first
15
- end
16
-
17
- render_template(template, options[:layout], options[:locals])
18
- end
19
-
20
- private
21
-
22
- def get_user_agent(context)
23
- if context.respond_to?(:user_agent)
24
- if context.respond_to?(:controller)
25
- if context.controller.respond_to?(:session)
26
- context.user_agent
27
- end
28
- end
29
- end
30
- end
31
-
32
- def get_template_by_user_agent(context, options)
33
- ret = nil
34
- option_for_template = options[:template]
35
-
36
- ua = get_user_agent(context)
37
- if ua
38
- ua.priorities.each do |priority|
39
- begin
40
- options[:template] = option_for_template + '.' + priority
41
- ret = determine_template(options)
42
- break
43
- rescue ActionView::MissingTemplate
44
- end
45
- end
46
- end
47
-
48
- unless ret
49
- options[:template] = option_for_template
50
- ret = determine_template(options)
51
- end
52
-
53
- Rails.logger.debug "UserAgent: #{ua ? ua.name : 'unknown'} => #{ret.identifier}"
54
- ret
55
- end
56
- end
@@ -1,50 +0,0 @@
1
- require 'action_view'
2
-
3
- class ActionView::TemplateRenderer
4
-
5
- def render(context, options)
6
- @details = extract_details(options)
7
- template = get_template_by_user_agent(context, options)
8
-
9
- prepend_formats(template.format)
10
-
11
- render_template(context, template, options[:layout], options[:locals] || {})
12
- end
13
-
14
- private
15
-
16
- def get_user_agent(context)
17
- if context.respond_to?(:user_agent)
18
- if context.respond_to?(:controller)
19
- if context.controller.respond_to?(:session)
20
- context.user_agent
21
- end
22
- end
23
- end
24
- end
25
-
26
- def get_template_by_user_agent(context, options)
27
- ret = nil
28
- option_for_template = options[:template]
29
-
30
- ua = get_user_agent(context)
31
- if ua
32
- ua.priorities.each do |priority|
33
- begin
34
- options[:template] = option_for_template + '.' + priority
35
- ret = determine_template(options)
36
- break
37
- rescue ActionView::MissingTemplate
38
- end
39
- end
40
- end
41
-
42
- unless ret
43
- options[:template] = option_for_template
44
- ret = determine_template(options)
45
- end
46
-
47
- Rails.logger.debug "UserAgent: #{ua ? ua.name : 'unknown'} => #{ret.identifier}"
48
- ret
49
- end
50
- end
@@ -1,4 +0,0 @@
1
- require 'action_view/template/resolver'
2
-
3
- ActionView::PathResolver::EXTENSIONS = { locale: ".", variants: ".", formats: ".", handlers: "." }
4
- ActionView::PathResolver::DEFAULT_PATTERN = ":prefix/:action{.:locale,}{.:variants,}{.:formats,}{.:handlers,}"
@@ -1,16 +0,0 @@
1
- case Rails::VERSION::MAJOR
2
- when 5
3
- if Bizside.config.user_agent.use_variant?
4
- load File.expand_path(File.join('action_view', 'use_variant.rb'), __dir__)
5
- else
6
- load File.expand_path(File.join('action_view', 'action_view_4.rb'), __dir__)
7
- end
8
- when 6
9
- if Bizside.config.user_agent.use_variant?
10
- load File.expand_path(File.join('action_view', 'use_variant.rb'), __dir__)
11
- else
12
- load File.expand_path(File.join('action_view', 'action_view_6.rb'), __dir__)
13
- end
14
- else
15
- raise "Rails#{Rails::VERSION::MAJOR} はサポートしていません。"
16
- end