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 +4 -4
- data/README.md +3 -9
- data/Rakefile +34 -0
- data/app/controllers/ru_captcha/captcha_controller.rb +2 -1
- data/ext/rucaptcha/Cargo.lock +1226 -0
- data/ext/rucaptcha/Cargo.toml +14 -0
- data/ext/rucaptcha/extconf.rb +3 -1
- data/ext/rucaptcha/src/captcha.rs +250 -0
- data/ext/rucaptcha/src/lib.rs +18 -0
- data/lib/rucaptcha/configuration.rb +2 -6
- data/lib/rucaptcha/version.rb +1 -1
- data/lib/rucaptcha/view_helpers.rb +2 -2
- data/lib/rucaptcha.rb +16 -12
- metadata +18 -22
- data/CHANGELOG.md +0 -93
- data/config/locales/rucaptcha.en.yml +0 -3
- data/config/locales/rucaptcha.pt-BR.yml +0 -3
- data/config/locales/rucaptcha.zh-CN.yml +0 -3
- data/config/locales/rucaptcha.zh-TW.yml +0 -3
- data/ext/rucaptcha/colors.h +0 -365
- data/ext/rucaptcha/font.h +0 -27
- data/ext/rucaptcha/rucaptcha.c +0 -301
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bbd4b8b851e790f62f2f6db911ae64b9498a0928036e8b7ea67856a4da547ee
|
4
|
+
data.tar.gz: 3eefb7d5585af340e86f704862bfcc98500bc2e3d3be0cf6b29e52617d3bd634
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
-
-
|
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
|
-
|
9
|
+
|
10
|
+
opts = { disposition: "inline", type: "image/png" }
|
10
11
|
send_data data, opts
|
11
12
|
end
|
12
13
|
end
|