diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ec78a8..bcc9e0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,11 +64,11 @@ jobs: - linux-x86_64-dyn include: - target: linux-x86_64-static - image_variant: focal + image_variant: jammy lib_postfix: '/x86_64-linux-gnu' arch_name: linux-x86_64 - target: linux-x86_64-dyn - image_variant: focal + image_variant: jammy lib_postfix: '/x86_64-linux-gnu' arch_name: linux-x86_64 @@ -76,7 +76,7 @@ jobs: HOME: /home/runner container: - image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:36" + image: "ghcr.io/kiwix/kiwix-build_ci_${{matrix.image_variant}}:2025-06-07" steps: - name: Checkout code diff --git a/docs/kiwix-serve.rst b/docs/kiwix-serve.rst index 588b60c..5b02e88 100644 --- a/docs/kiwix-serve.rst +++ b/docs/kiwix-serve.rst @@ -49,6 +49,24 @@ Options that the command line argument is rather a :ref:`library XML file `. +.. option:: --catalogOnly + + In this mode ``kiwix-serve`` only serves the welcome (library) page and the + OPDS catalog. ZIM files referred by the :ref:`library XML file + ` need not be accessible. + + This option may be combined with the :option:`--contentServerURL` option. + +.. option:: --contentServerURL=URL + + In :option:`--catalogOnly` mode book content is not served by this instance + of `kiwix-serve`. If a separate instance of `kiwix-serve` is running for the + same library without that option and thus serves book content, then the root + URL of that server can be passed to this instance so that books can still be + previewed. + + This option must be combined with the :option:`--catalogOnly` option. + .. option:: -i ADDR, --address=ADDR Listen only on this IP address. By default the server listens on all diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index 7975361..5ae11a7 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -61,6 +61,8 @@ Mandatory arguments: Options: -h --help Print this help -a --attachToProcess= Exit if given process id is not running anymore [default: 0] + --catalogOnly Serve only the library catalog + --contentServerURL= Root URL of the server serving ZIM content for this library -d --daemon Detach the HTTP server daemon from the main process -i
--address=
Listen only on the specified IP address. Specify 'ipv4', 'ipv6' or 'all' to listen on all IPv4, IPv6 or both types of addresses, respectively [default: all] -M --monitorLibrary Monitor the XML library file and reload it automatically @@ -229,6 +231,8 @@ int main(int argc, char** argv) std::string customIndexPath=""; std::string indexTemplateString=""; int serverPort = 80; + bool catalogOnlyFlag = false; + std::string contentServerURL; bool daemonFlag [[gnu::unused]] = false; bool helpFlag = false; bool noLibraryButtonFlag = false; @@ -256,6 +260,8 @@ int main(int argc, char** argv) for (auto const& arg: args) { FLAG("--help", helpFlag) + FLAG("--catalogOnly", catalogOnlyFlag) + STRING("--contentServerURL", contentServerURL) FLAG("--daemon", daemonFlag) FLAG("--verbose", isVerboseFlag) FLAG("--nosearchbar", noSearchBarFlag) @@ -379,6 +385,10 @@ int main(int argc, char** argv) server.setIpConnectionLimit(ipConnectionLimit); server.setMultiZimSearchLimit(searchLimit); server.setIpMode(ipMode); + server.setCatalogOnlyMode(catalogOnlyFlag); + while ( !contentServerURL.empty() && contentServerURL.back() == '/' ) + contentServerURL.pop_back(); + server.setContentServerUrl(contentServerURL); if (! server.start()) { exit(1);