Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(verified-fetch): improve UX #286

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

SgtPooki
Copy link
Contributor

@SgtPooki SgtPooki commented Feb 7, 2024

Slightly modifies the code from #285 to have better UX.

Also implements the previously unimplemented onFetchImage and onFetchFile functions.

Better error messaging and loading messages.

Adds fetch-auto functionality to attempt to automatically determine content-type for proper rendering.

2024-02-07.at.13.58.27.-.Amethyst.Stork.mp4

@SgtPooki SgtPooki changed the base branch from main to add-verified-fetch February 7, 2024 21:48
Copy link
Contributor Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

@@ -1,25 +1,182 @@
import { useCallback, useState } from 'react'
// import { verifiedFetch, createVerifiedFetch } from '@helia/verified-fetch'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when ipfs/helia#423 is merged, we should switch the auto content type button to use the contentTypeParser option.

@SgtPooki SgtPooki requested a review from 2color February 7, 2024 21:56
const handleVideoType = useCallback(async (resp: Response) => {
try {
setLoading('Waiting for full video data...')
const blob = await resp.blob()
Copy link
Contributor

@2color 2color Feb 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, I'd love to dig into streaming the video, but I think we might have to do that in a service worker because there isn't an easy way to just pass a stream into a video element.

Copy link
Contributor

@2color 2color left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all of that. Not sure why I still can't get this to run locally (same error with verified-fetch looking for process). But all changes look reasonable to me. Merging.

@2color 2color merged commit 72f3d59 into add-verified-fetch Feb 8, 2024
18 of 19 checks passed
@2color 2color deleted the verified-fetch-example-patch branch February 8, 2024 12:42
2color added a commit that referenced this pull request Mar 28, 2024
* feat: add helia/verified-fetch browser example

* feat(verified-fetch): improve UX (#286)

* Update examples/helia-browser-react-verified-fetch/package.json

Co-authored-by: Alex Potsides <[email protected]>

* refactor: clean up code and reduce deps

* chore: rename folder

* chore: add test

* chore: fix linting

* chore: add test to verified fetch example  (#290)

* chore: add test to verified fetch example

Adds a test for JSON-codec data

* chore: test verified fetch during ci

* chore: add tests for other types

* fix: improve rendering of cids on narrow viewports

* fix: improve auto content detection

* chore: fix tests

* chore: upgrade verified-fetch

* feat: add link to the repo

* chore: bump verified fetch version

* fix: add aborting functionality

* fix: handle abort error

* feat: add ability to fetch as dag-json

* chore: update deps

* chore: remove comment

* chore: address feedback and simplify code

* chore: reduce code duplication and add docs

* feat: add links to api docs and source

* fix: linting error

---------

Co-authored-by: Daniel N <[email protected]>
Co-authored-by: Russell Dempsey <[email protected]>
Co-authored-by: Alex Potsides <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants