358 Commits
Author SHA1 Message Date
Hamazasp Avetisyan 0d459296bd Replace OPDS rel="self" links with acquisition/open-access
rel="self" on a book entry misused the Atom/OPDS convention (which
normally names the feed/entry's own URL, not a local file path).
Local-path links are now written and parsed as
rel="http://opds-spec.org/acquisition/open-access" as well, with the
href's shape (absolute URL vs. path) telling readers which is which -
an entry may carry one of each.
2026-09-01 13:00:53 +04:00
Hamazasp Avetisyan 0c6ed03320 Add backward compatibility for readOpds() 2026-09-01 00:20:34 +04:00
Hamazasp Avetisyan 0125d0f248 Support writing the library as an OPDS document 2026-08-30 13:01:59 +04:00
Veloman Yunkan a64bb9ca7b Library::dumpOpds() 2026-08-30 00:51:41 +04:00
Hamazasp Avetisyan f67966216a Combine urlHost/libraryPath into contentOriginUri for readOpds()
readOpds() previously required callers to separately derive a host
string and a library path. Replace them with a single contentOriginUri
parameter, letting resolveContentOrigin() fully determine both
urlHost and baseDir from it based on whether it looks like a URL or a
local filesystem path.
2026-08-30 00:51:41 +04:00
Hamazasp Avetisyan 6d37a832c6 Adapt readOpds()'s body to resolveContentOrigin() (not yet fully functional)
Introduce a ContentOrigin struct and a resolveContentOrigin() helper
that will let readOpds() take a single contentOriginUri parameter
instead of separate urlHost/libraryPath ones. As a first step, wire
readOpds()'s body to use resolveContentOrigin() to derive baseDir from
libraryPath (replacing parseOpdsDom()'s internal
removeLastPathElement() call), while urlHost is still passed through
untouched.

This is not yet functional as a single-parameter API: readOpds()'s
public signature and callers are unchanged, and the urlHost side of
resolveContentOrigin() isn't exercised yet. That follows in the next
commit.
2026-08-30 00:51:41 +04:00
Hamazasp Avetisyan 866411df15 Thread library path through readOpds()/readFile() as baseDir
Manager::readOpds() gains a libraryPath parameter, resolved to a
baseDir via removeLastPathElement() and passed to
Book::updateFromOpds() so a rel="self" link in a library file read
via readFile() resolves relative to that file's own directory - the
OPDS analogue of readXml()'s existing "path" attribute handling.
2026-08-30 00:51:41 +04:00
Hamazasp Avetisyan cebdf87fb5 Enhance Book::updateFromOpds() to resolve a rel="self" link into a path
Mirrors updateFromXml()'s handling of the "path" attribute: if an OPDS
entry carries a <link rel="self" href="..."/>, resolve it (against
baseDir, when relative) into Book::m_path/m_pathValid. baseDir defaults
to "" so existing callers are unaffected until they start passing a
real value.
2026-08-29 21:32:26 +04:00
Hamazasp Avetisyan fe9efe84ec Add readOnly parameter to Manager::readOpds() 2026-08-29 21:32:26 +04:00
Hamazasp Avetisyan 70d751cdec Fix stale doc comment for readOpds()
The doc described params readOnly/libraryPath which do not exist on
readOpds() (leftover from a copy-paste of readXml()'s doc), and never
mentioned the actual urlHost parameter.
Also removed a comment in tets case that was refering to a class that was removed in previous branches.
2026-08-29 21:32:26 +04:00
Balazs Perlaki-Horvath 58e458b658 Update docs 2026-05-02 11:36:21 +02:00
Veloman Yunkan 34fc831c13 Documentation of a subset of Server API
Documentation of libkiwix API has been largely neglected. This commit
documents the Server API having to do with the functionality fixed in
the previous commit.
2026-02-24 16:10:57 +04:00
Nikhil Tanwar c5ec7651a6 Introduce Manager::addBooksFromDirectory()
Added a function to load books from a directory. Requires rootPath to iterate over.
2026-02-22 19:35:07 +01:00
Vighnesh 4928509991 Implement a function which returns server access url 2025-10-31 18:11:22 +05:30
Veloman Yunkan 5c8aa240ad SpellingsDB is created in a cache directory
The path parameter of the SpellingsDB constructor has been changed to
denote the path of the cache directory where spellings databases for
different ZIM archive should be stored. The filename of the spellings
database is generated from the ZIM archive UUID and the current version
of the spellings database implementation.
2025-10-06 17:20:22 +04:00
Veloman Yunkan 39672f0532 SpellingsDB reuses an existing database
Also the underlying Xapian database is now in a single-file format.
2025-10-06 17:20:13 +04:00
Veloman Yunkan 286649e8c3 Enter SpellingsDB 2025-10-06 17:19:32 +04:00
Veloman Yunkan 968d1c1067 Support for setting the content server URL 2025-09-08 18:39:48 +04:00
Veloman Yunkan 25e03ce597 Support for catalog-only mode 2025-09-08 18:39:48 +04:00
sgourdas b80699916d Refactor getBestPublicIp for both protocols 2024-10-02 20:55:11 +03:00
sgourdas 02ab2ce5a5 Make server getters const 2024-09-30 19:39:40 +03:00
sgourdas 8930095c52 Make IpMode members uppercase 2024-09-30 19:39:40 +03:00
Matthieu Gautier 7677f76854 Revert "Revert "Removed getDataDirectory()"" 2024-08-21 22:58:42 +02:00
ShaopengLin be464a5986 Introduce getSlugifiedFileName in tools.h
The function sanitizes file names depending on OS.
2024-08-14 20:11:11 +00:00
Veloman Yunkan 8d480c8b6d Introduced translateBookCategory() 2024-08-14 12:45:37 +04:00
Veloman Yunkan 82ff88f5d8 Made some i18n API public 2024-08-14 12:45:37 +04:00
Matthieu Gautier 5a73a75798 Revert "Removed getDataDirectory()" 2024-08-12 16:22:01 +02:00
sgourdas 9fd8e81de2 Remove getDataDirectory 2024-08-11 23:46:34 +03:00
sgourdas 566b40a2f8 Pass download directory directly to startDownload 2024-08-11 23:45:27 +03:00
Veloman Yunkan 5927550a36 kiwix::getNetworkInterfacesIPv4Or6()
- Restored kiwix::getNetworkInterfaces() API to the version before
  support for IPv6 was introduced

- Renamed the new API method to kiwix::getNetworkInterfacesIPv4Or6()
2024-06-11 11:19:49 +02:00
Veloman Yunkan 83101679a0 Backward compatible overload of getBestPublicIp() 2024-06-11 11:19:49 +02:00
Aryan Arora b7eadf95bf handle ip modes & add compilation flags for windows build 2024-05-29 21:05:01 +02:00
Aryan Arora a6cf161341 add ipv6 support to HTTP daemon 2024-05-29 21:05:01 +02:00
Emmanuel Engelhart 843adb3397 Improve documentation 2024-05-20 15:41:31 +02:00
Veloman Yunkan 3733e506c1 More reasonable criteria for reusing a download 2024-03-20 11:26:18 +04:00
Veloman Yunkan 4ab6215046 Downloader::Options typedef 2024-03-20 11:23:00 +04:00
Veloman Yunkan ff88430227 Documented the problem with startDownload() 2024-03-20 11:23:00 +04:00
Veloman Yunkan 5b9daf0d9d Extracted HumanReadableNameMapper::mapName()
No cleanup of the new function was performed to keep the diff minimal.
2024-03-06 11:43:43 +01:00
Matthieu Gautier 73b855ce6b Add a getBestTargetBookId directly taking bookName, flavour and date. 2024-02-15 14:52:57 +01:00
Matthieu Gautier eaca7010bc Fix definition of UPGRADE_ONLY and ALLOW_DOWNGRADE.
`MigrationMode` was kind of defined in the context of an internal mode
used by `migrateBookmark(...)`.
But now, with `getBestTargetBookId`, it is broken.

This commit fix that and the associated implementation.
Now `UPGRADE_ONLY` will make `getBestTargetBookId` return only newer books.
and `ALLOW_DOWNGRADE` will return older books only if current book is
invalid.
2024-02-15 14:52:57 +01:00
Matthieu Gautier 3e9d50fecb Make getBestTargetBookId public. 2024-02-15 14:52:57 +01:00
Matthieu Gautier f3a604380c Do not migrate bookmarks to an older book.
At least, it must be explicitly asked by the user.
2024-02-15 14:52:57 +01:00
Matthieu Gautier 8d97686b81 Introduce migrateBookmarks to move (invalid) bookmarks to new books. 2024-02-15 14:52:57 +01:00
Matthieu Gautier b16f6b9561 Allow to filter books by flavour. 2024-02-15 14:52:57 +01:00
Matthieu Gautier a546effa15 Allow bookmark to be created from a Book and url/title. 2024-02-15 14:52:57 +01:00
Matthieu Gautier 699f96ca0d Add book's flavour in bookmark. 2024-02-15 14:52:57 +01:00
Matthieu Gautier 5a0644d32b Also store book's name in bookmark. 2024-02-15 14:52:57 +01:00
Matthieu Gautier 9b9c61a194 Use a recursive_mutex instead of a mutex.
This allow us to internally call thread_safe function from already
locked context.
2024-02-15 14:52:57 +01:00
Veloman Yunkan 958067d94d Backend translates the search results page
Now the search results page is presented by the backend in the language
controlled by the value of the `userlang` URL query parameter (or, if
the latter is missing, the value of the `Accept-Language:` HTTP header).

Note that the front-end doesn't yet take advantage of this
functionality.
2024-02-01 18:27:54 +04:00
Matthieu Gautier 01aa190c38 Do not use [[nodiscard]] attribute on compiler not supporting it.
On aarch64, we use gcc version 6.3.0 which doesn't support the
`[[nodiscard]]` attribute
(see https://en.cppreference.com/w/cpp/compiler_support/17)

So don't set the attribute if the attribute is not present.
2023-10-16 14:41:30 +02:00