bizside 2.3.6 → 2.3.8

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
  SHA256:
3
- metadata.gz: 39b9880ea371f55ab17b2c82c67394a2f740bc612c4c9b69594db539d2e9b16f
4
- data.tar.gz: b32b29653cc05e0332ff1bd51636ef2a750c8ccfbd6db608d7bc8ee6390df424
3
+ metadata.gz: 31a2944a9db2b20cadfe18a6367f9cbcd5c04f5dcf6259e1fd6f5639ac056915
4
+ data.tar.gz: 70dcd0e7746a040d1a60494406b4bedbdfb1b51bccbdcd86d3d54f0bee4844e2
5
5
  SHA512:
6
- metadata.gz: 64f122cfd9ad9ff1571b961e92733ff850015f1e2211c47e503705e1823bdce4334eab643fc10205369fa6ac345ee72491a6377d143a2f3092ade1394aa4e270
7
- data.tar.gz: 6940e79997639635c66738ee8d19c6015447f3e187daa5d5e059009ccc5c784634a768f619a2cb0dc18c368cd1caf1486dc7ba79734ab94ca8456170f3ad70e1
6
+ metadata.gz: a06ec66efb74b3c4ed9d34293e4db7b019df45737314135eea676da367f9a7d264bed92bcacd3be13f7835549303fac04b63ab0bdc37ef7a21daf9987ac392f7
7
+ data.tar.gz: cafbf3686937f4b507d57699783d66afe98cd2ad28d9e93711f7ee2009cb3cda2a9a8cd2f1a7ba94892ef870d4343ca56572553c59d5694f89d5e557d45b005a
@@ -82,7 +82,7 @@ module Bizside
82
82
  referrer: env['HTTP_REFERER'],
83
83
  request_method: env['REQUEST_METHOD'],
84
84
  request_uri: env['BIZSIDE_REQUEST_URI'].presence || env['REQUEST_URI'],
85
- remote_address: env['REMOTE_ADDR'],
85
+ remote_address: to_client_ip(env['HTTP_X_FORWARDED_FOR']) || to_client_ip(env['HTTP_CLIENT_IP']) || env['REMOTE_ADDR'],
86
86
  status: status,
87
87
  started_at: start,
88
88
  finished_at: stop,
@@ -180,5 +180,11 @@ module Bizside
180
180
  exception.backtrace.join("\n")[0...truncate_length]
181
181
  end
182
182
 
183
+ # 信頼のおけるロードバランサーがプロキシーになっている前提で、各HTTPヘッダの先頭のIPをクライアントIPとして取得する
184
+ def to_client_ip(header_value)
185
+ ips = header_value ? header_value.strip.split(/[,\s]+/) : []
186
+ ips.first
187
+ end
188
+
183
189
  end
184
190
  end
@@ -30,7 +30,7 @@ module Bizside
30
30
 
31
31
  def valid_#{attr}?
32
32
  valid_format?(@#{attr}) &&
33
- valid_range?(MIN_#{attr.upcase}, MAX_#{attr.upcase}, @#{attr})
33
+ valid_range_and_step?(MIN_#{attr.upcase}, MAX_#{attr.upcase}, @#{attr})
34
34
  end
35
35
  EOS
36
36
  end
@@ -41,22 +41,40 @@ module Bizside
41
41
  value =~ /\A(\*(\/\d+)?|\d+(,\d+)*(-\d+)*(\/\d+)*)\Z/
42
42
  end
43
43
 
44
+ def valid_range_and_step?(min, max, value)
45
+ valid_range?(min, max, value) && valid_step?(min, max, value)
46
+ end
47
+
44
48
  def valid_range?(min, max, value)
45
- validate_values = remove_to_ignore_value(value).split(",")
46
- validate_values.reject do |v|
49
+ range_values = get_range_value(value).split(",")
50
+ range_values.reject do |v|
47
51
  if v.include?("-")
48
52
  range_v = v.split("-")
49
53
  (min..max).include?(range_v[0].to_i) &&
50
54
  (min..max).include?(range_v[1].to_i) &&
51
55
  range_v[0].to_i < range_v[1].to_i
52
56
  else
53
- (min..max).include? v.to_i
57
+ (min..max).include?(v.to_i)
54
58
  end
55
59
  end.empty?
56
60
  end
57
61
 
58
- def remove_to_ignore_value(value)
62
+ def valid_step?(min, max, value)
63
+ v = get_step_value(value)
64
+ return true if v.empty?
65
+
66
+ v != '*' &&
67
+ v.to_i != 0 &&
68
+ (min..max).include?(v.to_i)
69
+ end
70
+
71
+ def get_range_value(value)
59
72
  value.gsub(/(\/\d*|\*)/, "")
60
73
  end
74
+
75
+ def get_step_value(value)
76
+ return "" unless value.include?('/')
77
+ value.gsub(/.*\/(.*)/) { $1 }
78
+ end
61
79
  end
62
80
  end
@@ -173,9 +173,11 @@ module Bizside
173
173
  if cronline.to_s.strip.empty?
174
174
  return
175
175
  elsif CronValidator.new(cronline).valid?
176
+ new_cron = set_cron_options(cron)
177
+
176
178
  config = {
177
179
  :class => job_type,
178
- :cron => cron,
180
+ :cron => new_cron,
179
181
  :args => args,
180
182
  :persist => true
181
183
  }
@@ -404,5 +406,19 @@ module Bizside
404
406
  end
405
407
  private_class_method :do_perform_and_hooks_instantly
406
408
 
409
+ def self.set_cron_options(cron)
410
+ ret = Array(cron)
411
+ if ret.size > 1
412
+ opts = ret.second
413
+ opts ||= {}
414
+ opts = opts.with_indifferent_access
415
+ opts = opts.merge(blocking: true)
416
+ else
417
+ opts = { blocking: true }.with_indifferent_access
418
+ end
419
+ ret[1] = opts
420
+ ret
421
+ end
422
+
407
423
  end
408
424
  end
@@ -1,3 +1,3 @@
1
1
  module Bizside
2
- VERSION = '2.3.6'
2
+ VERSION = '2.3.8'
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.3.6
4
+ version: 2.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - bizside-developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-14 00:00:00.000000000 Z
11
+ date: 2024-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -475,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
475
475
  - !ruby/object:Gem::Version
476
476
  version: '0'
477
477
  requirements: []
478
- rubygems_version: 3.3.26
478
+ rubygems_version: 3.4.22
479
479
  signing_key:
480
480
  specification_version: 4
481
481
  summary: Bizside is an utilities for web application.