kiwix / kiwix-tools

Command line Kiwix tools: kiwix-serve, kiwix-manage, ...
https://download.kiwix.org/release/kiwix-tools/
GNU General Public License v3.0
465 stars 87 forks source link

Consider officially supporting the Dillo browser #714

Open rodarima opened 3 weeks ago

rodarima commented 3 weeks ago

Disclaimer: I maintain the Dillo graphical web browser.

I think Kiwix should work on old and low resource computers. Currently, the kiwix-desktop requires Qt WebEngine, which is implemented on top of Chromium on most platforms. This raises the requirements to load mostly text with images websites, and it is in my opinion an unnecessary requirement in most cases.

The kiwix-tools allow you to serve the documents as a HTTP server, so we can choose a more lightweight web broser and avoid the dependency on Chromium. Dillo is a graphical web browser that runs on very old and constrained machines, but it doesn't support Javascript. It can render HTML pages mostly fine, but there is one important feature that doesn't work: searching for content. Here is an example of the Arch wiki:

Image

And here is the comparison in memory consumption from Dillo to the official Kiwix desktop program as seen by the top program (memory numbers are in KiB):

% top -p $(pgrep dillo) -p $(pgrep kiwix-desktop) -p $(pgrep kiwix-serve)

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 452543 ram       20   0 3549324 330804 220808 R   5,0   2,0   0:01.38 kiwix-desktop
 452278 ram       20   0  111512  27084  20044 S   0,0   0,2   0:00.09 dillo
 440786 ram       20   0  439396  55544  23264 S   0,0   0,3   0:00.12 kiwix-serve

You can see that Dillo uses 27 MiB of resident memory (RES), while kiwix-desptop requires 330 MiB to load the same page. Even if you combine kiwix-serve + Dillo, it only reaches 1/4 of the memory usage of kiwix-desktop, but the server can be offloaded to another machine if needed.

By just implementing a simple mechanism to search for content without JS you'll implement all basic functionality and allow users of older machines to use Kiwix on Dillo (and probably other non-JS browsers too). See https://github.com/kiwix/kiwix-tools/issues/634.

I would kindly ask you to consider adding Dillo as an officially supported browser for kiwix-serve, so you ensure that users can use Kiwix without having to load a full Chromium browser. Searching is the only main feature missing I can see so far.

kelson42 commented 3 weeks ago

@rodarina I'm afraid that we can not guaranty that any ZIM and Kiwix Server feature works without Ja as ript engine. But maybe I didn't understand properly what you requested.

rodarima commented 3 weeks ago

You already provide a non-JS based implementation of all important features.

The only problem is that it cannot be queried from a non-JS page.

This simple HTML page:

<!DOCTYPE html>
<html>
  <head><title>Search kiwix</title></head>
  <body>
    <p>Search for a page in all Kiwix catalogs:</p>
    <form action="http://localhost:8080/search">
      <input type="text" name="pattern" placeholder="Term...">
      <input type="submit" value="Search"/>
    </form>
  </body>
</html>

Shows a simple search bar on Dillo (and any other browser):

Image

And allows me to search pages that match a particular term, for example GPU in the Arch Wiki:

Image

Without having executed a single line of JS.

What I'm asking is that you provide a plain HTML interface to all (or at least the essential) functionality that kiwix-serve currently provides via JS, so it can be used by Dillo. You can just add a similar search form to the /nojs endpoint, so we can perform searches of content (not searches of elements of the catalog as we have now). Probably you can add a <select> input element to allow the user to search only in one catalog instead of all.

By officially supporting Dillo I mean that you don't introduce a dependency over JS to perform a task that could be done without it and ensure we can continue to use Dillo (or any other simple web browser) to browse, search an read Kiwix pages.