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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fa7b57feb6093ab0bb2d10ee4fac66829699f02ab1ef3ec49299ba6ae0ad8ca
4
- data.tar.gz: f29f8e16e2c3f445bedfba0984ca7775ff04f584a4749ec92ddf7153a2c3d1d9
3
+ metadata.gz: 41730c0975c58c903b03a756fa67ebaec9ae373acdd58430346fdf98f74194f0
4
+ data.tar.gz: dbfc0d6d79f743e320fe244bfa6d9e5441bdd5b9435b6eb138cc7898e7b8b0c8
5
5
  SHA512:
6
- metadata.gz: b163055124e6fd50d9d6546a0cb92d967541afd0d19b0d31bcff8ac0a2051cc0939bd8082b1ff2ab98b82d4abfc461e87a0d62f14642719804c0deac3b9caf6a
7
- data.tar.gz: 93ba877681b403de773931c412c184f2c463e5d9595f6dc2c3af628bb47a40bb2594c7a2db4f437c7abd7647097e3316b65da2bd5f3dd1707dbff35dffe3fbc0
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
- def decode_verified_key
36
- ActiveStorage.verifier.verified(params[:encoded_key], purpose: :blob_key)
37
- end
32
+ def database_service
33
+ ActiveStorage::Blob.service
34
+ end
38
35
 
39
- def decode_verified_token
40
- ActiveStorage.verifier.verified(params[:encoded_token], purpose: :blob_token)
41
- end
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
- def serve_file(key, content_type:, disposition:)
44
- options = {
45
- type: content_type || DEFAULT_SEND_FILE_TYPE,
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
- send_data database_service.download(key), options
50
- end
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
- def acceptable_content?(token)
53
- token[:content_type] == request.content_mime_type && token[:content_length] == request.content_length
54
- end
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
@@ -1,3 +1,3 @@
1
1
  module ActivestorageDatabase
2
- VERSION = "2.0"
2
+ VERSION = "2.1"
3
3
  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.0'
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: 2022-02-18 00:00:00.000000000 Z
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.2.22
69
+ rubygems_version: 3.4.1
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: Store ActiveStorage attachments inside the database.