15 Commits
3.8.0 ... main

Author SHA1 Message Date
Kelson
2308b02504 Merge pull request #787 from kiwix/better-deal-with-data-dir-permissions
Better deal with container /data dir permissions
2025-12-01 10:51:36 +01:00
rgaudin
81d9a6cc02 Use explicit UID/GID and show them in error message 2025-12-01 09:38:29 +00:00
Emmanuel Engelhart
0232f0a95f Check if /data is writable 2025-11-30 17:48:40 +01:00
Emmanuel Engelhart
309d4d01f1 /data per default writable 2025-11-30 17:48:40 +01:00
Kelson
abcbe0c9df Merge pull request #788 from kiwix/release-3.8.1
Release 3.8.1
2025-11-30 17:48:26 +01:00
Emmanuel Engelhart
d08638429e Changelog for 3.8.1 2025-11-30 17:47:37 +01:00
Emmanuel Engelhart
5348495c2b Bump-up version to 3.8.1 2025-11-30 17:39:14 +01:00
Kelson
9b91ff1529 Merge pull request #783 from kiwix/fix-kiwix-mange-docopt-integration
Fix kiwix-manage docopt integration
2025-11-17 17:20:39 +01:00
Emmanuel Engelhart
6f599589f9 Fix regression with kiwix-mange 'show' without arguments 2025-11-15 15:33:21 +01:00
Emmanuel Engelhart
6272c6d11e Small kiwix-mange usage() fix 2025-11-15 15:21:44 +01:00
Emmanuel Engelhart
0bcb3957e5 Fix kiwix-manage 'add' docopt definition 2025-11-15 14:58:53 +01:00
Emmanuel Engelhart
16f2734699 'ZIM' not 'zim' 2025-11-15 14:58:53 +01:00
tim-moody
45f0b0601e Fix kiwix-manage 'remove' docopt definition 2025-11-15 14:58:46 +01:00
Kelson
d61eafe6a2 Merge pull request #763 from vighnesh-sawant/standard-port-enhancment
Improve message when server is running on standard port
2025-11-01 17:09:53 +01:00
Vighnesh
ae21ba42da Display better message when using standard port 2025-11-01 07:09:25 +01:00
6 changed files with 50 additions and 40 deletions

View File

@@ -1,3 +1,13 @@
kiwix-tools 3.8.1
=================
* Kiwix server
- Hide port number in URL when server is running on port 80 (@vighnesh-sawant #763)
- Better deal with container /data dir permissions (@kelson42 #787)
* Other
- Fix kiwix-manage docopt integration (@kelson42 #783)
kiwix-tools 3.8.0
=================

View File

@@ -10,7 +10,8 @@ VOLUME /data
WORKDIR /data
# running as a named unprivileged user
RUN addgroup -S user && adduser -S user -G user
RUN addgroup -S -g 1001 user && adduser -S -u 1001 user -G user
RUN chown user:user /data
USER user
COPY ./start.sh /usr/local/bin/

View File

@@ -3,6 +3,14 @@
# Download if necessary a file
if [ ! -z "$DOWNLOAD" ]
then
# Check if /data is writable
if [ ! -w /data ]
then
echo "'/data' directory is not writable by '$(id -n -u):$(id -n -g)' ($(id -u):$(id -g)). ZIM file(s) can not be written."
exit 1
fi
# Dwonload ZIM file
ZIM=`basename $DOWNLOAD`
wget $DOWNLOAD -O "$ZIM"

View File

@@ -1,5 +1,5 @@
project('kiwix-tools', 'cpp',
version : '3.8.0',
version : '3.8.1',
license : 'GPL',
default_options: ['c_std=c11', 'cpp_std=c++17', 'werror=true'])

View File

@@ -60,8 +60,8 @@ static const char USAGE[] =
R"(Manipulates the Kiwix library XML file
Usage:
kiwix-manage LIBRARYPATH add [--zimPathToSave=<custom_zim_path>] [--url=<http_zim_url>] ZIMPATH
kiwix-manage LIBRARYPATH remove|delete ZIMID ...
kiwix-manage LIBRARYPATH add [--zimPathToSave=<custom_zim_path>] [--url=<http_zim_url>] ZIMPATH ...
kiwix-manage LIBRARYPATH (delete|remove) ZIMID ...
kiwix-manage LIBRARYPATH show [ZIMID ...]
kiwix-manage -v | --version
kiwix-manage -h | --help
@@ -69,7 +69,7 @@ Usage:
Arguments:
LIBRARYPATH The XML library file path.
ZIMID ZIM file unique ID.
ZIMPATH A path to a zim to add.
ZIMPATH A path to a ZIM to add.
Options:
Custom options for "add" action:
@@ -87,23 +87,24 @@ Examples:
Documentation:
Source code https://github.com/kiwix/kiwix-tools
More info https://wiki.kiwix.org/wiki/Kiwix-manage
More info https://wiki.kiwix.org/wiki/kiwix-manage
)";
int handle_show(const kiwix::Library& library, const std::string& libraryPath,
const Options& options)
{
if (options.at("ZIMID").isStringList()) {
auto bookIds = options.at("ZIMID").asStringList();
for(auto& bookId: bookIds) {
show(library, bookId);
}
} else {
if (options.at("ZIMID").asStringList().empty()) {
auto booksIds = library.getBooksIds();
for(auto& bookId: booksIds) {
show(library, bookId);
}
} else {
auto bookIds = options.at("ZIMID").asStringList();
for(auto& bookId: bookIds) {
show(library, bookId);
}
}
return(0);
}
@@ -115,19 +116,21 @@ int handle_add(kiwix::LibraryPtr library, const std::string& libraryPath,
kiwix::Manager manager(library);
std::string zimPath = options.at("ZIMPATH").asString();
if (options.at("--zimPathToSave").isString()) {
zimPathToSave = options.at("--zimPathToSave").asString();
} else {
zimPathToSave = zimPath;
}
if (options.at("--url").isString()) {
url = options.at("--url").asString();
}
auto zimPaths = options.at("ZIMPATH").asStringList();
for (auto& zimPath: zimPaths) {
if (options.at("--zimPathToSave").isString()) {
zimPathToSave = options.at("--zimPathToSave").asString();
} else {
zimPathToSave = zimPath;
}
if (options.at("--url").isString()) {
url = options.at("--url").asString();
}
if (manager.addBookFromPathAndGetId(zimPath, zimPathToSave, url, false).empty()) {
std::cerr << "Cannot add zim " << zimPath << " to the library." << std::endl;
return 1;
if (manager.addBookFromPathAndGetId(zimPath, zimPathToSave, url, false).empty()) {
std::cerr << "Cannot add ZIM " << zimPath << " to the library." << std::endl;
return 1;
}
}
return 0;

View File

@@ -104,16 +104,6 @@ std::string loadCustomTemplate (std::string customIndexPath) {
return indexTemplateString;
}
inline std::string normalizeRootUrl(std::string rootUrl)
{
while ( !rootUrl.empty() && rootUrl.back() == '/' )
rootUrl.pop_back();
while ( !rootUrl.empty() && rootUrl.front() == '/' )
rootUrl = rootUrl.substr(1);
return rootUrl.empty() ? rootUrl : "/" + rootUrl;
}
#ifndef _WIN32
volatile sig_atomic_t waiting = false;
volatile sig_atomic_t libraryMustBeReloaded = false;
@@ -393,13 +383,11 @@ int main(int argc, char** argv)
if (! server.start()) {
exit(1);
}
std::string prefix = "http://";
kiwix::IpAddress addresses = server.getAddress();
std::string suffix = ":" + std::to_string(server.getPort()) + normalizeRootUrl(rootLocation);
std::cout << "The Kiwix server is running and can be accessed in the local network at: " << std::endl;
if(!addresses.addr.empty()) std::cout << " - " << prefix << addresses.addr << suffix << std::endl;
if(!addresses.addr6.empty()) std::cout << " - " << prefix << "[" << addresses.addr6 << "]" << suffix << std::endl;
for (const auto& url : server.getServerAccessUrls()) {
std::cout << " - " << url << std::endl;
}
/* Run endless (until PPID dies) */
waiting = true;