lazy_blob_storage 2.0.0.pre.beta.6 → 2.0.0.pre.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -3
- data/app/models/concerns/lazy_attachable.rb +1 -1
- data/lib/lazy_blob_storage/version.rb +1 -1
- data/lib/lazy_blob_storage.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f59d945b4c54444be929225d268159520d5ceefd47cd74f432e82c2f8c05c26c
|
4
|
+
data.tar.gz: c5092d1b0f3db7974116aa3d7041a75deae86e9c94b3395bd9609ebba38bd0f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3319925424b037dd4934322b021ef020004a10db8ba768c88a5bc0461e0a88e1a7f62f8d3598f668edbfdd10c7f16c2f2f09b8ffdc357c405a3842daf93c648
|
7
|
+
data.tar.gz: 4536667ff095869e75fa3b9cee03c59dd78481270c2a42edd3bc0ad11a9f6634a9fb04c816ba206c309343bbdae508ada8a986249579a65aa57afbc8557cab1a
|
data/README.md
CHANGED
@@ -8,15 +8,24 @@ digest to prevent duplicate blob uploads.
|
|
8
8
|
Nothing fancy. Just stores files and allows public access using the
|
9
9
|
digest as a key. Respects HTTP Cache headers.
|
10
10
|
|
11
|
-
You probably want to put a CDN/Cache/RateLimit in front of the
|
12
|
-
`"lazy_blobs#show"` route because somebody could DOS your website
|
11
|
+
You probably want to put a CDN/Cache/RateLimit in front of the
|
12
|
+
`"lazy_blobs#show"` route because somebody could DOS your website
|
13
13
|
if all your workers are serving files from the database.
|
14
14
|
|
15
|
-
Basically this is a dumb idea, but setting up AWS buckets and permissions just
|
15
|
+
Basically this is a dumb idea, but setting up AWS buckets and permissions just
|
16
16
|
to upload a dumb logo is :big_sigh_emoji:
|
17
17
|
|
18
18
|
Don't use this. I mean it.
|
19
19
|
|
20
|
+
## Alternative
|
21
|
+
|
22
|
+
I would use activestorage_database rather than lazy_blob_storage if I were starting a new project.
|
23
|
+
|
24
|
+
See:
|
25
|
+
|
26
|
+
- https://rubygems.org/gems/activestorage_database
|
27
|
+
- https://github.com/WizardComputer/activestorage_database
|
28
|
+
|
20
29
|
## Breaking Changes in 2.0.0-beta.1
|
21
30
|
|
22
31
|
- Support UUID key types
|
@@ -26,7 +26,7 @@ module LazyAttachable
|
|
26
26
|
|
27
27
|
define_method("validate_size_of_#{name}_upload") do
|
28
28
|
if (send "#{name}_upload").present? && !(send "#{name}_upload_size_ok?")
|
29
|
-
errors.add("#{name}_upload",
|
29
|
+
errors.add("#{name}_upload", LazyBlobStorage._max_blob_size_error_message)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
data/lib/lazy_blob_storage.rb
CHANGED
@@ -2,12 +2,21 @@ require "lazy_blob_storage/engine"
|
|
2
2
|
|
3
3
|
module LazyBlobStorage
|
4
4
|
mattr_accessor :max_blob_size
|
5
|
+
mattr_accessor :max_blob_size_error_message
|
5
6
|
|
6
7
|
def self.default_max_blob_size
|
7
8
|
100_000.bytes
|
8
9
|
end
|
9
10
|
|
11
|
+
def self.default_max_blob_size_error_message
|
12
|
+
"file too large (limit #{_max_blob_size / 1_000} kb)"
|
13
|
+
end
|
14
|
+
|
10
15
|
def self._max_blob_size
|
11
16
|
max_blob_size || default_max_blob_size
|
12
17
|
end
|
18
|
+
|
19
|
+
def self._max_blob_size_error_message
|
20
|
+
max_blob_size_error_message || default_max_blob_size_error_message
|
21
|
+
end
|
13
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazy_blob_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.beta.
|
4
|
+
version: 2.0.0.pre.beta.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Smedstad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: 1.3.1
|
156
156
|
requirements: []
|
157
|
-
rubygems_version: 3.4.
|
157
|
+
rubygems_version: 3.4.10
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: Low traffic site? Small file upload needs? Don't want to setup a cloud service?
|