From 348fe653130f73e5b45d341943c8baded6430159 Mon Sep 17 00:00:00 2001 From: AlexStep Date: Tue, 15 Aug 2017 18:18:02 +0200 Subject: [PATCH 1/5] Add IPFS provider options to ipscend.json, by default set the ipfs.infura.io Fix bug with hash in publish script. --- src/cli/commands/init.js | 6 ++++++ src/cli/commands/publish.js | 28 ++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/cli/commands/init.js b/src/cli/commands/init.js index 334953f..a206457 100644 --- a/src/cli/commands/init.js +++ b/src/cli/commands/init.js @@ -17,6 +17,12 @@ module.exports = Command.extend({ function bootstrap () { var config = { + provider:{ + host: 'ipfs.infura.io', + __host: 'localhost', + port: '5001', + opts: { protocol:'https' } + }, versions: [] } console.log('This utility will walk you through creating a ipscend.json file.') diff --git a/src/cli/commands/publish.js b/src/cli/commands/publish.js index 4741039..611c2fb 100644 --- a/src/cli/commands/publish.js +++ b/src/cli/commands/publish.js @@ -20,7 +20,12 @@ module.exports = Command.extend({ function publish () { const config = require(configPath) - const ipfs = ipfsAPI('localhost', '5001') + + let host = config.provider.host || 'ipfs.infura.io' + let port = config.provider.port || '5001' + let opts = config.provider.opts || { protocol:'https' } + + const ipfs = ipfsAPI(host, port, opts) ipfs.util.addFromFs(config.path, { recursive: true, @@ -30,9 +35,17 @@ module.exports = Command.extend({ return console.error('err', err) } + console.log() + console.log('Uploaded files:') console.log(res) - - const hash = res[res.length - 2].hash + console.log() + console.log() + let hash = '' + for(let k in res){ + if (res[k].path==config.path) { + hash = res[k].hash + } + } const duplicate = config.versions.filter(function (v) { return v.hash === hash @@ -40,6 +53,8 @@ module.exports = Command.extend({ if (duplicate) { console.log('This version (' + duplicate.hash + ') has already been published on:', duplicate.timestamp) + console.log('You can access it by url http://ipfs.io/ipfs/' + duplicate.hash) + console.log() return } @@ -50,8 +65,13 @@ module.exports = Command.extend({ console.log('Published', config.path, 'with the following hash:', version.hash) console.log('You can access it through your local node or through a public IPFS gateway:') - console.log('http://localhost:8080/ipfs/' + version.hash) + + if (config.provider.host=='localhost') { + console.log('http://'+config.provider.host+':8080/ipfs/' + version.hash) + } + console.log('http://ipfs.io/ipfs/' + version.hash) + console.log() config.versions.push(version) From 42b84e27b980758730b66ec9c8eb4ff715c9f07b Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 19 Aug 2017 14:33:43 +0200 Subject: [PATCH 2/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e5af31..4363464 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ipscend Install via npm ``` -$ npm install ipscend --global +$ npm install alexstep/ipscend --global ``` Run the CLI to show the available commands From d654f4e60c00df58266054b707bc91a227997cc3 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 19 Aug 2017 23:01:43 +0200 Subject: [PATCH 3/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4363464..849c249 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ ipscend > Web Application publishing, simple and distributed with IPFS ## Usage +[![how2deploy](https://img.youtube.com/vi/_GE3t6XzfBk/0.jpg)](https://www.youtube.com/watch?v=_GE3t6XzfBk) + Install via npm From 78571738e02ee7616e2f502a47ac6c3757bc5df5 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 14 Oct 2017 13:52:00 +0200 Subject: [PATCH 4/5] Change provider url --- src/cli/commands/publish.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/commands/publish.js b/src/cli/commands/publish.js index 611c2fb..fc7d834 100644 --- a/src/cli/commands/publish.js +++ b/src/cli/commands/publish.js @@ -70,7 +70,9 @@ module.exports = Command.extend({ console.log('http://'+config.provider.host+':8080/ipfs/' + version.hash) } - console.log('http://ipfs.io/ipfs/' + version.hash) + console.log('https://ipfs.io/ipfs/' + version.hash) + console.log(' OR ') + console.log('https://ipfs.infura.io/ipfs/' + version.hash) console.log() config.versions.push(version) From 8efa85e67e547566136c431ea79bf7678dae8c5e Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 14 Oct 2017 13:56:19 +0200 Subject: [PATCH 5/5] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c1c66ba..b412b06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipscend", - "version": "0.4.3", + "version": "0.4.4", "description": "Web Application publishing made simple and distributed with IPFS ", "bin": { "ipscend": "src/cli/bin.js",