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

V0.1.0 #1

Merged
merged 4 commits into from
May 25, 2017
Merged

V0.1.0 #1

merged 4 commits into from
May 25, 2017

Conversation

daviddias
Copy link
Member

@daviddias daviddias commented May 16, 2017

WIP

@daviddias
Copy link
Member Author

Update

I'm now able to run successfully a js-ipfs node in a Service Worker and capture a request and make the fetch through js-ipfs 🌟 woot!

image

I'm not being successful though, on loading the second page and doing a request to the first-page domain and get that served by the service worker.

Instructions to try this out:

> git clone git@github.com:ipfs/ipfs-service-worker.git -b v0.1.0
> cd ipfs-service-worker 
> npm install
> npm link ipfs # you need to use the master version of js-ipfs until v0.24 is released
> cd /examples/use-from-another-page
> npm install
> npm run build
> npm i node-static -g
> static public+sw
# open your browser in localhost:8080
# refresh your page (for some reason, the service worker only activates on refresh)
# insert the hash in the box QmSiV9n9jofrEaWRjStCqVTspr4fLrvSNtmDRsfYuUtHHj
# click fetch
# voilá!

@daviddias
Copy link
Member Author

daviddias commented May 22, 2017

Next steps:

  • Service Worker wise:
    • Understand why the page requires to be refreshed one time in order for the Service Worker to
      kick in
    • Figure out how to request from website on domain B an image served by service worker on domain A
  • Feature wise:
    • Path support
    • Extract content types from file extensions
  • Document the whole thing

@daviddias daviddias merged commit 70f96a3 into master May 25, 2017
@daviddias daviddias deleted the v0.1.0 branch May 25, 2017 20:19
@ilyaigpetrov
Copy link

@diasdavid, I tired to follow your instructions:

  1. First line requires SSH key or something else. Cloned via https instead.
  2. Port 8080 on localhost conflicts with ipfs daemon. Tried both:
  • stopping the daemon [1]
  • running command with other port [2] while daemon is running

Case [1]

Nothing happens, in logs:

Fetch not in scope http://localhost:8080/
index.js:6 -> Registered the service worker successfuly
service-worker-bundle.js:49961 Handling fetch event for http://localhost:8080/ipfs/QmSiV9n9jofrEaWRjStCqVTspr4fLrvSNtmDRsfYuUtHHj

Case [2]

Cannot read property 'files' of undefined

@RossRogers
Copy link

@ilyaigpetrov , fetch is a newer browser api. Are you using a browser that supports it?

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.

3 participants