activestorage-aliyun 0.3.0 → 0.4.0
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 +5 -5
- data/CHANGELOG.md +10 -0
- data/README.md +13 -1
- data/lib/active_storage/service/aliyun_service.rb +5 -6
- data/lib/active_storage_aliyun/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7a6e97cb757b635493a02597209f20c7b73283f6922b604fac48836cb86c323f
|
4
|
+
data.tar.gz: c3472d980a98774ce2e4592c68cef5fd36b88423243fc1c9a5fa0b76f39518e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f1c434607f6db1ae7383143b9ac4d8673b8b39af86c1ae130c9617bb1d23fc81ca9cb458d25b7b432f5199ee4856a9741ae84f229d7669ef4408c32218ff0b3
|
7
|
+
data.tar.gz: 2a748673e30e2d73cc4b335c017265592ccfca051f3bf4ae775a72731549dfc376aeaca94dd35866cf15bc58d48d994fa54782ead184dcfe19760cff28be91a8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 0.4.0
|
2
|
+
|
3
|
+
- Support present `params` to `service_url` to oss image url.
|
4
|
+
|
5
|
+
for example:
|
6
|
+
|
7
|
+
```rb
|
8
|
+
@photo.image.service_url(params: { 'x-oss-process' => "image/resize,h_100,w_100" })
|
9
|
+
```
|
10
|
+
|
1
11
|
## 0.3.0
|
2
12
|
|
3
13
|
- Add `mode` config for setup OSS ACL, `mode: "private"` will always output URL that have signature info.
|
data/README.md
CHANGED
@@ -43,10 +43,22 @@ production:
|
|
43
43
|
Orignial File URL:
|
44
44
|
|
45
45
|
<%= image_tag @photo.image.service_url %>
|
46
|
+
```
|
46
47
|
|
47
48
|
Thumb with OSS image service:
|
48
49
|
|
49
|
-
|
50
|
+
```rb
|
51
|
+
class Photo < ApplicationRecord
|
52
|
+
def image_thumb_url(process)
|
53
|
+
self.image.service_url(params: { "x-oss-process" => process })
|
54
|
+
end
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
And then:
|
59
|
+
|
60
|
+
```erb
|
61
|
+
<%= image_tag @photo.image.image_thumb_url("image/resize,h_100,w_100") %>
|
50
62
|
```
|
51
63
|
|
52
64
|
### Use for file download
|
@@ -52,19 +52,18 @@ module ActiveStorage
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
def url(key, expires_in:, filename
|
55
|
+
def url(key, expires_in:, filename: nil, content_type:, disposition:, params: {})
|
56
56
|
instrument :url, key: key do |payload|
|
57
57
|
sign = private_mode? || disposition == :attachment
|
58
58
|
filekey = path_for(key)
|
59
|
-
params = {}
|
60
59
|
|
61
60
|
if disposition == :attachment
|
62
61
|
params["response-content-type"] = content_type if content_type
|
63
|
-
|
64
|
-
|
65
|
-
if filename.to_s.include?("x-oss-process")
|
66
|
-
params["x-oss-process"] = filename.to_s.split("=").last
|
62
|
+
unless filename.is_a?(ActiveStorage::Filename)
|
63
|
+
filename = ActiveStorage::Filename.new(filename)
|
67
64
|
end
|
65
|
+
|
66
|
+
params["response-content-disposition"] = content_disposition_with(type: disposition, filename: filename)
|
68
67
|
end
|
69
68
|
|
70
69
|
generated_url = object_url(filekey, sign: sign, expires_in: expires_in, params: params)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-aliyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.2.0.
|
19
|
+
version: 5.2.0.rc2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.2.0.
|
26
|
+
version: 5.2.0.rc2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aliyun-sdk
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
73
|
rubyforge_project:
|
74
|
-
rubygems_version: 2.6
|
74
|
+
rubygems_version: 2.7.6
|
75
75
|
signing_key:
|
76
76
|
specification_version: 4
|
77
77
|
summary: Wraps the Aliyun OSS as an Active Storage service
|