Skip to content

Commit

Permalink
feat: ipfs-http-client -> kubo-rpc-client (#2098)
Browse files Browse the repository at this point in the history
* 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
SgtPooki and whizzzkid authored Mar 13, 2023
1 parent 4a691a2 commit 5e53c79
Show file tree
Hide file tree
Showing 17 changed files with 1,820 additions and 1,836 deletions.
2,898 changes: 1,140 additions & 1,758 deletions package-lock.json

Large diffs are not rendered by default.

31 changes: 26 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@
"i18next-browser-languagedetector": "^6.1.3",
"i18next-chained-backend": "^3.0.2",
"i18next-http-backend": "^1.3.2",
"i18next-icu": "^2.0.3",
"i18next-icu": "2.0.3",
"i18next-localstorage-backend": "^3.1.3",
"internal-nav-helper": "^3.1.0",
"intl-messageformat": "^9.11.3",
"intl-messageformat": "9.12.0",
"ip": "^1.1.5",
"ipfs-css": "^1.4.0",
"ipfs-geoip": "9.0.1",
"ipfs-http-client": "^49.0.2",
"ipfs-provider": "^2.1.0",
"ipld-explorer-components": "^2.4.1",
"ipld-explorer-components": "^3.0.3",
"is-ipfs": "^3.0.0",
"istextorbinary": "^6.0.0",
"it-all": "^1.0.5",
"it-first": "^1.0.6",
"it-last": "^1.0.5",
"it-map": "^1.0.5",
"kubo-rpc-client": "^3.0.0",
"milliseconds": "^1.0.3",
"money-clip": "^3.0.5",
"multiaddr": "^8.1.2",
Expand Down Expand Up @@ -173,7 +173,7 @@
"esm": "^3.2.25",
"fake-indexeddb": "^3.1.8",
"get-port": "^5.1.1",
"go-ipfs": "0.16.0",
"go-ipfs": "^0.18.1",
"http-proxy": "^1.18.1",
"http-server": "^0.12.3",
"ipfs": "0.58.3",
Expand All @@ -187,6 +187,7 @@
"os-browserify": "^0.3.0",
"patch-package": "^6.4.7",
"path-browserify": "^1.0.1",
"peer-id": "^0.16.0",
"playwright-chromium": "^1.27.1",
"postcss-flexbugs-fixes": "^5.0.2",
"run-script-os": "^1.1.6",
Expand Down Expand Up @@ -343,6 +344,26 @@
"overrides": [
{
"multiaddr": "8.1.2"
},
{
"ipld-explorer-components": {
"ipfs-unixfs": "^4.0.1",
"ipld": "0.29.0",
"ipld-ethereum": "6.0.0",
"ipld-git": "0.6.4",
"ipld-raw": "7.0.0",
"@ipld/dag-pb": "^2.1.17",
"milliseconds": "^1.0.3",
"multibase": "4.0.2",
"multiformats": "^9.7.0",
"multihashes": "^4.0.3",
"react-joyride": "^2.3.0",
"stream-to-it": "^0.2.4",
"@ipld/car": "^4.1.0",
"@ipld/dag-cbor": "^7.0.2",
"@ipld/dag-json": "^8.0.10",
"blockcodec-to-ipld-format": "^2.0.0"
}
}
]
}
48 changes: 48 additions & 0 deletions patches/ipld+0.29.0.patch
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)) {
Loading

0 comments on commit 5e53c79

Please sign in to comment.