rails_kindeditor_qiniu 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc
ADDED
@@ -6,10 +6,11 @@ class Kindeditor::AssetsController < ApplicationController
|
|
6
6
|
@img_file = params[:imgFile]
|
7
7
|
upload_token = generate_upload_token
|
8
8
|
key = generate_key
|
9
|
+
bucket = QINIU_CONFIG["bucket"]
|
9
10
|
response = Qiniu::RS.upload_file \
|
10
11
|
uptoken: upload_token,
|
11
12
|
file: @img_file.tempfile.path,
|
12
|
-
bucket:
|
13
|
+
bucket: bucket,
|
13
14
|
key: key,
|
14
15
|
note: "rails kindeditor"
|
15
16
|
|
@@ -19,14 +20,14 @@ class Kindeditor::AssetsController < ApplicationController
|
|
19
20
|
file_type: @img_file.content_type,
|
20
21
|
file_size: @img_file.size
|
21
22
|
p response # should be checked for error handle
|
22
|
-
render :text => ({:error => 0, :url => "http
|
23
|
+
render :text => ({:error => 0, :url => "http://#{bucket}.qiniudn.com/#{key}"}.to_json)
|
23
24
|
end
|
24
25
|
|
25
26
|
private
|
26
27
|
def generate_upload_token
|
27
28
|
Qiniu::RS.generate_upload_token \
|
28
|
-
scope: "
|
29
|
-
customer: "
|
29
|
+
scope: QINIU_CONFIG["bucket"],
|
30
|
+
customer: "rails_kindeditor"
|
30
31
|
end
|
31
32
|
|
32
33
|
def generate_key
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_kindeditor_qiniu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -19,6 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- .gitignore
|
22
|
+
- CHANGELOG.rdoc
|
22
23
|
- Gemfile
|
23
24
|
- README.md
|
24
25
|
- Rakefile
|