Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into add-http-dag-api
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Mar 18, 2019
2 parents 147e5a6 + e38b81d commit 98414f1
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 64 deletions.
2 changes: 1 addition & 1 deletion ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ One of following:
This is for you! Please read, and then delete this text before posting it.
The js-ipfs issues are only for bug reports and directly actionable features.
Read https://github.com/ipfs/community/blob/master/contributing.md#reporting-issues if your issue doesn't fit either of those categories.
Read https://github.com/ipfs/community/blob/master/CONTRIBUTING.md#reporting-issues if your issue doesn't fit either of those categories.
-->
66 changes: 33 additions & 33 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/browser-create-react-app/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "IPFS React App",
"name": "IPFS Create React App Example",
"icons": [
{
"src": "favicon.ico",
Expand Down
18 changes: 9 additions & 9 deletions examples/browser-create-react-app/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import useIpfs from './hooks/use-ipfs.js'
import logo from './ipfs-logo.svg'

const App = () => {
const { ipfs, ipfsInitError } = useIpfsFactory({commands: ['id']})
const { ipfs, ipfsInitError } = useIpfsFactory({ commands: ['id'] })
const id = useIpfs(ipfs, 'id')
return (
<div className='sans-serif'>
<header className="flex items-center pa3 bg-navy bb bw3 b--aqua">
<a href="https://ipfs.io" title="home">
<img alt="IPFS logo" src={logo} style={{ height: 50 }} className='v-top' />
<header className='flex items-center pa3 bg-navy bb bw3 b--aqua'>
<a href='https://ipfs.io' title='home'>
<img alt='IPFS logo' src={logo} style={{ height: 50 }} className='v-top' />
</a>
<h1 className="flex-auto ma0 tr f3 fw2 montserrat aqua">IPFS React</h1>
<h1 className='flex-auto ma0 tr f3 fw2 montserrat aqua'>IPFS React</h1>
</header>
<main>
{ipfsInitError && (
Expand All @@ -26,20 +26,20 @@ const App = () => {
)
}

const Title = ({children}) => {
const Title = ({ children }) => {
return (
<h2 className="f5 ma0 pb2 tracked aqua fw4 montserrat">{children}</h2>
<h2 className='f5 ma0 pb2 tracked aqua fw4 montserrat'>{children}</h2>
)
}

const IpfsId = (props) => {
if (!props) return null
if (!props) return null
return (
<section className='bg-snow mw7 center mt5'>
<h1 className='f3 fw4 ma0 pv3 aqua montserrat tc'>Connected to IPFS</h1>
<div className='pa4'>
{['id', 'agentVersion'].map((key) => (
<div className="mb4" key={key}>
<div className='mb4' key={key}>
<Title>{key}</Title>
<div className='bg-white pa2 br2 truncate monospace'>{props[key]}</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/browser-create-react-app/src/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<App />, div)
ReactDOM.unmountComponentAtNode(div)
});
})
12 changes: 5 additions & 7 deletions examples/browser-create-react-app/src/hooks/use-ipfs-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ let ipfs = null
* so use-ipfs calls can grab it from there rather than expecting
* it to be passed in.
*/
export default function useIpfsFactory ({commands}) {
const [isIpfsReady, setIpfsReady] = useState(!!ipfs)
export default function useIpfsFactory ({ commands }) {
const [isIpfsReady, setIpfsReady] = useState(Boolean(ipfs))
const [ipfsInitError, setIpfsInitError] = useState(null)

useEffect(() => {
Expand All @@ -34,11 +34,9 @@ export default function useIpfsFactory ({commands}) {
async function startIpfs () {
if (ipfs) {
console.log('IPFS already started')

} else if (window.ipfs && window.ipfs.enable) {
console.log('Found window.ipfs')
ipfs = await window.ipfs.enable({commands})

ipfs = await window.ipfs.enable({ commands })
} else {
try {
console.time('IPFS Started')
Expand All @@ -51,10 +49,10 @@ export default function useIpfsFactory ({commands}) {
}
}

setIpfsReady(!!ipfs)
setIpfsReady(Boolean(ipfs))
}

return {ipfs, isIpfsReady, ipfsInitError}
return { ipfs, isIpfsReady, ipfsInitError }
}

function promiseMeJsIpfs (Ipfs, opts) {
Expand Down
6 changes: 3 additions & 3 deletions package-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Package",
"Version",
"Deps",
"CI",
"CI/Travis",
"Coverage",
"Lead Maintainer"
],
Expand All @@ -30,7 +30,7 @@
["libp2p/js-libp2p-kad-dht", "libp2p-kad-dht"],
["libp2p/js-libp2p-mdns", "libp2p-mdns"],
["libp2p/js-libp2p-mplex", "libp2p-mplex"],
["libp2p/js-libp2p-railing", "libp2p-railing"],
["libp2p/js-libp2p-bootstrap", "libp2p-bootstrap"],
["libp2p/js-libp2p-secio", "libp2p-secio"],
["libp2p/js-libp2p-tcp", "libp2p-tcp"],
["libp2p/js-libp2p-webrtc-star", "libp2p-webrtc-star"],
Expand All @@ -51,7 +51,7 @@

"Generics/Utils",
["ipfs/js-ipfs-http-client", "ipfs-http-client"],
["ipfs/ipfs-multipart", "ipfs-multipart"],
["ipfs/js-ipfs-multipart", "ipfs-multipart"],
["ipfs/is-ipfs", "is-ipfs"],
["multiformats/js-multihashing", "multihashing"],
["multiformats/js-mafmt", "mafmt"]
Expand Down
5 changes: 2 additions & 3 deletions src/core/components/files-regular/cat-pull-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ module.exports = function (self) {

ipfsPath = normalizePath(ipfsPath)
const pathComponents = ipfsPath.split('/')
const restPath = normalizePath(pathComponents.slice(1).join('/'))
const filterFile = (file) => (restPath && file.path === restPath) || (file.path === ipfsPath)
const fileNameOrHash = pathComponents[pathComponents.length - 1]

if (options.preload !== false) {
self._preload(pathComponents[0])
Expand All @@ -26,7 +25,7 @@ module.exports = function (self) {

pull(
exporter(ipfsPath, self._ipld, options),
pull.filter(filterFile),
pull.filter(file => file.path === fileNameOrHash),
pull.take(1),
pull.collect((err, files) => {
if (err) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/runtime/config-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module.exports = () => ({
],
Swarm: {
ConnMgr: {
LowWater: 600,
HighWater: 900
LowWater: 200,
HighWater: 500
}
}
})
4 changes: 2 additions & 2 deletions src/core/runtime/config-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ module.exports = () => ({
],
Swarm: {
ConnMgr: {
LowWater: 600,
HighWater: 900
LowWater: 200,
HighWater: 500
}
}
})
2 changes: 1 addition & 1 deletion src/http/api/routes/webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = [
method: '*',
path: '/webui',
handler (request, h) {
return h.redirect('/ipfs/QmXc9raDM1M5G5fpBnVyQ71vR4gbnskwnB9iMEzBuLgvoZ')
return h.redirect('/ipfs/QmZepbAvvUvCqKmNjgf3dStoSToXCW9uQopx4vd2HFMELR')
}
}
]

0 comments on commit 98414f1

Please sign in to comment.