var React = require('react') var ReactDOM = require('react-dom') var Router = require('react-router').Router var Route = require('react-router').Route var IndexRoute = require('react-router').IndexRoute var Redirect = require('react-router').Redirect var Link = require('react-router').Link var BoardsAPI = require('boards-api.js') // Load CSS require('normalize.css') require('skeleton.css') require('style.css') require('raleway.css') require('font-awesome.min.css') var opt, s = localStorage.getItem('ipfs-boards-settings') try { opt = JSON.parse(s) } catch(e){ // Do nothing } if(opt === null || opt === undefined) opt = { addr: 'localhost', port: 5001 } var ipfs = require('ipfs-api')(opt.addr || 'localhost',opt.port || 5001) var boards = new BoardsAPI(ipfs) // Components var Container = React.createClass({ render: function(){ return (
{this.props.children}
) } }) var App = React.createClass({ render: function(){ return (
{this.props.children}
) } }) var Navbar = React.createClass({ extraButtons: function(){ if(boards.id && boards.version){ return } else { return } }, render: function(){ return (
{this.props.children ||

Boards

}
{this.extraButtons()}
) } }) // Static pages var Static = React.createClass({ html: function(){ return { __html: this.props.content } }, render: function(){ if(this.props.content){ return
} else { return } } }) var Homepage = React.createClass({ render: function(){ return } }) var GetIPFS = React.createClass({ render: function(){ return (

Connection to IPFS not available

Sorry, but at the moment an external application is needed to try the Prototype

You don't have an IPFS node running at {opt.addr}:{opt.port} or it is not reachable

The IPFS Boards prototype requires a full IPFS node running at localhost. Please start one by following the go-ipfs documentation.

Do you have a running node but the app won't work?

It's probably one of these issues:

  • Your IPFS node doesn't allow requests from the domain you're running the app from (CORS issue). See here for the fix.
  • Your IPFS node is not listening for API requests at {opt.addr}:{opt.port}. Go to the Settings page, provide the correct address for the node, then save and reload the page.
  • Some other networking issue is preventing the App from talking to your node.

Still can't fix it? File a issue on GitHub, we'll be happy to help!

) } }) var NotFound = React.createClass({ render: function(){ return (

Sorry, there's nothing here!

) } }) var NotImplemented = React.createClass({ render: function(){ return (

Not yet implemented

Sorry, working on it!

) } }) // Start var Users = require('users.jsx')(boards) var Settings = require('settings.jsx')(boards) var Profile = require('profile.jsx')(boards) var Board = require('board.jsx')(boards) var Icon = require('icon.jsx') boards.init(err => { if(err){ console.log('FATAL: IPFS NODE NOT AVAILABLE') ReactDOM.render( , document.getElementById('root')) } else { ReactDOM.render( , document.getElementById('root') ) } })