From ed577d039a02ad65546dd6aee8fe8677d135360f Mon Sep 17 00:00:00 2001 From: Kenzo Date: Wed, 11 Sep 2019 13:08:34 -0400 Subject: [PATCH 1/2] feat: add getIPFS --- src/3box.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/3box.js b/src/3box.js index 297ff7ac..da0ec075 100644 --- a/src/3box.js +++ b/src/3box.js @@ -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) @@ -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 () { From 45a7af3b38ab8b609ecc6fd416acffb2984c6843 Mon Sep 17 00:00:00 2001 From: Joel Torstensson Date: Wed, 11 Sep 2019 19:15:23 +0200 Subject: [PATCH 2/2] Release v1.10.10 --- README.md | 8 ++++++++ RELEASE-NOTES.md | 3 +++ package.json | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d54bcb3..62a55f0f 100644 --- a/README.md +++ b/README.md @@ -308,6 +308,7 @@ idUtils.verifyClaim(claim) * [.getVerifiedAccounts(profile)](#Box.getVerifiedAccounts) ⇒ Object * [.openBox(address, ethereumProvider, opts)](#Box.openBox) ⇒ [Box](#Box) * [.isLoggedIn(address)](#Box.isLoggedIn) ⇒ Boolean + * [.getIPFS()](#Box.getIPFS) ⇒ IPFS @@ -661,6 +662,13 @@ Check if the given address is logged in | --- | --- | --- | | address | String | An ethereum address | + + +#### Box.getIPFS() ⇒ IPFS +Instanciate ipfs used by 3Box without calling openBox. + +**Kind**: static method of [Box](#Box) +**Returns**: IPFS - the ipfs instance ### KeyValueStore diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 91820656..d0638b31 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -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) diff --git a/package.json b/package.json index baa37a8c..7e6b748e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "3box", - "version": "1.10.9", + "version": "1.10.10", "description": "Interact with user data", "main": "lib/3box.js", "directories": {