File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
import getIpfsWithConfig from "get-ipfs" ;
2
- import { FissionUser } from "@fission-suite/client" ;
2
+ import { pin } from "@fission-suite/client" ;
3
3
4
4
const ipfsProvider =
5
5
process . env . REACT_APP_INTERPLANETARY_FISSION_URL || "https://hostless.dev" ;
6
6
const username = process . env . REACT_APP_INTERPLANETARY_FISSION_USERNAME ;
7
7
const password = process . env . REACT_APP_INTERPLANETARY_FISSION_PASSWORD ;
8
8
const bootstrapNode = process . env . REACT_APP_BOOTSTRAP_NODE ;
9
- const fission = new FissionUser ( username , password , ipfsProvider ) ;
10
9
11
10
export const DefaultCid = "QmUMQ5Zxu94gwGq96hGEBc2hzoMkywUctbySw7YY6g8ktw" ;
12
11
13
12
const getIpfs = async ( ) => {
13
+ if ( bootstrapNode ) {
14
+ return getIpfsWithConfig ( {
15
+ bootstrap : [ bootstrapNode ]
16
+ } ) ;
17
+ }
14
18
return getIpfsWithConfig ( ) ;
15
- const ipfs = await getIpfsWithConfig ( {
16
- bootstrap : [ bootstrapNode ]
17
- } ) ;
18
19
} ;
19
20
20
21
export const validPreferences = preferences => {
@@ -68,7 +69,9 @@ export const savePreferences = async preferences => {
68
69
throw new Error ( "Could not parse CID" ) ;
69
70
}
70
71
try {
71
- await fission . pin ( cid ) ;
72
+ if ( username && password && ipfsProvider ) {
73
+ await pin ( cid , { username, password } , ipfsProvider ) ;
74
+ }
72
75
} catch ( err ) {
73
76
console . error ( err ) ;
74
77
}
You can’t perform that action at this time.
0 commit comments