kiwix-apple icon indicating copy to clipboard operation
kiwix-apple copied to clipboard

Support ZIM files with service workers in Kiwix for iOS

Open kelson42 opened this issue 4 years ago • 8 comments

New ZIMit based ZIM file use service workers.

kelson42 avatar Nov 26 '20 15:11 kelson42

TLDR: I don't think this is really possible right now.

In iOS 14, browser apps can become the default browser by using com.apple.developer.web-browser entitlement. (e.g. use Firefox as the default browser on iPhone) This AFAIK is the only way to have WkWebView support service workers right now.

Kiwix is not a generic purpose internet browser and cannot use this entitlement (I can positively say the app will be rejected if we do it), therefore there doesn't seem to be a way to support this request

See apple doc for more: link

automactic avatar Dec 26 '20 14:12 automactic

I have the same analysis. Kiwix is not a Web browser, therefore not concerned by the current "web browser app" approach.

This post is of interest as well https://dev.to/ben/will-ios-14-support-service-workers-in-wkwebview-5gn.

That said, the situation is evolving and it seems possible that WKWebView will support serive workers in the future.

For the moment, I believe this is important to ignore entries with the tag _sw:yes.

We will then re-evaluate the situation in a year.

kelson42 avatar Dec 26 '20 19:12 kelson42

ignore entries with the tag _sw:yes

Just to be clear: you mean not to show these files in the library right? What happens if user open such a file with kiwix?

automactic avatar Dec 27 '20 01:12 automactic

Yes this is what I mean. If open locally, the. The zim will display an error because it can itself detect that SW are not supported.

kelson42 avatar Dec 27 '20 08:12 kelson42

What happens if user try to manually open such a file?

automactic avatar Jan 01 '21 02:01 automactic

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Mar 19 '21 23:03 stale[bot]

Not sure, but a message should be displayed that to be displayed this ZIM file needs service workers and this is not available.

kelson42 avatar May 02 '21 09:05 kelson42

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Jul 02 '21 13:07 stale[bot]

This ticket should better be updated because two years have passed.

kelson42 avatar Apr 26 '23 15:04 kelson42

Couldn't find a definitive answer online. Seems like it's available for app-bound-domains (a selection of up to 10 static domains you declare in the app) but I could not find any information regarding custom url scheme and service workers with WKWebView. Should probably be tested but lack of information online might demonstrate a lack of interest

rgaudin avatar Apr 26 '23 16:04 rgaudin

Do you think Mac Os has the same limitation as iOS? Do you have more alternatives than WKWebView?

stephane-archer avatar Apr 28 '23 11:04 stephane-archer

Can we expect an update here in the following months? Would be highly appreciated if Zimit files would work on iOS and macOS soon.

BenjaminJMueller avatar May 02 '23 16:05 BenjaminJMueller

@rgaudin I have seen https://github.com/ionic-team/capacitor/issues/4122 which seems to confirm that SW are available for app-bounds-domain. That means that we could use such a bound-domain to allow SW:

  • Either via a custom protocol handler (but SW has to work in that context)
  • OR like we do on Kiwix for Android with our fake domain kiwix.app

kelson42 avatar May 22 '23 14:05 kelson42

Both needs to be tested as it's not guaranteed that it would be allowed

  • We're not sure if SW would work with custom schemes. Security Context is HTTP specific
  • We're not sure it it there's a mechanism similar to Andoid for intercepting requests shouldInterceptRequest and it it's as relaxed: we declare being on an HTTPS URL but we intercept/forge all requests (secure context here is not real)

rgaudin avatar May 22 '23 14:05 rgaudin

It seems that we will be able to create ZIM files without SW with Zimit in version 2.0. Therefore this feature request priority is significantly lowered.

kelson42 avatar May 28 '23 14:05 kelson42

Closing as this won’t be necessary anymore once zimit2 will be released.

kelson42 avatar Nov 25 '23 12:11 kelson42