-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Add ability to open ZIM file from URL #356
Comments
It's probably technically possible, but does not look like a priority to me. @sharun-s did something similar in his (unmerged) branch. See #275. His code was intended to allow reading a local file through XHR (only working if the file is inside the same folder as the source code). But, to me, it looks like a very unusual way to use kiwix-js. If your ZIM files are available through HTTP in your local network, it might be better to use http://wiki.kiwix.org/wiki/Kiwix-serve. It would allow you to directly read the content of the ZIM files through any browser. |
The problem is we can only serve static content. I noticed that the test suite will load zim files over http however it seems to be limited to small files. Also I noticed the following text in @sharun-s branch of kiwix-html5, specifically the bold bit, I can't seem to find any more information about what is meant by that though.
|
So I actually have it working using @sharun-s branch, serving the entire Spanish Wikipedia (16GB as a single .zim file!) over HTTP, and it isn't too horribly slow. The only issue I'm having at the moment is that search doesn't work properly in Chrome. |
That's excellent news @nixcamic ! Could you let us know which browsers you've tested this on? Last I knew there was a bug in Firefox that prevented using this technique on files larger than a few gigs. |
I've tested in Firefox 59.0.2 and Firefox 60 (both 64 bit) and Chrome 65. It was by no means a comprehensive test but I navigated to a half dozen pages in each, and images and everything loaded fine. The only issue I have ATM is that the search in @sharun-s branch has some sort of incompatibility with Chrome, it will complete the search but you cant actually navigate to any of the found pages. |
@nixcamic open devtools in chrome and see if it shows and error. Off the top of my head, you probably need to enable the --allow-file-access-from-files flag when starting a Chrome session. offtopic - @mossroy something odd going on with my email notifications. I am getting an email on all kinds of things. Before I would just get when my name was mentioned. Any idea how I can revert to that state? |
@nixcamic According to @sharun-s's #292 (comment) there is or was a bug with Firefox using XHR range requests via the file:// protocol. I understand that you are accessing the ZIM, at least, over a network (presumably same domain or no cross-origin issues), so this may be why the range requests are working for you, which is fortunate. Are you accessing the app's index.html with localhost, with a URL in the same overall domain as the ZIM, or with file://? Note that Chrome does not work out-of-the-box with file:// access (though you can set the flag @sharun-s mentions), but other browsers do. @sharun-s , is there any advance on using your method to create packaged apps for Kiwix JS? (I should probably ask this in #292, but answer may pertain to this issue as well.) |
@Jaifroid I don't know about packaged apps but standalone/url mode appears to be working on Firefox. I think they fixed one of the bugs. It's been a while since I looked at the code so a bit hazy on the details. Plan to do some work on the code this month and will update you guys if there is something I notice. |
Thanks @sharun-s . It'd be very exciting if we've got to the point where we could provide a Wikivoyage or WikiMed version as a standalone, which doesn't require picking the ZIM or downloading from an app store. E.g. run WikiMed from a USB stick without having to install anything, at least in Firefox and Edge if not in Chrome. |
@Jaifroid it's pretty simple to do. You just need to create/modify a desktop browser shortcut with the url to open. Just have to mention the page and zim in the url parameters. I have a couple shortcuts on my desktop to stackoverflow articles and some wiki articles. |
@sharun-s I don't think --allow-file-access-from-files will help since I'm accessing it over HTTP not from file://. On a somewhat unrelated note, I can't get my .zim file to show up in the list of known files on the load page, even though I added it to the list in zimArchiveLoader.js. Is there somewhere else it needs to be also? @Jaifroid I'm accessing via localhost (And over the network via my computers hostname). |
@nixcamic Ah sorry misread your comment. Didn't realize you were trying my branch with a local server setup. Either way let me know what error you are seeing on your server and in devtools when you search. That load page is just a hacked up proof of concept :( |
@nixcamic : I still don't understand why kiwix-serve would not be a better solution for you. If your content is already hosted on a server, you might run kiwix-serve on it, instead of exposing the ZIM files through an HTTP server. Kiwix-serve would handle reading the ZIM files (on the server side), and expose their content to any browser on your local network. @sharun-s : the email notifications you get are probably due to the fact that you are a member of the kiwix group, and are by default a watcher of new repositories. You can adjust the notifications of github, by unwatching some repositories you are not interested in, on https://github.com/watching. See https://help.github.com/articles/watching-and-unwatching-repositories/ |
@mossroy oh I see now. Thanks! And yes agree, for local serving via HTTP my branch isn't built for that. Just for standalone/url mode. It is using HTTP range requests, so theoretically possible, but I haven't looked at the code in a while and can't really say how much work would be required. Ideally it happens on a separate branch. |
@mossroy I'm serving the site from a basic router (32mb ram) that can only host static HTTP, I guess I could try and cross compile kiwix-serve and see if it can run on the very limited hardware available. |
@nixcamic : before compiling yourself, try to see if the pre-compiled nightly builds might run on it : https://download.kiwix.org/nightly/ . If you're lucky, your router uses a supported architecture, like armhf. |
@mossroy Nope, its a MIPS. |
I have a few ZIM files hosted on the local network and it would be nice to be able to open them straight over HTTP (Which seems to be possible in the backend) instead of only being able to browse local files.
The text was updated successfully, but these errors were encountered: