static-rails 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +30 -29
- data/lib/static-rails/file_handler.rb +1 -2
- data/lib/static-rails/static_middleware.rb +11 -0
- data/lib/static-rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a6e7ad52cd960477f61b0faaa6364968844e8d2862714e35340531a12aa82e5
|
4
|
+
data.tar.gz: 0a66a78cfdec31a91354c8815e1ec612a44345230bfb5115cdd1afc999bbcc85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fca6f6a4ffa3a2893019d583853d1e790e8a28e90fb6140a53ce4f5dfdf4b34abfb5d9a350f3a4e5d6e5245a3461f6b303f62208cd55b9158c1256e38f35f1f8
|
7
|
+
data.tar.gz: 4d03d6226092c97f5fe9f35283c77d4544f3addb4766d42a01eb6cd69568763ab24ff5220181e0f7b5f7cce69722b073367b098bd1e525c37923b449ca460903
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,50 +1,50 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
static-rails (0.0.
|
4
|
+
static-rails (0.0.14)
|
5
5
|
rack-proxy (~> 0.6)
|
6
6
|
railties (>= 5.0.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actionpack (6.0.3.
|
12
|
-
actionview (= 6.0.3.
|
13
|
-
activesupport (= 6.0.3.
|
11
|
+
actionpack (6.0.3.3)
|
12
|
+
actionview (= 6.0.3.3)
|
13
|
+
activesupport (= 6.0.3.3)
|
14
14
|
rack (~> 2.0, >= 2.0.8)
|
15
15
|
rack-test (>= 0.6.3)
|
16
16
|
rails-dom-testing (~> 2.0)
|
17
17
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
18
|
-
actionview (6.0.3.
|
19
|
-
activesupport (= 6.0.3.
|
18
|
+
actionview (6.0.3.3)
|
19
|
+
activesupport (= 6.0.3.3)
|
20
20
|
builder (~> 3.1)
|
21
21
|
erubi (~> 1.4)
|
22
22
|
rails-dom-testing (~> 2.0)
|
23
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
-
activesupport (6.0.3.
|
24
|
+
activesupport (6.0.3.3)
|
25
25
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
26
26
|
i18n (>= 0.7, < 2)
|
27
27
|
minitest (~> 5.1)
|
28
28
|
tzinfo (~> 1.1)
|
29
29
|
zeitwerk (~> 2.2, >= 2.2.2)
|
30
|
-
ast (2.4.
|
30
|
+
ast (2.4.1)
|
31
31
|
builder (3.2.4)
|
32
|
-
concurrent-ruby (1.1.
|
32
|
+
concurrent-ruby (1.1.7)
|
33
33
|
crass (1.0.6)
|
34
34
|
erubi (1.9.0)
|
35
|
-
i18n (1.8.
|
35
|
+
i18n (1.8.5)
|
36
36
|
concurrent-ruby (~> 1.0)
|
37
|
-
loofah (2.
|
37
|
+
loofah (2.7.0)
|
38
38
|
crass (~> 1.0.2)
|
39
39
|
nokogiri (>= 1.5.9)
|
40
40
|
method_source (1.0.0)
|
41
41
|
mini_portile2 (2.4.0)
|
42
|
-
minitest (5.14.
|
42
|
+
minitest (5.14.2)
|
43
43
|
nokogiri (1.10.10)
|
44
44
|
mini_portile2 (~> 2.4.0)
|
45
|
-
parallel (1.19.
|
46
|
-
parser (2.7.1.
|
47
|
-
ast (~> 2.4.
|
45
|
+
parallel (1.19.2)
|
46
|
+
parser (2.7.1.4)
|
47
|
+
ast (~> 2.4.1)
|
48
48
|
rack (2.2.3)
|
49
49
|
rack-proxy (0.6.5)
|
50
50
|
rack
|
@@ -55,33 +55,34 @@ GEM
|
|
55
55
|
nokogiri (>= 1.6)
|
56
56
|
rails-html-sanitizer (1.3.0)
|
57
57
|
loofah (~> 2.3)
|
58
|
-
railties (6.0.3.
|
59
|
-
actionpack (= 6.0.3.
|
60
|
-
activesupport (= 6.0.3.
|
58
|
+
railties (6.0.3.3)
|
59
|
+
actionpack (= 6.0.3.3)
|
60
|
+
activesupport (= 6.0.3.3)
|
61
61
|
method_source
|
62
62
|
rake (>= 0.8.7)
|
63
63
|
thor (>= 0.20.3, < 2.0)
|
64
64
|
rainbow (3.0.0)
|
65
65
|
rake (13.0.1)
|
66
|
-
regexp_parser (1.
|
66
|
+
regexp_parser (1.8.0)
|
67
67
|
rexml (3.2.4)
|
68
|
-
rubocop (0.
|
68
|
+
rubocop (0.91.1)
|
69
69
|
parallel (~> 1.10)
|
70
|
-
parser (>= 2.7.
|
70
|
+
parser (>= 2.7.1.1)
|
71
71
|
rainbow (>= 2.2.2, < 4.0)
|
72
72
|
regexp_parser (>= 1.7)
|
73
73
|
rexml
|
74
|
-
rubocop-ast (>= 0.0.
|
74
|
+
rubocop-ast (>= 0.4.0, < 1.0)
|
75
75
|
ruby-progressbar (~> 1.7)
|
76
76
|
unicode-display_width (>= 1.4.0, < 2.0)
|
77
|
-
rubocop-ast (0.
|
78
|
-
parser (>= 2.7.
|
79
|
-
rubocop-performance (1.
|
80
|
-
rubocop (>= 0.
|
77
|
+
rubocop-ast (0.4.2)
|
78
|
+
parser (>= 2.7.1.4)
|
79
|
+
rubocop-performance (1.8.1)
|
80
|
+
rubocop (>= 0.87.0)
|
81
|
+
rubocop-ast (>= 0.4.0)
|
81
82
|
ruby-progressbar (1.10.1)
|
82
|
-
standard (0.
|
83
|
-
rubocop (
|
84
|
-
rubocop-performance (
|
83
|
+
standard (0.6.2)
|
84
|
+
rubocop (= 0.91.1)
|
85
|
+
rubocop-performance (= 1.8.1)
|
85
86
|
thor (1.0.1)
|
86
87
|
thread_safe (0.3.6)
|
87
88
|
tzinfo (1.2.7)
|
@@ -54,8 +54,7 @@ module StaticRails
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def serve(request, filepath, content_headers)
|
57
|
-
original, request.path_info =
|
58
|
-
request.path_info, ::Rack::Utils.escape_path(filepath).b
|
57
|
+
original, request.path_info = request.path_info, ::Rack::Utils.escape_path(filepath).b
|
59
58
|
|
60
59
|
@file_server.call(request.env).tap do |status, headers, body|
|
61
60
|
# Omit Content-Encoding/Type/etc headers for 304 Not Modified
|
@@ -53,6 +53,17 @@ module StaticRails
|
|
53
53
|
return unless file
|
54
54
|
file_handler.serve(req, *file).tap do |result|
|
55
55
|
result[0] = status_override unless status_override.nil?
|
56
|
+
override_cache_control_if_we_probably_shouldnt_cache!(file, result[1])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
PROBABLY_SHOULDNT_CACHE_MIME_TYPES = [
|
61
|
+
"text/html", "application/xml", "application/rss+xml"
|
62
|
+
]
|
63
|
+
def override_cache_control_if_we_probably_shouldnt_cache!(file, headers = {})
|
64
|
+
mime_type = file[1]["Content-Type"]
|
65
|
+
if PROBABLY_SHOULDNT_CACHE_MIME_TYPES.include?(mime_type)
|
66
|
+
headers["cache-control"] = "no-cache, no-store"
|
56
67
|
end
|
57
68
|
end
|
58
69
|
end
|
data/lib/static-rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: static-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|