rucaptcha 3.0.0.beta1 → 3.0.0

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: f5b2533811c90fe898f944c4e680171223eae24d6a064325e7675874df062f38
4
- data.tar.gz: a5580a8d7b93d5aa340fb7c3f34897a71ad253551edc5488a280f8d29810a5ad
3
+ metadata.gz: 454e9b29c2267b83abb3f31091563ee3499b33ce9ff37596135719c4ff6d14e0
4
+ data.tar.gz: e61ce51fe008accceffd467c275f0f2651ff5d844d07e055559701a4d9862a47
5
5
  SHA512:
6
- metadata.gz: 19c9b89dd9752ec30778f3c8b5ebcd959df61b04df1ddb26dc8496c7b1383c935cd9cfcf7cfb2e80358a2aa732be2dc797b266f1d6a46ece618f162faa0474c8
7
- data.tar.gz: 4fd7d61c12480361c640e0974908a9ae91f1b5a0a063da632b19b1627803ce047ea035a3816459615926408c927aa793de8e5571c9e4dc419013b3ba72c8d2e6
6
+ metadata.gz: f78c94ef9d64322a61ad98d09b1349389ee6368b40b6a987f2e967ae224f9ead906dd954e35c406d75f4fd5137f939d985e99fdbb715acac9b8c5e41fceecb52
7
+ data.tar.gz: 630e24d98c3f9508ce5095a3754bbd3eeff81dc14fe3c41183036e8b29392f2e76f0d462fa3fad52917f65e7bb4da306bcab11cca07682501d186e859d98888f
@@ -0,0 +1,14 @@
1
+ module RuCaptcha
2
+ class CaptchaController < ActionController::Base
3
+ def index
4
+ return head :ok if request.head?
5
+
6
+ headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
7
+ headers["Pragma"] = "no-cache"
8
+ data = generate_rucaptcha
9
+
10
+ opts = { disposition: "inline", type: "image/png" }
11
+ send_data data, opts
12
+ end
13
+ end
14
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ RuCaptcha::Engine.routes.draw do
2
+ root to: "captcha#index"
3
+ end
@@ -105,8 +105,8 @@ fn cyclic_write_character(res: &[String], image: &mut ImageBuffer<Rgb<u8>, Vec<u
105
105
  let font = get_font();
106
106
  let line_color = colors[rand_num(colors.len() - 1)];
107
107
 
108
- for j in 0..(rand_num(2) + 1) as i32 {
109
- let offset = j * (rand_num(3) as i32 + 1);
108
+ for j in 0..(rand_num(3) + 1) as i32 {
109
+ let offset = j * (rand_num(2) as i32 + 1);
110
110
  draw_text_mut(
111
111
  image,
112
112
  color,
@@ -182,8 +182,8 @@ impl CaptchaBuilder {
182
182
  pub fn new() -> Self {
183
183
  CaptchaBuilder {
184
184
  length: 4,
185
- width: 240,
186
- height: 64,
185
+ width: 300,
186
+ height: 100,
187
187
  complexity: 5,
188
188
  }
189
189
  }
@@ -1,3 +1,3 @@
1
1
  module RuCaptcha
2
- VERSION = "3.0.0.beta1"
2
+ VERSION = "3.0.0"
3
3
  end
data/lib/rucaptcha.rb CHANGED
@@ -48,7 +48,7 @@ module RuCaptcha
48
48
  raise RuCaptcha::Errors::Configuration, "length config error, value must in 3..7" unless length.in?(3..7)
49
49
 
50
50
  result = RuCaptchaCore.create(length, config.difficulty || 5)
51
- [result[0], result[1].pack("c*")]
51
+ [result[0].downcase, result[1].pack("c*")]
52
52
  end
53
53
 
54
54
  def check_cache_store!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rucaptcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
@@ -47,6 +47,8 @@ extra_rdoc_files: []
47
47
  files:
48
48
  - README.md
49
49
  - Rakefile
50
+ - app/controllers/ru_captcha/captcha_controller.rb
51
+ - config/routes.rb
50
52
  - ext/rucaptcha/Cargo.lock
51
53
  - ext/rucaptcha/Cargo.toml
52
54
  - ext/rucaptcha/extconf.rb
@@ -75,9 +77,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
77
  version: 2.7.0
76
78
  required_rubygems_version: !ruby/object:Gem::Requirement
77
79
  requirements:
78
- - - ">"
80
+ - - ">="
79
81
  - !ruby/object:Gem::Version
80
- version: 1.3.1
82
+ version: '0'
81
83
  requirements: []
82
84
  rubygems_version: 3.4.0.dev
83
85
  signing_key: