activestorage_database 2.0 → 2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/app/controllers/activestorage_database/files_controller.rb +21 -19
- data/lib/activestorage_database/version.rb +1 -1
- 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: 41730c0975c58c903b03a756fa67ebaec9ae373acdd58430346fdf98f74194f0
|
4
|
+
data.tar.gz: dbfc0d6d79f743e320fe244bfa6d9e5441bdd5b9435b6eb138cc7898e7b8b0c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f8de2aa772e7123e38dc63718aac06de33883565ce4e077e33344eb6ee7d303ee42d6f9b880b1497fd48d974fe913be7cd71d8fda901b5469c0dfd024720859
|
7
|
+
data.tar.gz: 1c82f1b1c0dbb6d900a6c76762e55ed869804e909b8d85824fb515f7fd47283c64eda1dc77d45e627b1b7c7682cfd6c9e7842c6898c484b2199ac6e64dcda469
|
data/README.md
CHANGED
@@ -11,6 +11,15 @@ access to these public services.
|
|
11
11
|
This project is aimed more for those type of apps, if you store TBs of files then you should probabbly look into other solutions.
|
12
12
|
|
13
13
|
|
14
|
+
## Compatibility
|
15
|
+
|
16
|
+
Rails Version | ActiveStorageBase64 Version
|
17
|
+
--------------|-----------------------------
|
18
|
+
7 | 2.x
|
19
|
+
6 | 1.x
|
20
|
+
|
21
|
+
|
22
|
+
|
14
23
|
# How it works
|
15
24
|
|
16
25
|
Every file is stored inside the `activestorage_database_files` table as a `binary/bytea`.
|
@@ -62,3 +71,9 @@ After the setup you can work with ActiveStorge API as if it was any other `Activ
|
|
62
71
|
|
63
72
|
## License
|
64
73
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
74
|
+
|
75
|
+
## Credits
|
76
|
+
|
77
|
+
Active Storage Database is maintained by [WizardHealth](https://www.wizardhealth.co/?lang=en).
|
78
|
+
|
79
|
+
[<img src="https://s3-us-west-1.amazonaws.com/rootstrap.com/img/rs.png" width="100"/>](http://www.rootstrap.com)
|
@@ -28,28 +28,30 @@ class ActivestorageDatabase::FilesController < ActiveStorage::BaseController
|
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
31
|
-
def database_service
|
32
|
-
ActiveStorage::Blob.service
|
33
|
-
end
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
def database_service
|
33
|
+
ActiveStorage::Blob.service
|
34
|
+
end
|
38
35
|
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
def decode_verified_key
|
37
|
+
key = ActiveStorage.verifier.verified(params[:encoded_key], purpose: :blob_key)
|
38
|
+
key&.deep_symbolize_keys
|
39
|
+
end
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
disposition: disposition || DEFAULT_SEND_FILE_DISPOSITION
|
47
|
-
}
|
41
|
+
def decode_verified_token
|
42
|
+
ActiveStorage.verifier.verified(params[:encoded_token], purpose: :blob_token)
|
43
|
+
end
|
48
44
|
|
49
|
-
|
50
|
-
|
45
|
+
def serve_file(key, content_type:, disposition:)
|
46
|
+
options = {
|
47
|
+
type: content_type || DEFAULT_SEND_FILE_TYPE,
|
48
|
+
disposition: disposition || DEFAULT_SEND_FILE_DISPOSITION
|
49
|
+
}
|
51
50
|
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
send_data database_service.download(key), options
|
52
|
+
end
|
53
|
+
|
54
|
+
def acceptable_content?(token)
|
55
|
+
token[:content_type] == request.content_mime_type && token[:content_length] == request.content_length
|
56
|
+
end
|
55
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage_database
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dino Maric
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-04-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
requirements: []
|
69
|
-
rubygems_version: 3.
|
69
|
+
rubygems_version: 3.4.1
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: Store ActiveStorage attachments inside the database.
|