4 ms·
This is something I deeply care about, as I'm also very interested in the intersection of ebooks, security, and a LowJS web. 1. absolutely we should have a sin
by asimpletune 3y ago
This is something I deeply care about, as I'm also very interested in the intersection of ebooks, security, and a LowJS web.
1. absolutely we should have a single-file, portable ebook format, and since PDF doesn't reflow text then it's not that.
2. HTML + CSS in 2024 is capable of reproducing virtually any kind of printed medium, but it can also reflow text.
3. I don't personally think JS should be a requirement, but a lot of conversations break down at this point so let do my best to explain and please understand I'm not simply being religious about this. In my view, an ebook is a book that can change its size in a way that makes sense. Bearing this in mind, I believe that if a reader has JS turned off, this book should work as intended. In other words JS shouldn't be required for it to perform its basic function. However, if there is some necessity to add interactivity or to augment the book, then yeah, why not, use JS. That's what it's there for. However, from the perspective of being a book, if it doesn't work as a book without JS then it's a bug in my view. (for standard ereader capabilities, I think the browser should offer that, but the book itself shouldn't be shipped with an ereader)
4. I think it's a mistake to embed all the styling as that may violate some people's CSP's. It's safer to specify separate styling as resources relative to the HTML, and ebooks should forbid loading resources from a separate domain. In this way, ebooks would always work offline, but it has the added benefit of working online too and would automatically adhere to the strictest possible CSP. This achieves the same goal as offline, but in a safer and more universally compliant way.
5. Finally, just distribute it in a zip file. That's how ebooks already work right?
- gildas 3y ago> 5. Finally, just distribute it in a zip file. That's how ebooks already work right? What about self-extracting ZIP files like this page? https://gildas-lormeau.github.io/ https://gildas-lormeau.github.io/ (note that it includes the CSP to make it safe)
- asimpletune 3y agoI don't think there's any CSP? https://observatory.mozilla.org/analyze/gildas-lormeau.github.io https://observatory.mozilla.org/analyze/gildas-lormeau.githu... In any case, ideally, any ebook solution should have all resources loaded as files relative to the current document, and nothing inline. Like this, the book would be compatible both offline and to be hosted online, without requiring any changes to the book. The one file thing is cool, but again it requires JS to show anything, so that's not really inline with what I was talking about. In my view, an HTML document should work like a book, and any JS is purely to augment and extend that book if necessary. Those situations are rare though, and most JS is just to give a reader like experience. I think if someone is going to go through the trouble to host a book, they probably don't mind unziping a file before putting it on their server. The one file thing I said earlier was more about sharing the book, similar to an app package. but once it's on someone's servers presumably it's ready to be read. Basically .webarchive
- gildas 3y agoThe index page is protected via CSP. The "bootstrap" page which unzips the page isn't but it could. I just did not include it for some reasons I've forgotten. The JS is not essential, there's nothing to stop you treating the file as a ZIP file and unzipping it beforehand to view it.
- asimpletune 3y agoOk, well maybe the example provided doesn't communicate the intention, because when I try to 'extract' the page, following the download links, they don't work, except the png. Cool concept though.
- gildas 3y agoUnfortunately, the file poses a problem for basic unzipping software (e.g. a file explorer). However, the file is 100% valid with respect to the ZIP specification. You just need to use "true" unzipping software like 7zip, unzip etc. to read it as such.
- emmanueloga_ 3y agoSuper interesting! Haven't seen this before. Very creative (abuse?) of zip files! :-) https://github.com/gildas-lormeau/SingleFile/blob/master/faq.md#how-does-the-self-extracting-zip-format-work https://github.com/gildas-lormeau/SingleFile/blob/master/faq...
- Turing_Machine 3y ago> That's how ebooks already work right? Sort of, in the sense that any unzip tool will unpack an EPUB file (possibly after renaming it to a .zip extension rather than .epub). However, it doesn't necessarily work the other way. You can't just zip the files at random and wind up with a valid EPUB, even if that exact same set of files was a valid EPUB before it was unzipped. The "mimetype" file in an EPUB zip is special. It has to be the very first entry in the archive. It also has to contain the string "application/epub+zip" (and nothing else) and must be stored uncompressed. A surprising number of zip tools make it hard to do this (e.g., by altering the file order as more files get added to the zip, or making it hard or impossible to store one file uncompressed while compressing the others). Most of the command line zip programs can do this with the proper command line flags, but zip libraries often make it a PITA. Source: have written EPUB generation software.
- charlieyu1 3y agoNot a fan of zipping everything. One thing I missed about working with old .doc files instead of .docx, was that it was very fast to search a folder with hundreds or thousands of files for a specific word. Not possible for zip formats. (I just saved a file in .doc right now and open it with a hex editor and it does contain the contents in plain-text.) It is a problem to search zip formats or pdf files with grep, and I really doubt that the zipping is necessary for text with maybe a few thousand characters.
- Arelius 3y agoTo be fair. Iirc, an epub is stored uncompressed. So you should be able to get a directory of them no problem.
- deleted 3y ago[deleted]
- kimixa 3y agoZip files don't need to be compressed, if there's a need maybe you can promote adding the option upstream to whatever apps you use (if it's not already there somewhere). Or a .zip equivalent for zgrep. Though pattern matching in files feels very fragile - simple text patterns would still rely on the text being kept in a contiguous chunk and no embedded data/markup within the section you're searching for... Though I generally see the prevalence of zip files a result of people assuming that collections of files/streams need to be packed into a single object for "user simplicity", but we already have this with OS support in the form of directories. It just seems people have embedded the assumption that tools and UI handle directories as single units poorly, when that doesn't really need to be the case.
- Shorel 3y agoAbout #3: I would say that usability without JS should be a requirement. We don't need JS, especially in a low-power device like an e-reader. #5: Why change something that is already working well? The extension is .epub, even if it is a zip file.
- ianburrell 3y agoIt is also important to distinguish between normal zip file and ebooks. Let's use the extension ".epub". You described ePub format, where HTML, CSS, images files go in zip archive.
- int_19h 3y ago> HTML + CSS in 2024 is capable of reproducing virtually any kind of printed medium While we're at it: https://www.princexml.com/samples/ https://www.princexml.com/samples/
- niutech 3y agoWhy a ZIP or ePub file? There is already established MHTML format supported by most browsers.