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
@@ -0,0 +1,15 @@
1
+ == 0.0.4
2
+
3
+ * make bucket configurable via config/qiniu.yml
4
+
5
+ == 0.0.3
6
+
7
+ * gem 命名修改导致engine require问题的修复
8
+
9
+ == 0.0.2
10
+
11
+ * gem 命名和对应修改
12
+
13
+ == 0.0.1
14
+
15
+ * 粗暴修改
@@ -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: "testimages",
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://testimages.qiniudn.com/#{key}"}.to_json)
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: "testimages",
29
- customer: "as181920"
29
+ scope: QINIU_CONFIG["bucket"],
30
+ customer: "rails_kindeditor"
30
31
  end
31
32
 
32
33
  def generate_key
@@ -1,4 +1,4 @@
1
1
  module RailsKindeditor
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
4
4
 
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.3
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