mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-03-12 21:48:39 +01:00
can now handle a missing connection to go-ipfs
This commit is contained in:
parent
5de28bc0d2
commit
6c377ff54e
@ -68,7 +68,7 @@ BoardsAPI.prototype.resolveIPNS = function(n,handler){
|
|||||||
this.ipfs.name.resolve(n,(err,r) => {
|
this.ipfs.name.resolve(n,(err,r) => {
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
console.log('Launching automatic check for IPNS address',n)
|
console.log('Launching automatic check for IPNS address',n)
|
||||||
this.prototype.resolveIPNS(n)
|
this.resolveIPNS(n)
|
||||||
},20*1000)
|
},20*1000)
|
||||||
if(!err) console.log('Resolved',n,'to',r.Path)
|
if(!err) console.log('Resolved',n,'to',r.Path)
|
||||||
if(err){
|
if(err){
|
||||||
|
@ -9,9 +9,6 @@ var ipfs = require('ipfs-api')('localhost',5001)
|
|||||||
var BoardsAPI = require('../lib/boards-api.js')
|
var BoardsAPI = require('../lib/boards-api.js')
|
||||||
|
|
||||||
var boards = new BoardsAPI(ipfs)
|
var boards = new BoardsAPI(ipfs)
|
||||||
boards.init(_ => {
|
|
||||||
console.log('Boards init complete')
|
|
||||||
})
|
|
||||||
|
|
||||||
var Container = React.createClass({
|
var Container = React.createClass({
|
||||||
render: function(){
|
render: function(){
|
||||||
@ -160,14 +157,39 @@ var Board = React.createClass({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ReactDOM.render(
|
var GetIPFS = React.createClass({
|
||||||
<Router>
|
render: function(){
|
||||||
<Route path="/" component={App}>
|
return (
|
||||||
<IndexRoute component={Homepage} />
|
<div className="text-center">
|
||||||
<Route path="/@:userid">
|
<h1>Missing IPFS Node</h1>
|
||||||
<IndexRoute component={Profile} />
|
<p>You don't have an IPFS node running at <code>localhost:5001</code>
|
||||||
<Route path=":boardname" component={Board}/>
|
or it is not reachable</p>
|
||||||
</Route>
|
<p>The IPFS Boards prototype requires a full IPFS node running at localhost.
|
||||||
</Route>
|
Please start one by following the
|
||||||
</Router>, document.getElementById('root')
|
<a href="https://github.com/ipfs/go-ipfs"><code>go-ipfs</code> documentation.</a></p>
|
||||||
)
|
<p>If you have a running node but still this doesn't work, it's probably a CORS issue</p>
|
||||||
|
<p>You can find out how to fix CORS issues related to this app <a href="https://github.com/fazo96/ipfs-board/blob/master/ipfs_daemon_set_cors.sh">here</a>.</p>
|
||||||
|
<p>Still can't fix it? <a href="https://github.com/fazo96/ipfs-board/issues">File a issue on GitHub</a>, we'll be happy to help!</p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
boards.init(err => {
|
||||||
|
if(err){
|
||||||
|
console.log('FATAL: IPFS NODE NOT AVAILABLE')
|
||||||
|
ReactDOM.render(<App><GetIPFS/></App>, document.getElementById('root'))
|
||||||
|
} else {
|
||||||
|
ReactDOM.render(
|
||||||
|
<Router>
|
||||||
|
<Route path="/" component={App}>
|
||||||
|
<IndexRoute component={Homepage} />
|
||||||
|
<Route path="/@:userid">
|
||||||
|
<IndexRoute component={Profile} />
|
||||||
|
<Route path=":boardname" component={Board}/>
|
||||||
|
</Route>
|
||||||
|
</Route>
|
||||||
|
</Router>, document.getElementById('root')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
top: 20%;
|
top: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-center {
|
||||||
|
text-align: center
|
||||||
|
}
|
||||||
|
|
||||||
.light {
|
.light {
|
||||||
color: #ababab
|
color: #ababab
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user