rucaptcha 2.6.1 → 3.0.0.beta2

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: 43b066933f98fbca0c17c9399112a974f4d012bebeaa12975eef9a9e8cd03c74
4
- data.tar.gz: 106d354acfaa8850da0f11ae92d2e3268603e3582951aefec484d03d4f2e8635
3
+ metadata.gz: 9bbd4b8b851e790f62f2f6db911ae64b9498a0928036e8b7ea67856a4da547ee
4
+ data.tar.gz: 3eefb7d5585af340e86f704862bfcc98500bc2e3d3be0cf6b29e52617d3bd634
5
5
  SHA512:
6
- metadata.gz: f0e0389c00e0a44deae317c609eae2a3ff716e125f0c485b37cd32a659ff60b152e945f6c8cf2691f815ee4da5531663d35ec15e8df0b1820d161f0ec7ec7dad
7
- data.tar.gz: af4b7c997648efa973e81f19c187ecd8710c5c0e5884b6c9c42ae8d6ac98f48bf49b1ebf867a707c73fbd9ce8629c9d0d9835182463e8effa91bdd8be2e62c83
6
+ metadata.gz: a64af8e3bc25b2b1dc97ee8bc2eb64c1f27e548f604cbcea82991b1234f745c478796339ffedbb4c7374c7639389f2be385343f5aee2b2c8f7f3fab911ab986d
7
+ data.tar.gz: fac3e233072a46d5c8c9b1ad24a518cf30fbc53ca0e675d3f6ee8a17f1971db7e109077e05b5dc212b833b40b582ac0226ab7cbbc6c299bd4f8bbe8ad11033e9
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/rucaptcha.svg)](https://badge.fury.io/rb/rucaptcha)
4
4
  [![build](https://github.com/huacnlee/rucaptcha/workflows/build/badge.svg)](https://github.com/huacnlee/rucaptcha/actions?query=workflow%3Abuild)
5
5
 
6
- This is a Captcha gem for Rails Applications which generates captcha image by C code.
6
+ Captcha Gem for Rails, which generates captcha image by Rust.
7
7
 
8
8
  > NOTE: According to the use of Ruby China, the verification code looks like has a lower than 5% probability of being parsed by OCR and the verification code is cracked (All Image Captcha libs are has same problem). It is recommended that you use the IP rate limit to enhance the protection.
9
9
  > NOTE: 以 Ruby China 的使用来看,验证码似乎有低于 5% 的概率被 OCR 读取解析 (图片验证码都有这个问题) 导致验证码被破解(我们从日志分析绝大多数是成功的,但偶尔一个成功,配合大量机器攻击,导致注册了很多的垃圾账号),建议你额外配合 IP 频率限制的功能来加强保护。
@@ -14,11 +14,11 @@ This is a Captcha gem for Rails Applications which generates captcha image by C
14
14
 
15
15
  ## Example
16
16
 
17
- <img src="https://user-images.githubusercontent.com/5518/49985459-f8492f80-ffa6-11e8-9ef5-8f8f522e4707.png" width="579px" />
17
+ ![1](https://user-images.githubusercontent.com/5518/195587367-6b579046-1d75-4a64-8e8f-4475da8932fa.png) ![2](https://user-images.githubusercontent.com/5518/195587377-08065df4-80ad-4c3f-baf4-2da7f9919b19.png) ![3](https://user-images.githubusercontent.com/5518/195587383-de8f73ea-e934-4c9d-b278-c78fb69cad58.png) ![4](https://user-images.githubusercontent.com/5518/195587381-a67e586d-0b54-4d6f-89c8-a431b085e16c.png)
18
18
 
19
19
  ## Feature
20
20
 
21
- - No dependencies. No ImageMagick. No RMagick;
21
+ - Native Gem base on Rust.
22
22
  - For Rails Application;
23
23
  - Simple, Easy to use;
24
24
  - High performance.
@@ -35,8 +35,6 @@ Create `config/initializers/rucaptcha.rb`
35
35
 
36
36
  ```rb
37
37
  RuCaptcha.configure do
38
- # Color style, default: :colorful, allows: [:colorful, :black_white]
39
-  # self.style = :colorful
40
38
  # Custom captcha code expire time if you need, default: 2 minutes
41
39
  # self.expires_in = 120
42
40
   # [Requirement / 重要]
@@ -50,10 +48,6 @@ RuCaptcha.configure do
50
48
  # self.skip_cache_store_check = true
51
49
  # Chars length, default: 5, allows: [3 - 7]
52
50
  # self.length = 5
53
- # enable/disable Strikethrough.
54
- # self.strikethrough = true
55
- # enable/disable Outline style
56
- # self.outline = false
57
51
  end
58
52
  ```
59
53
 
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "rake/extensiontask"
4
+ require "rubygems/package_task"
5
+ require "bundler"
6
+
7
+ CROSS_PLATFORMS = %w[
8
+ aarch64-linux
9
+ arm64-darwin
10
+ x64-mingw32
11
+ x86_64-darwin
12
+ x86_64-linux
13
+ ]
14
+
15
+ spec = Bundler.load_gemspec("rucaptcha.gemspec")
16
+
17
+ Gem::PackageTask.new(spec).define
18
+
19
+ Rake::ExtensionTask.new("rucaptcha", spec) do |ext|
20
+ ext.lib_dir = "lib/rucaptcha"
21
+ ext.source_pattern = "*.{rs,toml}"
22
+ ext.cross_compile = true
23
+ ext.cross_platform = CROSS_PLATFORMS
24
+ end
25
+
26
+ RSpec::Core::RakeTask.new(:spec)
27
+ task default: :spec
28
+
29
+ task :preview do
30
+ require "rucaptcha"
31
+ res = RuCaptchaCore.create(5, 5)
32
+ warn res[0]
33
+ puts res[1].pack("c*")
34
+ end
@@ -6,7 +6,8 @@ module RuCaptcha
6
6
  headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
7
7
  headers["Pragma"] = "no-cache"
8
8
  data = generate_rucaptcha
9
- opts = {disposition: "inline", type: "image/gif"}
9
+
10
+ opts = { disposition: "inline", type: "image/png" }
10
11
  send_data data, opts
11
12
  end
12
13
  end