-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ipfs-http-client -> kubo-rpc-client (#2098)
* feat!: ipfs-http-client -> kubo-rpc-client fix: error rendering peerId fix: peers table on peerspage fix: statusPage -> advanced -> addresses fix: most e2e tests working with kubo-rpc-client chore: update to go-ipfsv0.18.1 * chore: fix key.gen with patch needed until kubo-rpc-client fix is merged see ipfs/js-kubo-rpc-client#143 see ipfs/js-kubo-rpc-client#145 * fix: use ipld-explorer-components patch temporarily see https://github.com/ipfs/ipfs-webui/issues/2079\#issuecomment-1426219633 see #2079 (comment) must use until ipfs/ipld-explorer-components#356 * chore: fix ipld-explorer-components patch not needed once ipfs/ipld-explorer-components#356 is merged * test: add tests to explore.test.js * tmp: trying to navigate the undocumented world of parsing CIDs * chore: working on getting tests fully tied up * test(e2e): finish updating explore.test.js * chore: lint fixes * chore: remove debugging code * test: test clicking children links on explore page * tmp: fix children explore views * test: e2e explore test traverses children * Update test/e2e/explore.test.js Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com> * chore: address PR comments --------- Co-authored-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
- Loading branch information
Showing
17 changed files
with
1,820 additions
and
1,836 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
diff --git a/node_modules/ipld/src/index.js b/node_modules/ipld/src/index.js | ||
index 12b046f..1ae185b 100644 | ||
--- a/node_modules/ipld/src/index.js | ||
+++ b/node_modules/ipld/src/index.js | ||
@@ -2,6 +2,7 @@ | ||
|
||
const Block = require('ipld-block') | ||
const CID = require('cids') | ||
+const {CID: newCID} = require('multiformats/cid') | ||
const mergeOptions = require('merge-options') | ||
const ipldDagCbor = require('ipld-dag-cbor') | ||
const ipldDagPb = require('ipld-dag-pb') | ||
@@ -96,7 +97,7 @@ class IPLDResolver { | ||
* @param {ResolveOptions} [options] | ||
*/ | ||
resolve (cid, path, options) { | ||
- if (!CID.isCID(cid)) { | ||
+ if (!CID.isCID(cid) && newCID.asCID(cid) == null) { | ||
throw new Error('`cid` argument must be a CID') | ||
} | ||
if (typeof path !== 'string') { | ||
@@ -108,7 +109,7 @@ class IPLDResolver { | ||
const generator = async function * () { | ||
// End iteration if there isn't a CID to follow any more | ||
while (true) { | ||
- const format = await ipld.getFormat(multicodec.getCodeFromName(cid.codec)) | ||
+ const format = await ipld.getFormat(cid.code ?? multicodec.getCodeFromName(cid.codec)) | ||
|
||
// get block | ||
// use local resolver | ||
@@ -153,7 +154,7 @@ class IPLDResolver { | ||
*/ | ||
async get (cid, options) { | ||
const block = await this.bs.get(cid, options) | ||
- const format = await this.getFormat(block.cid.codec) | ||
+ const format = await this.getFormat(block.cid.code ?? block.cid.codec) | ||
const node = format.util.deserialize(block.data) | ||
|
||
return node | ||
@@ -332,7 +333,7 @@ class IPLDResolver { | ||
*/ | ||
const maybeRecurse = async (block, treePath) => { | ||
// A treepath we might want to follow recursively | ||
- const format = await this.getFormat(multicodec.getCodeFromName(block.cid.codec)) | ||
+ const format = await this.getFormat(multicodec.getCodeFromName(block.cid.code ?? block.cid.codec)) | ||
const result = format.resolver.resolve(block.data, treePath) | ||
// Something to follow recursively, hence push it into the queue | ||
if (CID.isCID(result.value)) { |
Oops, something went wrong.