Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Râu Cao | 0a21c57251 | |
Râu Cao | 1401adbf0c | |
Râu Cao | 2401d8dff2 |
13
index.js
13
index.js
|
@ -50,15 +50,22 @@ debug(`IPFS node:`, ipfsConfig);
|
||||||
|
|
||||||
// TODO redesign IPFS wrapper API and do not use an internal attribute
|
// TODO redesign IPFS wrapper API and do not use an internal attribute
|
||||||
const ipfsApi = kredits.ipfs._ipfsAPI;
|
const ipfsApi = kredits.ipfs._ipfsAPI;
|
||||||
|
let connectBootstrapNode = true;
|
||||||
|
|
||||||
await ipfsApi.id().catch(e => {
|
await ipfsApi.id().then(res => {
|
||||||
|
if (res.id === argv.bootstrapNode.split('/')[argv.bootstrapNode.split('/').length-1]) {
|
||||||
|
connectBootstrapNode = false;
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
console.log('Failed to initialize IPFS:');
|
console.log('Failed to initialize IPFS:');
|
||||||
console.log(e.message);
|
console.log(e.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
debug(`Connecting to known IPFS node ${argv.bootstrapNode}`);
|
if (connectBootstrapNode) {
|
||||||
await ipfsApi.swarm.connect(argv.bootstrapNode);
|
debug(`Connecting to known IPFS node ${argv.bootstrapNode}`);
|
||||||
|
await ipfsApi.swarm.connect(argv.bootstrapNode);
|
||||||
|
}
|
||||||
|
|
||||||
const ipfsPinner = new IpfsPinner(kredits, {
|
const ipfsPinner = new IpfsPinner(kredits, {
|
||||||
progress: argv.progress
|
progress: argv.progress
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@kredits/ipfs-pinner",
|
"name": "@kredits/ipfs-pinner",
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@kredits/ipfs-pinner",
|
"name": "@kredits/ipfs-pinner",
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kredits/contracts": "^7.0.0",
|
"@kredits/contracts": "^7.0.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@kredits/ipfs-pinner",
|
"name": "@kredits/ipfs-pinner",
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"description": "Pins IPFS data of a Kredits organization on an IPFS node",
|
"description": "Pins IPFS data of a Kredits organization on an IPFS node",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue