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

Bug: intercepting postMessage from ipfs-postmsg-proxy #675

Closed
hazae41 opened this issue Feb 3, 2019 · 4 comments
Closed

Bug: intercepting postMessage from ipfs-postmsg-proxy #675

hazae41 opened this issue Feb 3, 2019 · 4 comments
Labels
area/window-ipfs Issues related to IPFS API exposed on every page status/deferred Conscious decision to pause or backlog

Comments

@hazae41
Copy link

hazae41 commented Feb 3, 2019

Using this module https://github.com/ipfs-shipyard/ipfs-postmsg-proxy
And following this tutorial https://github.com/ipfs-shipyard/ipfs-service-worker

Then doing
createProxyServer(() => node) from a service worker
const node = createProxyClient() from a website

Then using await node.id() from the website, IPFS Companion shows the permission request dialog and responds with the ID of IPFS-Companion

IPFS-Companion does this even if it is disabled

@lidel
Copy link
Member

lidel commented Feb 6, 2019

@hazae41 Thank you for reporting. Are you using Firefox or a Chromium-based browser?

@lidel lidel added the area/window-ipfs Issues related to IPFS API exposed on every page label Feb 6, 2019
@hazae41
Copy link
Author

hazae41 commented Feb 6, 2019 via email

@lidel
Copy link
Member

lidel commented Feb 11, 2019

@hazae41 by default createProxyClient() will use the same communication channel as window.ipfs

If you want to talk to instance in Service Worker, you need to bind to navigator.serviceWorker as in this example:

node = createProxyClient({
  addListener: navigator.serviceWorker.addEventListener.bind(navigator.serviceWorker),
  removeListener: navigator.serviceWorker.removeEventListener.bind(navigator.serviceWorker),
  postMessage: (data) => navigator.serviceWorker.controller.postMessage(data)
})

Let me know if this helped.

@lidel lidel added the status/deferred Conscious decision to pause or backlog label Feb 11, 2019
@lidel
Copy link
Member

lidel commented Oct 19, 2020

Closing due to #589 (comment)

@lidel lidel closed this as completed Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/window-ipfs Issues related to IPFS API exposed on every page status/deferred Conscious decision to pause or backlog
Projects
None yet
Development

No branches or pull requests

2 participants