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

can service worker support IPFS? #60

Open
LiNk-NY opened this issue Feb 29, 2024 · 0 comments
Open

can service worker support IPFS? #60

LiNk-NY opened this issue Feb 29, 2024 · 0 comments

Comments

@LiNk-NY
Copy link

LiNk-NY commented Feb 29, 2024

Thank you for working on this exciting tech!

I was wondering if it is possible to host a shinylive app via IPFS https://ipfs.tech/ ?

In theory, it should work with a localhost connection?

I am only beginning to understand the infrastructure but in my testing, I get an error that says:

Shinylive uses a Service Worker, which requires either a connection to localhost, or a connection via https.

which seems to come from

// src/load-shinylive-sw.ts
var localhostNames = ["localhost", "127.0.0.1", "[::1]"];
if (window.location.protocol !== "https:" && !localhostNames.includes(window.location.hostname)) {
  const errorMessage = "Shinylive uses a Service Worker, which requires either a connection to localhost, or a connection via https.";
  document.body.innerText = errorMessage;
  throw Error(errorMessage);
}

The URL to the example app looks something like:

http://bafybeidqxcurjbnkahltgppzfwwcp6te2ncz426at3675vbebalxppe454.ipfs.localhost:8080/?filename=index.html

I'm using a native IPFS browser (Brave) connected to a local IPFS node.

Other experiments using Joe Cheng's example (fork here) seem to render only the text:

http://bafybeica5jbha66yt3mq34j4ndbxd74gg4idzfesblc5x3ncqnnvowdjzu.ipfs.localhost:8080/?filename=R-shinylive-demo.html

FWIW, the R-shinylive-demo.html was rendered with the #| standalone: true option.

Is this something that is possible?

Thank you!

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

No branches or pull requests

1 participant