rucaptcha 0.3.2 → 0.3.2.1
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/app/controllers/ru_captcha/captcha_controller.rb +5 -1
- data/lib/rucaptcha/captcha.rb +15 -6
- data/lib/rucaptcha/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ddf04eddc583be35415502ee00f014a113122b2
|
4
|
+
data.tar.gz: c8bbe3e0d1637cd3f56e98ade1067972df9e5dbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78c9f3d52cf0123a7568402b378ec050b45c19015d59c789f31020e8179ea2591ea6e6f1e23d0baf62a7a98b4c6385a5e003f1e25d7ebdcc58044a25fd298a68
|
7
|
+
data.tar.gz: 581c4bb3660c6ac96ef2da1a06be97103e99c0324722744332fef13f85189db099140bbcd314e8ba66a76cfe9f03879e6881af1919be32159d676279bc812b74
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,11 @@ module RuCaptcha
|
|
4
4
|
headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
|
5
5
|
headers['Pragma'] = 'no-cache'
|
6
6
|
|
7
|
-
|
7
|
+
if Gem.win_platform?
|
8
|
+
send_file generate_rucaptcha, disposition: 'inline', type: 'image/png'
|
9
|
+
else
|
10
|
+
send_data generate_rucaptcha, disposition: 'inline', type: 'image/png'
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
data/lib/rucaptcha/captcha.rb
CHANGED
@@ -60,12 +60,21 @@ module RuCaptcha
|
|
60
60
|
-implode #{RuCaptcha.config.implode} -trim label:- png:-
|
61
61
|
CODE
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
if Gem.win_platform?
|
64
|
+
png_file_path = Rails.root.join('tmp', 'cache', "#{code}.png")
|
65
|
+
command = "convert -size #{size} xc:White -gravity Center -weight 12 -pointsize 20 -annotate 0 \"#{code}\" -trim #{png_file_path}"
|
66
|
+
require 'open3'
|
67
|
+
_stdout_str, stderr_str = Open3.capture3(command)
|
68
|
+
raise "RuCaptcha: #{stderr_str.strip}" if stderr_str != nil && stderr_str.length > 0
|
69
|
+
png_file_path
|
70
|
+
else
|
71
|
+
command.strip!
|
72
|
+
pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)
|
73
|
+
Process.waitpid(pid)
|
74
|
+
err = stderr.read
|
75
|
+
raise "RuCaptcha: #{err.strip}" if err != nil && err.length > 0
|
76
|
+
stdout.read
|
77
|
+
end
|
69
78
|
end
|
70
79
|
end
|
71
80
|
end
|
data/lib/rucaptcha/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rucaptcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.2
|
4
|
+
version: 0.3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: posix-spawn
|
@@ -107,10 +107,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.5.1
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: This is a Captcha gem for Rails Application. It run ImageMagick command to
|
114
114
|
draw Captcha image.
|
115
115
|
test_files: []
|
116
|
-
has_rdoc:
|