refile_cache 0.1.0 → 0.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/refile_cache/cache.rb +4 -6
- data/lib/refile_cache/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: d485333be3c97c972b097522d813c698c8a08b73
|
4
|
+
data.tar.gz: 47c35db692febe8b5e4408d36e967239c8a308bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47c39d9da1526244878c3060af34d9b4a43edaa8b287cb6a48d86a7d81bb9ec2cd31dc7bb8bc9df07b45d40ce2ab035b7c3a6ddfe8faaa95ef96d0d7a5e704bb
|
7
|
+
data.tar.gz: 6b71bdb39e6f0d70540059748453cc930c99680422d38aad553acffbe14ca7367ffcab445a633af2b19786482fe6775e26ea82c4931522617264641ccef7b163
|
data/lib/refile_cache/cache.rb
CHANGED
@@ -12,7 +12,7 @@ module RefileCache
|
|
12
12
|
# This is for autoreloading to be working :D
|
13
13
|
class Logic
|
14
14
|
URL_PATH = /\A#{Refile.mount_point}\/.*\/store\/(fill|fit|limit|pad|convert)\//
|
15
|
-
URL_PROCESSOR = /\A#{Refile.mount_point}\/(?<token>.*)\/(?<backend>.*)\/(?<processor>(fill|fit|limit|pad|convert))\/(?<splat>.*)\/(?<id>.*)\/(?<
|
15
|
+
URL_PROCESSOR = /\A#{Refile.mount_point}\/(?<token>.*)\/(?<backend>.*)\/(?<processor>(fill|fit|limit|pad|convert))\/(?<splat>.*)\/(?<id>.*)\/(?<file>.*)/
|
16
16
|
|
17
17
|
def initialize(app)
|
18
18
|
@app = app
|
@@ -28,9 +28,7 @@ module RefileCache
|
|
28
28
|
cache_key = "cache#{params[:id]}#{params[:processor]}#{params[:splat].delete('/')}"
|
29
29
|
|
30
30
|
if backend.exists?(cache_key)
|
31
|
-
|
32
|
-
filename = "#{params[:file_base]}.#{params[:extension]}"
|
33
|
-
return [200, own_headers(filename, file.size), stream_file(env, file)]
|
31
|
+
return [301, { 'Location' => "https://#{ENV['S3_BUCKET_NAME']}.s3.amazonaws.com/image_cache/#{cache_key}" }, []]
|
34
32
|
end
|
35
33
|
|
36
34
|
status, headers, response = @app.call(env)
|
@@ -69,9 +67,9 @@ module RefileCache
|
|
69
67
|
'Access-Control-Allow-Headers' => '',
|
70
68
|
'Access-Control-Allow-Method' => '',
|
71
69
|
'Cache-Control' => 'public, max-age=31536000',
|
72
|
-
'Expires' => (Time.now + 1.year).to_s,
|
70
|
+
'Expires' => (Time.now + 1.year).gmtime.to_s,
|
73
71
|
'Content-Disposition' => "inline; filename=\"#{filename}\"",
|
74
|
-
'Last-Modified' => (Time.now - 1.month).to_s,
|
72
|
+
'Last-Modified' => (Time.now - 1.month).gmtime.to_s,
|
75
73
|
'Content-Length' => content_length.to_s,
|
76
74
|
'X-Content-Type-Options' => 'nosniff'
|
77
75
|
}
|
data/lib/refile_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refile_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
4
|
+
version: 0.1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blueberry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: refile
|
@@ -105,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.
|
108
|
+
rubygems_version: 2.5.1
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: RefileCache
|
112
112
|
test_files: []
|
113
|
-
has_rdoc:
|