attache 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/attache/base.rb +8 -3
- data/lib/attache/tus/upload.rb +2 -2
- data/lib/attache/upload.rb +1 -1
- data/lib/attache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cde7af6587a7bd0d889116e932393567b21c67d
|
4
|
+
data.tar.gz: 89c025fc3fafb2a490aff53ae8e9596a63290a56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6c4356d1fae80dee32d9a2957722c7ee887d7047c4f4df7cc2e44f81cd6ef934815d091d724f5efaa23f10a158a4fb8b9841098902d51a9ae1e5bb658b3ce74
|
7
|
+
data.tar.gz: 0fbdd6abd508fe825ec796b2e7db6b00155a8d0d3108d8b0b7c8b9355e0801dabd3ec38c77dd02928764bdc68c340bb76a90b37e9d212fd26184dc6fa6970501
|
data/lib/attache/base.rb
CHANGED
@@ -60,14 +60,19 @@ class Attache::Base
|
|
60
60
|
File.join(*SecureRandom.hex.scan(/\w\w/), basename)
|
61
61
|
end
|
62
62
|
|
63
|
-
def json_of(relpath, cachekey)
|
63
|
+
def json_of(relpath, cachekey, vhost)
|
64
64
|
filepath = path_of(cachekey)
|
65
|
-
{
|
65
|
+
json = {
|
66
66
|
path: relpath,
|
67
67
|
content_type: content_type_of(filepath),
|
68
68
|
geometry: geometry_of(filepath),
|
69
69
|
bytes: filesize_of(filepath),
|
70
|
-
}
|
70
|
+
}
|
71
|
+
if vhost && vhost.secret_key
|
72
|
+
content = json.sort.collect {|k,v| "#{k}=#{v}" }.join('&')
|
73
|
+
json['signature'] = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), vhost.secret_key, content)
|
74
|
+
end
|
75
|
+
json.to_json
|
71
76
|
end
|
72
77
|
|
73
78
|
end
|
data/lib/attache/tus/upload.rb
CHANGED
@@ -39,7 +39,7 @@ class Attache::Tus::Upload < Attache::Base
|
|
39
39
|
|
40
40
|
[200,
|
41
41
|
tus.headers_with_cors({'Content-Type' => 'text/json'}, offset: current_offset(cachekey, relpath, config)),
|
42
|
-
[json_of(relpath, cachekey)],
|
42
|
+
[json_of(relpath, cachekey, config)],
|
43
43
|
]
|
44
44
|
else
|
45
45
|
[400, tus.headers_with_cors('X-Exception' => 'Bad headers'), []]
|
@@ -53,7 +53,7 @@ class Attache::Tus::Upload < Attache::Base
|
|
53
53
|
cachekey = File.join(request_hostname(env), relpath)
|
54
54
|
[200,
|
55
55
|
tus.headers_with_cors({'Content-Type' => 'text/json'}, offset: current_offset(cachekey, relpath, config)),
|
56
|
-
[json_of(relpath, cachekey)],
|
56
|
+
[json_of(relpath, cachekey, config)],
|
57
57
|
]
|
58
58
|
|
59
59
|
when 'GET'
|
data/lib/attache/upload.rb
CHANGED
@@ -24,7 +24,7 @@ class Attache::Upload < Attache::Base
|
|
24
24
|
|
25
25
|
config.storage_create(relpath: relpath, cachekey: cachekey) if config.storage && config.bucket
|
26
26
|
|
27
|
-
[200, config.headers_with_cors.merge('Content-Type' => 'text/json'), [json_of(relpath, cachekey)]]
|
27
|
+
[200, config.headers_with_cors.merge('Content-Type' => 'text/json'), [json_of(relpath, cachekey, config)]]
|
28
28
|
when 'OPTIONS'
|
29
29
|
[200, config.headers_with_cors, []]
|
30
30
|
else
|
data/lib/attache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- choonkeat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|