Earlier quoted context omitted.
I'd like to request something between what GP suggested and what your program is doing currently - basically I still want a single binary, but instead of embedding a full browser in it, I would like the binary to be just a self-extracting archive that calls the user's default browser, maybe in a new window/frame. Basically I'm looking for something like the old-school .chm files on Windows, where you could pack a bun…
I instantly searched for chm on the comments and yours was the only one :o
Show HN: Kage – Shadow any website to a single binary for offline viewing
141–150 of 152 posts
Re: Show HN: Kage – Shadow any website to a single binary for offline viewing
#142Earlier quoted context omitted.
Js modules don’t work on file urls (classic js does).
They can be made to work with blob urls. I have done this.
Re: Show HN: Kage – Shadow any website to a single binary for offline viewing
#143Earlier quoted context omitted.
Docker is designed to be undetectable by default, the best way I have found is to set env IN_DOCKER=True manually in your Dockerfile + check that there is no $DISPLAY configured + that you're on linux. Usually if all/most of those are true you can safely add --no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage etc. all the docker-specific flags. Thats what we do in https://github.com/ArchiveBox/ArchiveBox/bl…
Cool approach. But, a compromise still lands on host's kernel, Docker doesn't provide kernel isolation (well it does on a macOS because it runs in Docker machine but thats a side effect). I wonder if a better solution would be to play with seccomp or Linux capabilities so that Chrome is sandboxed even in Docker. Not sure how this would work tbh. Answering here to get ideas, I saw your fix on Git and request for feedb…
Re: Show HN: Kage – Shadow any website to a single binary for offline viewing
#144Re: Show HN: Kage – Shadow any website to a single binary for offline viewing
#145Earlier quoted context omitted.
They can be made to work with blob urls. I have done this.
Okay that’s super interesting and I would love to see an example or writeup - I have a project which would benefit from being able to do that.
To see it work, click "Download self contained .html" from the menu.
Here's the source file that handles this part: https://github.com/tomtheisen/mutraction/blob/master/mutract...
The idea is to use ... to define modules. That's something I just made up. For each such script, provision a blob URL. The main blocker is usually the same origin policy. Crucially, these blob URLs count as the same origin. So then you need to rewrite the imports from the named modules to the blob URLs. I used some regex rather than a proper parser, but it was more than good enough for me.
It seems quite doable to make some proper bundling tools around this concept.
Re: Show HN: Kage – Shadow any website to a single binary for offline viewing
#146Earlier quoted context omitted.
Yeah, but that's fine, the document is .html, and it can load ./app.js or ./style.css just fine even if loaded by file:// (as long as it isn't initiated by JS itself, then Origin starts to matter a lot more), otherwise basically every single local HTML file would suddenly be broken, I don't think anyone would have accepted that even with the origin changes.
I tried this on a small example and it works indeed. In my head this would have been something like a restrictive CSP script-source directive, even if not exposed in response headers or anything.
I was thinking "of course it works, how else would people get started creating websites otherwise?" then I remember what's the most common approaches in the frontend ecosystem nowadays.
Back in the days of yore, every tutorial/book started with "First we create a index.html file which you open in your browser ...", even a JavaScript resource would start with this of course :)
Re: Show HN: Kage – Shadow any website to a single binary for offline viewing
#147Re: Show HN: Kage – Shadow any website to a single binary for offline viewing
#148Binary app is a really bad way of storing data. No one would ever want to run a binary shared with them or found online.
Re: Show HN: Kage – Shadow any website to a single binary for offline viewing
#149Earlier quoted context omitted.
I tried this on a small example and it works indeed. In my head this would have been something like a restrictive CSP script-source directive, even if not exposed in response headers or anything.
> I tried this on a small example and it works indeed. I was thinking "of course it works, how else would people get started creating websites otherwise?" then I remember what's the most common approaches in the frontend ecosystem nowadays. Back in the days of yore, every tutorial/book started with "First we create a index.html file which you open in your browser ...", even a JavaScript resource would start with this…
The protection mechanism was introduced so that malicious saved pages can't just grab things from your Downloads folder and send stuff it to an attacker's server. But the method turned out to be a bit more refined than I have imagined: you can display an image but can't grab the pixels, run a script but not inspect its source code, fetch() will be unavailable, etc.