diff --git a/README.md b/README.md index 4e5af31..849c249 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,13 @@ 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 ``` -$ npm install ipscend --global +$ npm install alexstep/ipscend --global ``` Run the CLI to show the available commands 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", 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..fc7d834 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,15 @@ 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) - console.log('http://ipfs.io/ipfs/' + version.hash) + + if (config.provider.host=='localhost') { + console.log('http://'+config.provider.host+':8080/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)