blobsterix 0.0.14 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.txt +9 -0
- data/README.md +5 -1
- data/blobsterix.gemspec +1 -0
- data/lib/blobsterix/blob/blob_api.rb +1 -0
- data/lib/blobsterix/blob/blob_url_helper.rb +2 -39
- data/lib/blobsterix/helper/blob_access.rb +9 -10
- data/lib/blobsterix/helper/config_loader.rb +10 -18
- data/lib/blobsterix/helper/directory_list.rb +131 -0
- data/lib/blobsterix/helper/http.rb +13 -14
- data/lib/blobsterix/helper/jsonizer.rb +45 -0
- data/lib/blobsterix/helper/logable.rb +25 -0
- data/lib/blobsterix/helper/murmur.rb +14 -0
- data/lib/blobsterix/helper/simple_proxy.rb +11 -0
- data/lib/blobsterix/helper/template_renderer.rb +4 -0
- data/lib/blobsterix/helper/url_helper.rb +41 -0
- data/lib/blobsterix/router/app_router.rb +15 -65
- data/lib/blobsterix/s3/s3_api.rb +20 -6
- data/lib/blobsterix/s3/s3_auth.rb +32 -0
- data/lib/blobsterix/s3/s3_auth_key_store.rb +14 -0
- data/lib/blobsterix/s3/s3_auth_v2.rb +62 -0
- data/lib/blobsterix/s3/s3_auth_v2_helper.rb +42 -0
- data/lib/blobsterix/s3/s3_auth_v2_query.rb +37 -0
- data/lib/blobsterix/s3/s3_auth_v4.rb +33 -0
- data/lib/blobsterix/s3/s3_url_helper.rb +1 -38
- data/lib/blobsterix/service.rb +3 -9
- data/lib/blobsterix/storage/bucket.rb +6 -3
- data/lib/blobsterix/storage/bucket_entry.rb +11 -1
- data/lib/blobsterix/storage/cache.rb +13 -21
- data/lib/blobsterix/storage/file_system.rb +37 -40
- data/lib/blobsterix/storage/storage.rb +2 -2
- data/lib/blobsterix/transformation/image_transformation.rb +134 -386
- data/lib/blobsterix/version.rb +1 -1
- data/lib/blobsterix.rb +22 -1
- data/spec/lib/helper/directory_list_spec.rb +51 -0
- data/spec/lib/s3/s3_api_spec.rb +27 -0
- data/spec/lib/s3/s3_auth_spec.rb +181 -0
- data/spec/lib/storage/file_system_spec.rb +14 -0
- data/spec/spec_helper.rb +1 -0
- data/templates/storage_template.rb +2 -2
- metadata +30 -2
@@ -1,439 +1,187 @@
|
|
1
1
|
module Blobsterix::Transformations::Impl
|
2
|
-
|
3
|
-
|
4
|
-
"grayscale"
|
5
|
-
end
|
6
|
-
def input_type()
|
7
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
8
|
-
end
|
9
|
-
|
10
|
-
def output_type()
|
11
|
-
@output_type ||= Blobsterix::AcceptType.new "image/*"
|
12
|
-
end
|
2
|
+
def self.create_simple_trafo(name_, input, output, is_format_=false, &block)
|
3
|
+
trafo = ::Class.new Blobsterix::Transformations::Transformation do
|
13
4
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
image.write target_path
|
18
|
-
end
|
19
|
-
end
|
20
|
-
class RotateImage < Blobsterix::Transformations::Transformation
|
21
|
-
def name()
|
22
|
-
"rotate"
|
23
|
-
end
|
24
|
-
def input_type()
|
25
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
26
|
-
end
|
27
|
-
|
28
|
-
def output_type()
|
29
|
-
@output_type ||= Blobsterix::AcceptType.new "image/*"
|
30
|
-
end
|
5
|
+
def self.name=(obj)
|
6
|
+
@name=obj
|
7
|
+
end
|
31
8
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
9
|
+
def self.name_
|
10
|
+
@name
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.is_format=(obj)
|
14
|
+
@is_format=obj
|
37
15
|
end
|
38
|
-
image.write target_path
|
39
|
-
end
|
40
|
-
end
|
41
16
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
17
|
+
def self.is_format_
|
18
|
+
@is_format
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.setTypes(input,output)
|
22
|
+
@input= ::Blobsterix::AcceptType.new input
|
23
|
+
@output= ::Blobsterix::AcceptType.new output
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.input_type_
|
27
|
+
@input
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.output_type_
|
31
|
+
@input
|
32
|
+
end
|
49
33
|
|
50
|
-
|
51
|
-
|
52
|
-
|
34
|
+
def self.body=(obj)
|
35
|
+
@body=obj
|
36
|
+
end
|
53
37
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
image.write target_path
|
58
|
-
end
|
59
|
-
end
|
38
|
+
def self.body_
|
39
|
+
@body
|
40
|
+
end
|
60
41
|
|
61
|
-
|
62
|
-
|
63
|
-
"resize"
|
64
|
-
end
|
65
|
-
def input_type()
|
66
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
67
|
-
end
|
42
|
+
def initialize
|
43
|
+
end
|
68
44
|
|
69
|
-
|
70
|
-
|
71
|
-
|
45
|
+
def name
|
46
|
+
self.class.name_
|
47
|
+
end
|
72
48
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
image.write target_path
|
77
|
-
end
|
78
|
-
end
|
49
|
+
def is_format?
|
50
|
+
self.class.is_format_
|
51
|
+
end
|
79
52
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
84
|
-
def input_type()
|
85
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
86
|
-
end
|
53
|
+
def input_type
|
54
|
+
self.class.input_type_
|
55
|
+
end
|
87
56
|
|
88
|
-
|
89
|
-
|
90
|
-
|
57
|
+
def output_type
|
58
|
+
self.class.output_type_
|
59
|
+
end
|
91
60
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
image.write target_path
|
61
|
+
def transform(input_path, target_path, value)
|
62
|
+
self.class.body_.call input_path, target_path, value
|
63
|
+
end
|
96
64
|
end
|
65
|
+
trafo.setTypes(input, output)
|
66
|
+
trafo.is_format=is_format_
|
67
|
+
trafo.body=block
|
68
|
+
trafo.name=name_
|
69
|
+
::Blobsterix::Transformations::Impl.const_set("#{name_.capitalize}Transformation", trafo)
|
97
70
|
end
|
98
71
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
105
|
-
end
|
106
|
-
|
107
|
-
def output_type()
|
108
|
-
@output_type ||= Blobsterix::AcceptType.new "image/*"
|
109
|
-
end
|
110
|
-
|
111
|
-
def transform(input_path, target_path, value)
|
112
|
-
image = MiniMagick::Image.open(input_path)
|
113
|
-
image.resize "#{image[:width]/value.to_i}x#{image[:height]/value.to_i}"
|
114
|
-
image.write target_path
|
115
|
-
end
|
72
|
+
create_simple_trafo("grayscale", "image/*", "image/*", false) do |input_path, target_path, value|
|
73
|
+
puts "grayscale"
|
74
|
+
image = MiniMagick::Image.open(input_path)
|
75
|
+
image.colorspace "gray"
|
76
|
+
image.write target_path
|
116
77
|
end
|
117
78
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
def input_type()
|
123
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
124
|
-
end
|
125
|
-
|
126
|
-
def output_type()
|
127
|
-
@output_type ||= Blobsterix::AcceptType.new "image/*"
|
128
|
-
end
|
129
|
-
|
130
|
-
def is_format?()
|
131
|
-
true
|
132
|
-
end
|
133
|
-
|
134
|
-
def transform(input_path, target_path, value)
|
135
|
-
image = MiniMagick::Image.open(input_path)
|
136
|
-
image.strip
|
137
|
-
image.write target_path
|
138
|
-
# system("convert #{input_path} -strip #{target_path}")
|
139
|
-
end
|
79
|
+
create_simple_trafo("resize", "image/*", "image/*", false) do |input_path, target_path, value|
|
80
|
+
image = MiniMagick::Image.open(input_path)
|
81
|
+
image.resize value
|
82
|
+
image.write target_path
|
140
83
|
end
|
141
84
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
def input_type()
|
147
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
148
|
-
end
|
149
|
-
|
150
|
-
def output_type()
|
151
|
-
@output_type ||= Blobsterix::AcceptType.new "image/*"
|
152
|
-
end
|
153
|
-
|
154
|
-
def transform(input_path, target_path, value)
|
155
|
-
image = MiniMagick::Image.open(input_path)
|
156
|
-
image.crop value
|
157
|
-
image.write target_path
|
158
|
-
end
|
85
|
+
create_simple_trafo("aresize", "image/*", "image/*", false) do |input_path, target_path, value|
|
86
|
+
image = MiniMagick::Image.open(input_path)
|
87
|
+
image.adaptive_resize value
|
88
|
+
image.write target_path
|
159
89
|
end
|
160
90
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
def output_type()
|
167
|
-
@output_type ||= Blobsterix::AcceptType.new "text/html"
|
168
|
-
end
|
169
|
-
|
170
|
-
def is_format?()
|
171
|
-
true
|
172
|
-
end
|
173
|
-
|
174
|
-
def transform(input_path, target_path, value)
|
175
|
-
type = "image/*"
|
176
|
-
File.open(input_path) {|file|
|
177
|
-
type = MimeMagic.by_magic(file).type
|
178
|
-
}
|
179
|
-
|
180
|
-
image = type === "image/webp" ? {:width => "unknown", :height => "unknown"} : MiniMagick::Image.open(input_path)
|
181
|
-
File.open(target_path, "w") {|file|
|
182
|
-
file.write("<html><body>Mimetype: #{type}<br>Width: #{image[:width]}<br>Height: #{image[:height]}</body></html>")
|
183
|
-
}
|
184
|
-
end
|
91
|
+
create_simple_trafo("resizemax", "image/*", "image/*", false) do |input_path, target_path, value|
|
92
|
+
image = MiniMagick::Image.open(input_path)
|
93
|
+
image.resize "#{value}>"
|
94
|
+
image.write target_path
|
185
95
|
end
|
186
96
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
def input_type()
|
193
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
194
|
-
end
|
195
|
-
|
196
|
-
def output_type()
|
197
|
-
@output_type ||= Blobsterix::AcceptType.new "text/json"
|
198
|
-
end
|
199
|
-
|
200
|
-
def is_format?()
|
201
|
-
true
|
202
|
-
end
|
203
|
-
|
204
|
-
def transform(input_path, target_path, value)
|
205
|
-
type = "image/*"
|
206
|
-
File.open(input_path) {|file|
|
207
|
-
type = MimeMagic.by_magic(file).type
|
208
|
-
}
|
209
|
-
|
210
|
-
image = type === "image/webp" ? {:width => "unknown", :height => "unknown"} : MiniMagick::Image.open(input_path)
|
211
|
-
File.open(target_path, "w") {|file|
|
212
|
-
file.write({:width => image[:width], :height => image[:height]}.merge(Blobsterix::Storage::FileSystemMetaData.new(input_path).as_json).to_json)
|
213
|
-
}
|
97
|
+
create_simple_trafo("rotate", "image/*", "image/*", false) do |input_path, target_path, value|
|
98
|
+
image = MiniMagick::Image.open(input_path)
|
99
|
+
image.combine_options do |c|
|
100
|
+
c.background "none"
|
101
|
+
c.rotate value
|
214
102
|
end
|
103
|
+
image.write target_path
|
215
104
|
end
|
216
105
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
def input_type()
|
223
|
-
@input_type ||= Blobsterix::AcceptType.new "*/*"
|
224
|
-
end
|
225
|
-
|
226
|
-
def output_type()
|
227
|
-
@output_type ||= Blobsterix::AcceptType.new "text/json"
|
228
|
-
end
|
229
|
-
|
230
|
-
def is_format?()
|
231
|
-
true
|
232
|
-
end
|
233
|
-
|
234
|
-
def transform(input_path, target_path, value)
|
235
|
-
File.open(target_path, "w") {|file|
|
236
|
-
file.write(Blobsterix::Storage::FileSystemMetaData.new(input_path).to_json)
|
237
|
-
}
|
238
|
-
end
|
106
|
+
create_simple_trafo("shrink", "image/*", "image/*", false) do |input_path, target_path, value|
|
107
|
+
image = MiniMagick::Image.open(input_path)
|
108
|
+
image.resize "#{image[:width]/value.to_i}x#{image[:height]/value.to_i}"
|
109
|
+
image.write target_path
|
239
110
|
end
|
240
111
|
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
def is_format?()
|
247
|
-
true
|
248
|
-
end
|
249
|
-
|
250
|
-
def input_type()
|
251
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
252
|
-
end
|
253
|
-
|
254
|
-
def output_type()
|
255
|
-
@output_type ||= Blobsterix::AcceptType.new "image/*"
|
256
|
-
end
|
257
|
-
|
258
|
-
def transform(input_path, target_path, value)
|
259
|
-
raise StandardError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
|
260
|
-
end
|
112
|
+
create_simple_trafo("strip", "image/*", "image/*", true) do |input_path, target_path, value|
|
113
|
+
image = MiniMagick::Image.open(input_path)
|
114
|
+
image.strip
|
115
|
+
image.write target_path
|
261
116
|
end
|
262
117
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
def is_format?()
|
269
|
-
true
|
270
|
-
end
|
271
|
-
|
272
|
-
def input_type()
|
273
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
274
|
-
end
|
275
|
-
|
276
|
-
def output_type()
|
277
|
-
@output_type ||= Blobsterix::AcceptType.new "text/plain"
|
278
|
-
end
|
279
|
-
|
280
|
-
def transform(input_path, target_path, value)
|
281
|
-
raise StandardError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{value and value.size > 0 ? value : 100} - > \"#{target_path}\"")
|
282
|
-
end
|
118
|
+
create_simple_trafo("crop", "image/*", "image/*", false) do |input_path, target_path, value|
|
119
|
+
image = MiniMagick::Image.open(input_path)
|
120
|
+
image.crop value
|
121
|
+
image.write target_path
|
283
122
|
end
|
284
123
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
def is_format?()
|
291
|
-
true
|
292
|
-
end
|
293
|
-
|
294
|
-
def input_type()
|
295
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
296
|
-
end
|
297
|
-
|
298
|
-
def output_type()
|
299
|
-
@output_type ||= Blobsterix::AcceptType.new "text/plain"
|
300
|
-
end
|
124
|
+
create_simple_trafo("image2HTML", "image/*", "text/html", true) do |input_path, target_path, value|
|
125
|
+
type = "image/*"
|
126
|
+
File.open(input_path) {|file|
|
127
|
+
type = MimeMagic.by_magic(file).type
|
128
|
+
}
|
301
129
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
raise StandardError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{lines and lines.to_i > 0 ? value : 100} - > \"#{target_path}\"")
|
307
|
-
text = File.read(target_path)
|
308
|
-
File.write(target_path, "<html><body style='font-size: #{em}em'><pre>#{text.gsub("\n", "<br>")}</pre></body></html>")
|
309
|
-
end
|
130
|
+
image = type === "image/webp" ? {:width => "unknown", :height => "unknown"} : MiniMagick::Image.open(input_path)
|
131
|
+
File.open(target_path, "w") {|file|
|
132
|
+
file.write("<html><body>Mimetype: #{type}<br>Width: #{image[:width]}<br>Height: #{image[:height]}</body></html>")
|
133
|
+
}
|
310
134
|
end
|
311
135
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
def is_format?()
|
318
|
-
true
|
319
|
-
end
|
320
|
-
|
321
|
-
def input_type()
|
322
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
323
|
-
end
|
324
|
-
|
325
|
-
def output_type()
|
326
|
-
@output_type ||= Blobsterix::AcceptType.new "image/png"
|
327
|
-
end
|
136
|
+
create_simple_trafo("json", "image/*", "text/json", true) do |input_path, target_path, value|
|
137
|
+
type = "image/*"
|
138
|
+
File.open(input_path) {|file|
|
139
|
+
type = MimeMagic.by_magic(file).type
|
140
|
+
}
|
328
141
|
|
329
|
-
|
330
|
-
|
331
|
-
|
142
|
+
image = type === "image/webp" ? {:width => "unknown", :height => "unknown"} : MiniMagick::Image.open(input_path)
|
143
|
+
File.open(target_path, "w") {|file|
|
144
|
+
file.write({:width => image[:width], :height => image[:height]}.merge(Blobsterix::Storage::FileSystemMetaData.new(input_path).as_json).to_json)
|
145
|
+
}
|
332
146
|
end
|
333
147
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
def is_format?()
|
340
|
-
true
|
341
|
-
end
|
342
|
-
|
343
|
-
def input_type()
|
344
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
345
|
-
end
|
346
|
-
|
347
|
-
def output_type()
|
348
|
-
@output_type ||= Blobsterix::AcceptType.new "image/jpeg"
|
349
|
-
end
|
350
|
-
|
351
|
-
def transform(input_path, target_path, value)
|
352
|
-
raise StandardError.new($?) unless system("convert \"#{input_path}\" jpg:\"#{target_path}\"")
|
353
|
-
end
|
148
|
+
create_simple_trafo("jsonall", "image/*", "text/json", true) do |input_path, target_path, value|
|
149
|
+
File.open(target_path, "w") {|file|
|
150
|
+
file.write(Blobsterix::Storage::FileSystemMetaData.new(input_path).to_json)
|
151
|
+
}
|
354
152
|
end
|
355
153
|
|
356
|
-
|
357
|
-
|
358
|
-
"gif"
|
359
|
-
end
|
360
|
-
|
361
|
-
def is_format?()
|
362
|
-
true
|
363
|
-
end
|
364
|
-
|
365
|
-
def input_type()
|
366
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
367
|
-
end
|
368
|
-
|
369
|
-
def output_type()
|
370
|
-
@output_type ||= Blobsterix::AcceptType.new "image/gif"
|
371
|
-
end
|
372
|
-
|
373
|
-
def transform(input_path, target_path, value)
|
374
|
-
raise StandardError.new($?) unless system("convert \"#{input_path}\" gif:\"#{target_path}\"")
|
375
|
-
end
|
154
|
+
create_simple_trafo("raw", "image/*", "image/*", true) do |input_path, target_path, value|
|
155
|
+
raise StandardError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
|
376
156
|
end
|
377
157
|
|
378
|
-
|
379
|
-
|
380
|
-
"webp"
|
381
|
-
end
|
382
|
-
|
383
|
-
def is_format?()
|
384
|
-
true
|
385
|
-
end
|
386
|
-
|
387
|
-
def input_type()
|
388
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
389
|
-
end
|
390
|
-
|
391
|
-
def output_type()
|
392
|
-
@output_type ||= Blobsterix::AcceptType.new "image/webp"
|
393
|
-
end
|
394
|
-
|
395
|
-
def transform(input_path, target_path, value)
|
396
|
-
raise StandardError.new($?) unless system("cwebp \"#{input_path}\" -o \"#{target_path}\"")
|
397
|
-
#system("cp #{input_path} #{target_path}")
|
398
|
-
end
|
158
|
+
create_simple_trafo("ascii", "image/*", "text/plain", true) do |input_path, target_path, value|
|
159
|
+
raise StandardError.new($?) unless system("convert \"#{input_path}\" jpg:- | jp2a --width=#{value and value.size > 0 ? value : 100} - > \"#{target_path}\"")
|
399
160
|
end
|
400
161
|
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
end
|
405
|
-
|
406
|
-
def input_type()
|
407
|
-
@input_type ||= Blobsterix::AcceptType.new "image/*"
|
408
|
-
end
|
409
|
-
|
410
|
-
def output_type()
|
411
|
-
@output_type ||= Blobsterix::AcceptType.new "image/*"
|
412
|
-
end
|
162
|
+
create_simple_trafo("png", "image/*", "image/png", true) do |input_path, target_path, value|
|
163
|
+
raise StandardError.new($?) unless system("convert \"#{input_path}\" png:\"#{target_path}\"")
|
164
|
+
end
|
413
165
|
|
414
|
-
|
415
|
-
|
416
|
-
raise StandardError.new($?) unless system("convert \"#{input_path}\" -pointsize 20 -draw \"gravity center fill white text 0,12 '#{value.gsub("_", " ").gsub("\"", "'")}'\" \"#{target_path}\"")
|
417
|
-
end
|
166
|
+
create_simple_trafo("jpg", "image/*", "image/jpeg", true) do |input_path, target_path, value|
|
167
|
+
raise StandardError.new($?) unless system("convert \"#{input_path}\" jpg:\"#{target_path}\"")
|
418
168
|
end
|
419
169
|
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
end
|
170
|
+
create_simple_trafo("gif", "image/*", "image/gif", true) do |input_path, target_path, value|
|
171
|
+
raise StandardError.new($?) unless system("convert \"#{input_path}\" gif:\"#{target_path}\"")
|
172
|
+
end
|
424
173
|
|
425
|
-
|
426
|
-
|
427
|
-
|
174
|
+
create_simple_trafo("webp", "image/*", "image/webp", true) do |input_path, target_path, value|
|
175
|
+
raise StandardError.new($?) unless system("cwebp \"#{input_path}\" -o \"#{target_path}\"")
|
176
|
+
end
|
428
177
|
|
429
|
-
|
430
|
-
|
431
|
-
|
178
|
+
create_simple_trafo("text", "image/*", "image/*", true) do |input_path, target_path, value|
|
179
|
+
raise StandardError.new($?) unless system("convert \"#{input_path}\" -pointsize 20 -draw \"gravity center fill white text 0,12 '#{value.gsub("_", " ").gsub("\"", "'")}'\" \"#{target_path}\"")
|
180
|
+
end
|
432
181
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
end
|
182
|
+
create_simple_trafo("sleep", "image/*", "image/*", true) do |input_path, target_path, value|
|
183
|
+
p "SLEEEP"
|
184
|
+
sleep(value.to_i)
|
185
|
+
raise StandardError.new($?) unless system("cp \"#{input_path}\" \"#{target_path}\"")
|
438
186
|
end
|
439
187
|
end
|
data/lib/blobsterix/version.rb
CHANGED
data/lib/blobsterix.rb
CHANGED
@@ -17,8 +17,11 @@ require 'mini_magick'
|
|
17
17
|
require 'json'
|
18
18
|
require 'logger'
|
19
19
|
require 'erb'
|
20
|
+
require 'openssl'
|
21
|
+
require 'base64'
|
20
22
|
require 'goliath/api'
|
21
23
|
|
24
|
+
|
22
25
|
#utility
|
23
26
|
require 'blobsterix/mimemagic/tables'
|
24
27
|
require 'blobsterix/mimemagic/version'
|
@@ -30,10 +33,14 @@ require 'blobsterix/helper/accept_type'
|
|
30
33
|
require 'blobsterix/helper/data_response'
|
31
34
|
require 'blobsterix/helper/murmur'
|
32
35
|
require 'blobsterix/helper/logable'
|
36
|
+
require 'blobsterix/helper/directory_list'
|
33
37
|
require 'blobsterix/helper/blob_access'
|
38
|
+
require 'blobsterix/helper/simple_proxy'
|
34
39
|
require 'blobsterix/helper/status_info'
|
35
40
|
require 'blobsterix/helper/template_renderer'
|
36
41
|
require 'blobsterix/helper/config_loader'
|
42
|
+
require 'blobsterix/helper/url_helper'
|
43
|
+
require 'blobsterix/helper/jsonizer'
|
37
44
|
|
38
45
|
#router base
|
39
46
|
require 'blobsterix/router/app_router'
|
@@ -42,6 +49,12 @@ require 'blobsterix/router/app_router'
|
|
42
49
|
require 'blobsterix/s3/s3_url_helper'
|
43
50
|
require 'blobsterix/blob/blob_url_helper'
|
44
51
|
require 'blobsterix/status/status_url_helper'
|
52
|
+
require 'blobsterix/s3/s3_auth_key_store'
|
53
|
+
require 'blobsterix/s3/s3_auth_v2_helper'
|
54
|
+
require 'blobsterix/s3/s3_auth_v2'
|
55
|
+
require 'blobsterix/s3/s3_auth_v2_query'
|
56
|
+
require 'blobsterix/s3/s3_auth_v4'
|
57
|
+
require 'blobsterix/s3/s3_auth'
|
45
58
|
|
46
59
|
#apis
|
47
60
|
require 'blobsterix/s3/s3_api'
|
@@ -86,7 +99,7 @@ module Blobsterix
|
|
86
99
|
end
|
87
100
|
|
88
101
|
def self.logger
|
89
|
-
|
102
|
+
Thread.current[:in_fiber_logger] ||= BlobsterixLogger.new((@logger||Logger.new(STDOUT)),Logable.next_id)
|
90
103
|
end
|
91
104
|
|
92
105
|
def self.storage_dir
|
@@ -150,6 +163,14 @@ module Blobsterix
|
|
150
163
|
@decrypt_trafo=obj
|
151
164
|
end
|
152
165
|
|
166
|
+
def self.secret_key_store
|
167
|
+
@secret_key_store
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.secret_key_store=(obj)
|
171
|
+
@secret_key_store=obj
|
172
|
+
end
|
173
|
+
|
153
174
|
def self.decrypt_trafo(blob_access,trafo_string,logger)
|
154
175
|
@decrypt_trafo||=lambda{|b,t,l|t}
|
155
176
|
if !trafo_string
|