Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #591 from 3box/release/1.10.10
Browse files Browse the repository at this point in the history
Release/1.10.10
  • Loading branch information
oed authored Sep 12, 2019
2 parents 2cf854a + 45a7af3 commit a6af9ad
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ idUtils.verifyClaim(claim)
* [.getVerifiedAccounts(profile)](#Box.getVerifiedAccounts) ⇒ <code>Object</code>
* [.openBox(address, ethereumProvider, opts)](#Box.openBox) ⇒ [<code>Box</code>](#Box)
* [.isLoggedIn(address)](#Box.isLoggedIn) ⇒ <code>Boolean</code>
* [.getIPFS()](#Box.getIPFS) ⇒ <code>IPFS</code>
<a name="new_Box_new"></a>
Expand Down Expand Up @@ -661,6 +662,13 @@ Check if the given address is logged in
| --- | --- | --- |
| address | <code>String</code> | An ethereum address |
<a name="Box.getIPFS"></a>
#### Box.getIPFS() ⇒ <code>IPFS</code>
Instanciate ipfs used by 3Box without calling openBox.
**Kind**: static method of [<code>Box</code>](#Box)
**Returns**: <code>IPFS</code> - the ipfs instance
<a name="KeyValueStore"></a>
### KeyValueStore
Expand Down
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes

## v1.10.10 - 2019-09-12
* feat: add method to get ipfs instance without openBox

## v1.10.9 - 2019-09-10
* fix: allow multiple tab connections (support)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "3box",
"version": "1.10.9",
"version": "1.10.10",
"description": "Interact with user data",
"main": "lib/3box.js",
"directories": {
Expand Down
16 changes: 14 additions & 2 deletions src/3box.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ class Box {
*/
static async openBox (address, ethereumProvider, opts = {}) {
// opts = Object.assign({ iframeStore: true }, opts)
const ipfs = globalIPFS || await initIPFS(opts.ipfs, opts.iframeStore, opts.ipfsOptions)
globalIPFS = ipfs
const ipfs = await Box.getIPFS(opts)
const _3id = await ThreeId.getIdFromEthAddress(address, ethereumProvider, ipfs, opts)
const box = new Box(_3id, ethereumProvider, ipfs, opts)
await box._load(opts)
Expand Down Expand Up @@ -723,6 +722,19 @@ class Box {
static isLoggedIn (address) {
return ThreeId.isLoggedIn(address)
}

/**
* Instanciate ipfs used by 3Box without calling openBox.
*
* @return {IPFS} the ipfs instance
*/
static async getIPFS (opts = {}) {
const ipfs = globalIPFS || await initIPFS(opts.ipfs, opts.iframeStore, opts.ipfsOptions)
globalIPFS = ipfs
const pinningNode = opts.pinningNode || PINNING_NODE
ipfs.swarm.connect(pinningNode, () => {})
return ipfs
}
}

function initIPFSRepo () {
Expand Down

0 comments on commit a6af9ad

Please sign in to comment.