mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-12-23 22:28:10 -05:00
Merge pull request #759 from kiwix/catalog_only_mode
kiwix-serve --catalogOnly --contentServerURL=<URL>
This commit is contained in:
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
@@ -49,6 +49,24 @@ Options
|
||||
that the command line argument is rather a :ref:`library XML file
|
||||
<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
|
||||
|
||||
Listen only on this IP address. By default the server listens on all
|
||||
|
||||
@@ -61,6 +61,8 @@ Mandatory arguments:
|
||||
Options:
|
||||
-h --help Print this help
|
||||
-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
|
||||
-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
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user