activestorage-nft 0.0.2 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -8
- data/README.md +6 -3
- data/activestorage-nft.gemspec +0 -1
- data/lib/active_storage/service/nft_service.rb +9 -2
- data/lib/active_storage/service/version.rb +1 -1
- data/lib/nft/client.rb +4 -0
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab1a36e3bb148bc264d1dd3ab814b245bd3a384af71ac177b2198a037cd53358
|
4
|
+
data.tar.gz: 9261e5eaa8b46e8b482ab6dd2cd3c07bf57c0de1d1844526b221b60355a785f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87af091394323642b27b47c5de5a1e03243a337b1417ed2b9ec1c9bd6601c3de56d4c26368cb8cf90abb5ba082e87afee3b1de00c48c79d06111c85fb21ffe44
|
7
|
+
data.tar.gz: 564d0deae594ad96c8b46d02ef446e2379fa86b5a63a62dbabecbff6f691489164ff8f6db455d2ec8bb5f9de195a02182b047e213681eec4093c340d1d1a47e4
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activestorage-nft (0.0.
|
4
|
+
activestorage-nft (0.0.6)
|
5
5
|
http (~> 4.3)
|
6
|
-
nft_storage (~> 1.0.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -13,8 +12,6 @@ GEM
|
|
13
12
|
diff-lcs (1.3)
|
14
13
|
domain_name (0.5.20190701)
|
15
14
|
unf (>= 0.0.5, < 1.0.0)
|
16
|
-
ethon (0.15.0)
|
17
|
-
ffi (>= 1.15.0)
|
18
15
|
ffi (1.15.4)
|
19
16
|
ffi-compiler (1.0.1)
|
20
17
|
ffi (>= 1.0.0)
|
@@ -29,8 +26,6 @@ GEM
|
|
29
26
|
http-form_data (2.3.0)
|
30
27
|
http-parser (1.2.3)
|
31
28
|
ffi-compiler (>= 1.0, < 2.0)
|
32
|
-
nft_storage (1.0.0)
|
33
|
-
typhoeus (~> 1.0, >= 1.0.1)
|
34
29
|
public_suffix (4.0.6)
|
35
30
|
rake (12.3.3)
|
36
31
|
rspec (3.9.0)
|
@@ -46,8 +41,6 @@ GEM
|
|
46
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
42
|
rspec-support (~> 3.9.0)
|
48
43
|
rspec-support (3.9.3)
|
49
|
-
typhoeus (1.4.0)
|
50
|
-
ethon (>= 0.9.0)
|
51
44
|
unf (0.1.4)
|
52
45
|
unf_ext
|
53
46
|
unf_ext (0.0.8)
|
data/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# Activestorage::Nft
|
2
2
|
|
3
|
-
|
4
|
-
[NFT.storage](https://nft.storage).
|
3
|
+
ActiveStorage adapter for [NFT.storage](https://nft.storage).
|
5
4
|
|
6
|
-
|
5
|
+
Uploaded files are automatically pinned on the pinata.cloud IPFS pinning service, courtesey of [Protocol Labs](https://protocol.ai).
|
6
|
+
|
7
|
+
## Note on uniqueness
|
8
|
+
|
9
|
+
When uploading a file that already exists (same content hash), an `ActiveRecord::RecordNotUnique` exception will be raised.
|
7
10
|
|
8
11
|
## Installation
|
9
12
|
|
data/activestorage-nft.gemspec
CHANGED
@@ -14,8 +14,7 @@ module ActiveStorage
|
|
14
14
|
def upload(key, io, checksum: nil, **)
|
15
15
|
instrument :upload, key: key, checksum: checksum do
|
16
16
|
cid_key = @client.add io.path
|
17
|
-
|
18
|
-
Blob.find_by_key(key).update key: cid_key
|
17
|
+
blob = Blob.find_by_key(key).update!(key: cid_key)
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
@@ -37,6 +36,14 @@ module ActiveStorage
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
39
|
+
def delete_prefixed(key)
|
40
|
+
# haha, no
|
41
|
+
end
|
42
|
+
|
43
|
+
def delete(key)
|
44
|
+
# nope
|
45
|
+
end
|
46
|
+
|
40
47
|
def url(key, content_type: nil, filename: nil, expires_in: nil, disposition: nil)
|
41
48
|
instrument :url, key: key do
|
42
49
|
@client.build_file_url key, filename.to_s
|
data/lib/nft/client.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-nft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Buhrmester
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.3'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: nft_storage
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0.0
|
41
27
|
description: A ActiveStorage Service
|
42
28
|
email:
|
43
29
|
- stefan@moogical.dev
|