You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
}
Unfortunately, I don't think this is currently possible.
As described in the error message shown,
Shinylive uses a Service Worker, which requires either a connection to localhost, or a connection via https.
Shinylive works by intercepting network requests using a Service Worker. For security reasons, the service worker API is only enabled by web browsers when connecting to the localhost origin, or when using the https:// protocol.
It looks like from the sample URLs that IPFS servers are using http://. So, to be considered a secure context connections must be through localhost. I'm not 100% sure if these long subdomains of localhost are counted by the browser as a secure context or not, but a stack overflow answer suggests that they do not count and so the Service Worker API cannot be used here.
The only thing I can think of that would allow this to work is to explicitly disable the browser security restrictions using command line launch flags. While possible, it is not a real solution as it would require every user to launch a web browser with extra flags and disabling security restrictions in general is a very bad idea. Nevertheless, more information is available on how this can be done for testing purposes.
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:
which seems to come from
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!
The text was updated successfully, but these errors were encountered: