-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
Enable installing Kiwix JS as a Progressive Web App #388
Comments
@Jaifroid Sounds to be a good idea to make the overall UX even smoother. |
Well, it might be another way to distribute the app, but I don't see as an enhancement in terms of UX. We already have an online version of kiwix-js (used for testing) : https://kiwix.github.io/kiwix-js. It's hosted on github, I update it after each release. But, in terms of UX, I see it more as a regression compared to our already-existing modes. The idea of a PWA is to smoothly transition between a web page and a local application. But I don't think we want this transition : we only want to install the app once, and then use it offline. It makes little sense for us to connect (the first time) to a web page in order to read the content of a local ZIM file (because, as you said, it does not solve the need to manually pick a local ZIM file). I'd be glad to work on that, but the installation process seems counter-intuitive to me in our use-case. It might make more sense IMHO that online wikipedia would be a PWA, and enable an offline mode. But it does not really fit with the concept of a big ZIM file containing all the content, that would need to be downloaded at some point. |
OK, it's just an idea. I read more an more articles about how PWAs will be the future of all apps, and that app stores won't be necessary. PWAs can be packaged in app stores (that's what MS is pushing for) though personally I think the whole point of them is to be able to distribute apps without a proprietary store model. If you think about it, going to a web page to install the app, especially an open-source one, and going to a vendor's store to install it, both involve having an online connection, and the store is going to be a lot slower and require longer online. PWAs are Service-Worker centric and leverage all the possibilities of that technology. A PWA would also solve our problem with Service Worker requiring to be run and "installed" from https:// (in Web context). They're supposed to be a native app experience on devices, with push notifications for updates, etc., not just an "offline" web page (at least according to Google and Microsoft's hype....). We'll see if it materializes quite like that! |
Just an update on where I'm at with PWA versions of the app (I've been doing this on Kiwix JS Windows, as it is an easier testbed for me to try out experimental things, to see what works and what doesn't before considering porting here). Some main milestones are the following:
|
Very useful demo app showing what PWAs are capable of today: |
With the optimizations, including peter-x's least-recently-used file cache, binary search is now acceptable on the Android PWA in ZIMs up to a few GB in size. For In full English Wikipedia, however, the search is still ridiculously slow (unusable, effectively). |
Just to update this: this sentence is no longer true at least on my Android. It's actually usable with the latest browser updates to Chrome and Edge (Android). |
As promised in #727, some updates on PWA functionality. It could be an interesting alternative for Firefox users, and maybe even could be packaged transparently in a Firefox Extension -- this should work because the code would be drawn from a secure (https:) server, not from locally packaged code. There is a version running at https://pwa.kiwix.org/ . As mentioned above, a PWA that leverages Service Worker technologies, caches itself (using Cache API) on first visit to the PWA site. Thereafter it works offline (if an offline-first strategy is used), but as per the Service Worker specification, the worker will periodically check for updates to its own code when the machine is online. The Cache needs to be numbered according to the app's release version, which keeps caches separate for each new version. The app can check if an update is waiting, and can tell the user that it will be installed on next relaunch of the app. The installation doesn't need any special coding -- it's handled by the Service Worker specification, and the Cache is upgraded as part of this. There are a couple of downsides for Firefox users -- again, Firefox is dragging its feet on the key technologies, citing security concerns:
|
Could you provide the URLs of corresponding bugzilla open issues (if you have them)? |
Regarding installation of PWAs, there's extensive discussion here: https://bugzilla.mozilla.org/show_bug.cgi?id=1407202 Regarding File System Access API, see mozilla/standards-positions#154 . I can't find a bugzilla specifically, possibly because the spec is still draft, though implemented and being used in Chromium browsers. |
PS Chromium devs provide a polyfill for the File System Access API that uses it where available, and falls back to earlier methods where not. See https://web.dev/file-system-access/#polyfilling. Having said that, the API isn't difficult, and easily substitutes for a standard file picker without really needing a polyfill. But it could simplify code not to have different types of file picker showing according to browser API support. |
Updated PWA install experience in Windows shown below (this is browser-provided -- in this case by Edge Chromium). I have also tested the install experience on Ubuntu using Chromium browser for Linux. It creates a |
This news may be of interest: PWABuilder can make packages for the Microsoft Store and for the Play Store from a simple PWA URL, and allows for a certain amount of customization. I've tested these with pwa.kiwix.org. After a bit of bugfixing at pwa-builder/CloudAPK#78, this now works very well. Obviously it's not in itself a build solution, but their code is available to use. Note that the Android app generated is not really useable due to the issue noted in #581 - everything works, but slowly. It's pretty bad for the full English Wikipedia, and tolerable for WikiMed. Also, the File System Access API is not supported in Android Chrome/Edge (yet?), which means we are stuck with the plain old filepicker. So this is more a curiosity than anything else. On Windows, the generated PWA package is pretty fast and it leverages the File System Access API for a near-native experience. |
This issue would be closed by #771. |
A PWA is usually an offline version of a Web page/site. The Service Worker will cache content and only refresh it when it has internet access.
While our model is somewhat different (never need access to a server), making Kiwix JS work as a PWA could be an easier way of distributing the app, instead of using proprietary browser extensions. In our case, we would serve Kiwix JS from, say https://m.kiwix.org or https://kiwix.org/kiwix-js . But once downloaded, with or without a packaged ZIM, the app would work offline except for checking for code updates when the user asks it to (or on a schedule).
Google has gone all-in on PWAs. See https://developers.google.com/web/progressive-web-apps/ on the advantages, in particular:
Microsoft is also heavily supporting the model. See https://www.pwabuilder.com/ (a Microsoft service). MS is also automatically placing major PWAs in the Microsoft Store, though developers can own the code if they prefer. Nevertheless, PWAs don't need a store model, and are intended to do away with that model.
I think, for Kiwix JS, such a system would require an easy way to download ZIM contents, as suggested in #114.
It's unclear to me at the moment whether accessing Kiwix JS as a PWA would overcome the need to pick the ZIM file (if packaged). I believe there is a maximum size for a PWA of approx. 20GB, but it can be smaller depending on free disk space of the user. If sufficient space is available, the ZIM could be "cached" (stored in indexedDB), enabling packaged apps.
EDIT: I think the ZIM would still need to be in the file system, which implies having to download it as an extra step, because we can't have binary access to files in indexedDB without loading the whole file into memory...
The text was updated successfully, but these errors were encountered: