Skip to content

Commit

Permalink
feat(gateway): human error pages, dag-cbor/dag-json preview
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed May 31, 2023
1 parent 4019d94 commit 7c3d79e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
13 changes: 13 additions & 0 deletions docs/changelogs/v0.21.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Saving previously seen nodes for later bootstrapping](#saving-previously-seen-nodes-for-later-bootstrapping)
- [`Gateway.DeserializedResponses` config flag](#gatewaydeserializedresponses-config-flag)
- [`client/rpc` migration of go-ipfs-http-client](#clientrpc-migration-of-go-ipfs-http-client)
- [DAG-CBOR/-JSON previews and improved error pages](#dag-cbor-json-previews-and-improved-error-pages)
- [📝 Changelog](#-changelog)
- [👨‍👩‍👧‍👦 Contributors](#-contributors)

Expand Down Expand Up @@ -68,6 +69,18 @@ version.

**TODO(@Jorropo)**: add link to `boxo-migrate` once support for rewriting this import path has been added

#### DAG-CBOR/-JSON previews and improved error pages

In this release, we improved the templates of our gateway in two main aspects:

1. You can now preview the contents of a DAG-CBOR and DAG-JSON document from your browser, as well as follow any links contained within them.
2. The directory listings now contain updated, higher-definition icons.
3. Instead of a plain text error message, you will now get a more human readable page with more details regarding the error.

| Error Page | DAG-CBOR Preview |
| --- | --- |
| ![Error Page](https://github.com/ipfs/boxo/assets/5447088/14c453df-adbc-4634-b038-133121914550) | ![DAG-CBOR Preview](https://github.com/ipfs/boxo/assets/5447088/973f05d1-5731-4469-9da5-d1d776891899) |

### 📝 Changelog

### 👨‍👩‍👧‍👦 Contributors
2 changes: 1 addition & 1 deletion docs/examples/kubo-as-a-library/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go 1.18
replace github.com/ipfs/kubo => ./../../..

require (
github.com/ipfs/boxo v0.8.2-0.20230530175401-c23df3837fbe
github.com/ipfs/boxo v0.8.2-0.20230531080213-946d2c5025f6
github.com/ipfs/kubo v0.0.0-00010101000000-000000000000
github.com/libp2p/go-libp2p v0.27.3
github.com/multiformats/go-multiaddr v0.9.0
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/kubo-as-a-library/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/boxo v0.8.2-0.20230530175401-c23df3837fbe h1:H6ETX0d5BiNTd1XIK8VARmEn0hpYpYdKKKp3rUJBLjY=
github.com/ipfs/boxo v0.8.2-0.20230530175401-c23df3837fbe/go.mod h1:Ej2r08Z4VIaFKqY08UXMNhwcLf6VekHhK8c+KqA1B9Y=
github.com/ipfs/boxo v0.8.2-0.20230531080213-946d2c5025f6 h1:lrKC/W00qTUNn6YYKJmSMOcwk7LBtoQnNiHhywPr6rY=
github.com/ipfs/boxo v0.8.2-0.20230531080213-946d2c5025f6/go.mod h1:Ej2r08Z4VIaFKqY08UXMNhwcLf6VekHhK8c+KqA1B9Y=
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/gogo/protobuf v1.3.2
github.com/google/uuid v1.3.0
github.com/hashicorp/go-multierror v1.1.1
github.com/ipfs/boxo v0.8.2-0.20230530175401-c23df3837fbe
github.com/ipfs/boxo v0.8.2-0.20230531080213-946d2c5025f6
github.com/ipfs/go-block-format v0.1.2
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-cidutil v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/boxo v0.8.2-0.20230530175401-c23df3837fbe h1:H6ETX0d5BiNTd1XIK8VARmEn0hpYpYdKKKp3rUJBLjY=
github.com/ipfs/boxo v0.8.2-0.20230530175401-c23df3837fbe/go.mod h1:Ej2r08Z4VIaFKqY08UXMNhwcLf6VekHhK8c+KqA1B9Y=
github.com/ipfs/boxo v0.8.2-0.20230531080213-946d2c5025f6 h1:lrKC/W00qTUNn6YYKJmSMOcwk7LBtoQnNiHhywPr6rY=
github.com/ipfs/boxo v0.8.2-0.20230531080213-946d2c5025f6/go.mod h1:Ej2r08Z4VIaFKqY08UXMNhwcLf6VekHhK8c+KqA1B9Y=
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
Expand Down
4 changes: 2 additions & 2 deletions test/sharness/t0123-gateway-json-cbor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ test_native_dag () {
# As this is generated, we don't return immutable Cache-Control, even on /ipfs (same as for dir-index-html)

test_expect_success "GET $name on /ipfs with Accept: text/html returns HTML (dag-index-html)" '
curl -sD - -H "Accept: text/html" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID" > curl_output 2>&1 &&
curl -sD - -H "Accept: text/html" "http://127.0.0.1:$GWAY_PORT/ipfs/$CID/" > curl_output 2>&1 &&
test_should_not_contain "Content-Disposition" curl_output &&
test_should_not_contain "Cache-Control" curl_output &&
test_should_contain "Etag: \"DagIndex-" curl_output &&
Expand All @@ -358,7 +358,7 @@ test_native_dag () {
'

test_expect_success "GET $name on /ipns with Accept: text/html returns HTML (dag-index-html)" '
curl -sD - -H "Accept: text/html" "http://127.0.0.1:$GWAY_PORT/ipns/$IPNS_ID" > curl_output 2>&1 &&
curl -sD - -H "Accept: text/html" "http://127.0.0.1:$GWAY_PORT/ipns/$IPNS_ID/" > curl_output 2>&1 &&
test_should_not_contain "Content-Disposition" curl_output &&
test_should_not_contain "Cache-Control" curl_output &&
test_should_contain "Etag: \"DagIndex-" curl_output &&
Expand Down

0 comments on commit 7c3d79e

Please sign in to comment.