utopia 2.19.1 → 2.20.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -0
- data/lib/utopia/content/link.rb +6 -4
- data/lib/utopia/content.rb +25 -6
- data/lib/utopia/localization.rb +2 -0
- data/lib/utopia/static/mime_types.rb +1 -1
- data/lib/utopia/static.rb +41 -23
- data/lib/utopia/version.rb +1 -1
- data/setup/site/spec/website_spec.rb +1 -2
- data.tar.gz.sig +0 -0
- metadata +53 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98a414341752cd45376ffac50a8ebd4b5e3ee49eb2868ce87dc41f3696c07d76
|
4
|
+
data.tar.gz: 989e031a0c3f3680d52f28540f94712f32e00cb95af7c5575a81ef7f7b8ed6d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d8ff1cf0d72eabbef7550ef1c049f6af84c9cd110403cff6999c506ac8200697fa8930cc2db29cc666b23dd13b144a81c45301d669c43bff618719254247293
|
7
|
+
data.tar.gz: dbd8e4c9379ad5d539a8e099402630a23b9c7a5422d369a2f5cdcea1426d07b1bffb2532b1694dad71b8966dcdb8a8084d4270af809ce3ef23e3b0dfddd48883
|
checksums.yaml.gz.sig
ADDED
data/lib/utopia/content/link.rb
CHANGED
data/lib/utopia/content.rb
CHANGED
@@ -32,6 +32,8 @@ require 'trenni/template'
|
|
32
32
|
|
33
33
|
require 'concurrent/map'
|
34
34
|
|
35
|
+
require 'traces/provider'
|
36
|
+
|
35
37
|
module Utopia
|
36
38
|
# A middleware which serves dynamically generated content based on markup files.
|
37
39
|
class Content
|
@@ -107,6 +109,16 @@ module Utopia
|
|
107
109
|
end
|
108
110
|
end
|
109
111
|
|
112
|
+
def respond(link, request)
|
113
|
+
if node = resolve_link(link)
|
114
|
+
attributes = request.env.fetch(VARIABLES_KEY, {}).to_hash
|
115
|
+
|
116
|
+
return node.process!(request, attributes)
|
117
|
+
elsif redirect_uri = link[:uri]
|
118
|
+
return [307, {HTTP::LOCATION => redirect_uri}, []]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
110
122
|
def call(env)
|
111
123
|
request = Rack::Request.new(env)
|
112
124
|
path = Path.create(request.path_info)
|
@@ -124,12 +136,8 @@ module Utopia
|
|
124
136
|
|
125
137
|
locale = env[Localization::CURRENT_LOCALE_KEY]
|
126
138
|
if link = @links.for(path, locale)
|
127
|
-
if
|
128
|
-
|
129
|
-
|
130
|
-
return node.process!(request, attributes)
|
131
|
-
elsif redirect_uri = link[:uri]
|
132
|
-
return [307, {HTTP::LOCATION => redirect_uri}, []]
|
139
|
+
if response = self.respond(link, request)
|
140
|
+
return response
|
133
141
|
end
|
134
142
|
end
|
135
143
|
|
@@ -191,4 +199,15 @@ module Utopia
|
|
191
199
|
end
|
192
200
|
end
|
193
201
|
end
|
202
|
+
|
203
|
+
Traces::Provider(Content) do
|
204
|
+
def respond(link, request)
|
205
|
+
attributes = {
|
206
|
+
'link.key' => link.key,
|
207
|
+
'link.href' => link.href
|
208
|
+
}
|
209
|
+
|
210
|
+
trace("utopia.content.respond", attributes: attributes) {super}
|
211
|
+
end
|
212
|
+
end
|
194
213
|
end
|
data/lib/utopia/localization.rb
CHANGED
data/lib/utopia/static.rb
CHANGED
@@ -26,6 +26,8 @@ require_relative 'localization'
|
|
26
26
|
require_relative 'static/local_file'
|
27
27
|
require_relative 'static/mime_types'
|
28
28
|
|
29
|
+
require 'traces/provider'
|
30
|
+
|
29
31
|
module Utopia
|
30
32
|
# A middleware which serves static files from the specified root directory.
|
31
33
|
class Static
|
@@ -72,36 +74,52 @@ module Utopia
|
|
72
74
|
ETAG = 'ETag'.freeze
|
73
75
|
ACCEPT_RANGES = 'Accept-Ranges'.freeze
|
74
76
|
|
77
|
+
def respond(env, path_info, extension)
|
78
|
+
path = Path[path_info].simplify
|
79
|
+
|
80
|
+
if locale = env[Localization::CURRENT_LOCALE_KEY]
|
81
|
+
path.last.insert(path.last.rindex('.') || -1, ".#{locale}")
|
82
|
+
end
|
83
|
+
|
84
|
+
if file = fetch_file(path)
|
85
|
+
response_headers = {
|
86
|
+
LAST_MODIFIED => file.mtime_date,
|
87
|
+
CONTENT_TYPE => @extensions[extension],
|
88
|
+
CACHE_CONTROL => @cache_control,
|
89
|
+
ETAG => file.etag,
|
90
|
+
ACCEPT_RANGES => "bytes"
|
91
|
+
}
|
92
|
+
|
93
|
+
if file.modified?(env)
|
94
|
+
return file.serve(env, response_headers)
|
95
|
+
else
|
96
|
+
return [304, response_headers, []]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
75
101
|
def call(env)
|
76
102
|
path_info = env[Rack::PATH_INFO]
|
77
103
|
extension = File.extname(path_info)
|
78
|
-
|
79
|
-
if @extensions.key?
|
80
|
-
|
81
|
-
|
82
|
-
if locale = env[Localization::CURRENT_LOCALE_KEY]
|
83
|
-
path.last.insert(path.last.rindex('.') || -1, ".#{locale}")
|
84
|
-
end
|
85
|
-
|
86
|
-
if file = fetch_file(path)
|
87
|
-
response_headers = {
|
88
|
-
LAST_MODIFIED => file.mtime_date,
|
89
|
-
CONTENT_TYPE => @extensions[extension],
|
90
|
-
CACHE_CONTROL => @cache_control,
|
91
|
-
ETAG => file.etag,
|
92
|
-
ACCEPT_RANGES => "bytes"
|
93
|
-
}
|
94
|
-
|
95
|
-
if file.modified?(env)
|
96
|
-
return file.serve(env, response_headers)
|
97
|
-
else
|
98
|
-
return [304, response_headers, []]
|
99
|
-
end
|
104
|
+
|
105
|
+
if @extensions.key?(extension.downcase)
|
106
|
+
if response = self.respond(env, path_info, extension)
|
107
|
+
return response
|
100
108
|
end
|
101
109
|
end
|
102
|
-
|
110
|
+
|
103
111
|
# else if no file was found:
|
104
112
|
return @app.call(env)
|
105
113
|
end
|
106
114
|
end
|
115
|
+
|
116
|
+
Traces::Provider(Static) do
|
117
|
+
def respond(env, path_info, extension)
|
118
|
+
attributes = {
|
119
|
+
path_info: path_info,
|
120
|
+
}
|
121
|
+
|
122
|
+
trace("utopia.static.respond", attributes: attributes) {super}
|
123
|
+
end
|
124
|
+
end
|
107
125
|
end
|
data/lib/utopia/version.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require_relative 'website_context'
|
4
4
|
|
5
|
-
# Learn about best practice specs from http://betterspecs.org
|
6
5
|
RSpec.describe "website", timeout: 120 do
|
7
6
|
include_context "server"
|
8
7
|
|
@@ -13,7 +12,7 @@ RSpec.describe "website", timeout: 120 do
|
|
13
12
|
Async::HTTP::Client.open(endpoint, connection_limit: 8) do |client|
|
14
13
|
spider.fetch(statistics, client, endpoint.url) do |method, uri, response|
|
15
14
|
if response.failure?
|
16
|
-
|
15
|
+
Console.logger.error(endpoint) {"#{method} #{uri} -> #{response.status}"}
|
17
16
|
end
|
18
17
|
end.wait
|
19
18
|
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.20.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
+
- Huba Nagy
|
9
|
+
- Michael Adams
|
10
|
+
- Olle Jonsson
|
11
|
+
- System Administrator
|
12
|
+
- k1tsu
|
8
13
|
autorequire:
|
9
14
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
15
|
+
cert_chain:
|
16
|
+
- |
|
17
|
+
-----BEGIN CERTIFICATE-----
|
18
|
+
MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
|
19
|
+
ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1j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u3dpdUhZM1w051iw5GfiqclAr1Psypf16Tiod/ho//4oAu6T
|
35
|
+
9fj3DPX/acWV9P/FScvqo4Qgv6g4VWO5ZU7z2JmPoTXZtYMunRAmQPFL/gSUc6aK
|
36
|
+
vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
|
37
|
+
x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
|
38
|
+
bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
|
39
|
+
Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
|
40
|
+
y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
|
41
|
+
RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
|
42
|
+
HiLJ8VOFx6w=
|
43
|
+
-----END CERTIFICATE-----
|
44
|
+
date: 2022-08-03 00:00:00.000000000 Z
|
12
45
|
dependencies:
|
13
46
|
- !ruby/object:Gem::Dependency
|
14
47
|
name: concurrent-ruby
|
@@ -112,14 +145,14 @@ dependencies:
|
|
112
145
|
name: rack
|
113
146
|
requirement: !ruby/object:Gem::Requirement
|
114
147
|
requirements:
|
115
|
-
- - "
|
148
|
+
- - ">="
|
116
149
|
- !ruby/object:Gem::Version
|
117
150
|
version: '2.2'
|
118
151
|
type: :runtime
|
119
152
|
prerelease: false
|
120
153
|
version_requirements: !ruby/object:Gem::Requirement
|
121
154
|
requirements:
|
122
|
-
- - "
|
155
|
+
- - ">="
|
123
156
|
- !ruby/object:Gem::Version
|
124
157
|
version: '2.2'
|
125
158
|
- !ruby/object:Gem::Dependency
|
@@ -136,6 +169,20 @@ dependencies:
|
|
136
169
|
- - "~>"
|
137
170
|
- !ruby/object:Gem::Version
|
138
171
|
version: '2.1'
|
172
|
+
- !ruby/object:Gem::Dependency
|
173
|
+
name: traces
|
174
|
+
requirement: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
type: :runtime
|
180
|
+
prerelease: false
|
181
|
+
version_requirements: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
139
186
|
- !ruby/object:Gem::Dependency
|
140
187
|
name: trenni
|
141
188
|
requirement: !ruby/object:Gem::Requirement
|
@@ -367,7 +414,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
367
414
|
- !ruby/object:Gem::Version
|
368
415
|
version: '0'
|
369
416
|
requirements: []
|
370
|
-
rubygems_version: 3.3.
|
417
|
+
rubygems_version: 3.3.7
|
371
418
|
signing_key:
|
372
419
|
specification_version: 4
|
373
420
|
summary: Utopia is a framework for building dynamic content-driven websites.
|
metadata.gz.sig
ADDED
Binary file
|