From 824eddaf942c1146d2d583e236d49915d6252f5a Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sat, 6 Sep 2025 17:58:17 +0400 Subject: [PATCH] kiwix-serve --catalogOnly --- docs/kiwix-serve.rst | 6 ++++++ src/server/kiwix-serve.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/docs/kiwix-serve.rst b/docs/kiwix-serve.rst index 588b60c..562c523 100644 --- a/docs/kiwix-serve.rst +++ b/docs/kiwix-serve.rst @@ -49,6 +49,12 @@ 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. + .. 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..fdf7ed5 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -61,6 +61,7 @@ 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 -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 +230,7 @@ int main(int argc, char** argv) std::string customIndexPath=""; std::string indexTemplateString=""; int serverPort = 80; + bool catalogOnlyFlag = false; bool daemonFlag [[gnu::unused]] = false; bool helpFlag = false; bool noLibraryButtonFlag = false; @@ -256,6 +258,7 @@ int main(int argc, char** argv) for (auto const& arg: args) { FLAG("--help", helpFlag) + FLAG("--catalogOnly", catalogOnlyFlag) FLAG("--daemon", daemonFlag) FLAG("--verbose", isVerboseFlag) FLAG("--nosearchbar", noSearchBarFlag) @@ -379,6 +382,7 @@ int main(int argc, char** argv) server.setIpConnectionLimit(ipConnectionLimit); server.setMultiZimSearchLimit(searchLimit); server.setIpMode(ipMode); + server.setCatalogOnlyMode(catalogOnlyFlag); if (! server.start()) { exit(1);