Merge pull request #759 from kiwix/catalog_only_mode

kiwix-serve --catalogOnly --contentServerURL=<URL>
pull/734/merge
Kelson 8 months ago committed by GitHub
commit e22cfea9d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -64,11 +64,11 @@ jobs:
- linux-x86_64-dyn - linux-x86_64-dyn
include: include:
- target: linux-x86_64-static - target: linux-x86_64-static
image_variant: focal image_variant: jammy
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
arch_name: linux-x86_64 arch_name: linux-x86_64
- target: linux-x86_64-dyn - target: linux-x86_64-dyn
image_variant: focal image_variant: jammy
lib_postfix: '/x86_64-linux-gnu' lib_postfix: '/x86_64-linux-gnu'
arch_name: linux-x86_64 arch_name: linux-x86_64
@ -76,7 +76,7 @@ jobs:
HOME: /home/runner HOME: /home/runner
container: 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: steps:
- name: Checkout code - name: Checkout code

@ -49,6 +49,24 @@ Options
that the command line argument is rather a :ref:`library XML file that the command line argument is rather a :ref:`library XML file
<cli-arg-library-file-path>`. <cli-arg-library-file-path>`.
.. 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
<cli-arg-library-file-path>` 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 .. option:: -i ADDR, --address=ADDR
Listen only on this IP address. By default the server listens on all Listen only on this IP address. By default the server listens on all

@ -61,6 +61,8 @@ Mandatory arguments:
Options: Options:
-h --help Print this help -h --help Print this help
-a <pid> --attachToProcess=<pid> Exit if given process id is not running anymore [default: 0] -a <pid> --attachToProcess=<pid> Exit if given process id is not running anymore [default: 0]
--catalogOnly Serve only the library catalog
--contentServerURL=<url> Root URL of the server serving ZIM content for this library
-d --daemon Detach the HTTP server daemon from the main process -d --daemon Detach the HTTP server daemon from the main process
-i <address> --address=<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] -i <address> --address=<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 -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 customIndexPath="";
std::string indexTemplateString=""; std::string indexTemplateString="";
int serverPort = 80; int serverPort = 80;
bool catalogOnlyFlag = false;
std::string contentServerURL;
bool daemonFlag [[gnu::unused]] = false; bool daemonFlag [[gnu::unused]] = false;
bool helpFlag = false; bool helpFlag = false;
bool noLibraryButtonFlag = false; bool noLibraryButtonFlag = false;
@ -256,6 +260,8 @@ int main(int argc, char** argv)
for (auto const& arg: args) { for (auto const& arg: args) {
FLAG("--help", helpFlag) FLAG("--help", helpFlag)
FLAG("--catalogOnly", catalogOnlyFlag)
STRING("--contentServerURL", contentServerURL)
FLAG("--daemon", daemonFlag) FLAG("--daemon", daemonFlag)
FLAG("--verbose", isVerboseFlag) FLAG("--verbose", isVerboseFlag)
FLAG("--nosearchbar", noSearchBarFlag) FLAG("--nosearchbar", noSearchBarFlag)
@ -379,6 +385,10 @@ int main(int argc, char** argv)
server.setIpConnectionLimit(ipConnectionLimit); server.setIpConnectionLimit(ipConnectionLimit);
server.setMultiZimSearchLimit(searchLimit); server.setMultiZimSearchLimit(searchLimit);
server.setIpMode(ipMode); server.setIpMode(ipMode);
server.setCatalogOnlyMode(catalogOnlyFlag);
while ( !contentServerURL.empty() && contentServerURL.back() == '/' )
contentServerURL.pop_back();
server.setContentServerUrl(contentServerURL);
if (! server.start()) { if (! server.start()) {
exit(1); exit(1);

Loading…
Cancel
Save