268 Commits
1.2.1 ... 3.4.0

Author SHA1 Message Date
Matthieu Gautier
756d5b4a04 Merge pull request #585 from kiwix/version_3.4.0 2022-11-30 18:09:14 +01:00
Matthieu Gautier
0f81dad6a4 New version 3.4.0
* Remove last reference to kiwix-read tool (@legoktm #569)

kiwix-serve
-----------

 * Fix broken indentation in usage (@kelson42 #560)
 * Exit if wrong arguments are passed (@kelson42 #567)
 * Do not allow multiple values for same option (@juuz0 #564)
 * Fix default location of "rootLocation" (@rgaudin #571)
 * [DOCKER] Change default port to 8080 (@neyder #581)
 * [DOCKER] Simplify dockerfile (@rgaudin #582)

kiwix-manage
------------

 * Fix man page (@kelson42 #576)
2022-11-30 18:04:27 +01:00
Kelson
252e3bc962 Merge pull request #582 from kiwix/simpler-dockerfile
Simpler dockerfile
2022-10-26 18:10:22 +02:00
renaud gaudin
cf6d66b2c2 Updated actions dependencies 2022-10-26 16:04:46 +00:00
renaud gaudin
a6713db7fe Simplified Dockerfile
- using alpine's dumb-init to remove builder
- simplifying arch management
- extracting to final location
2022-10-26 16:04:40 +00:00
Kelson
4137d9f517 Merge pull request #581 from neyder/master
Make kiwix-serve easily deployable on podman Openshift
2022-10-26 17:26:33 +02:00
Neyder Achahuanco Apaza
1a25b42517 Fixed README 2022-10-24 17:00:32 -05:00
Neyder Achahuanco Apaza
70c390c7d1 Modify documentation to reflect PORT variable and default to 8080 2022-10-23 09:54:46 -05:00
Neyder Achahuanco Apaza
847d1e9e76 Modify default port so it cna be used on secured kubernetes 2022-10-21 15:11:14 -05:00
Kelson
2a9378e24e Merge pull request #576 from kiwix/kiwix-manage-man-url-fix
Rewritten kiwix-manage man
2022-09-25 20:56:22 +02:00
Emmanuel Engelhart
dd53bef147 Fix: Create library file if necessary with 'add' action 2022-09-24 20:19:40 +02:00
Emmanuel Engelhart
6f0f666be5 Fix: Add actions in bold 2022-09-18 17:12:05 +02:00
Emmanuel Engelhart
0a7e91ceb7 Fix: Fix missing enclosures 2022-09-18 17:05:36 +02:00
Emmanuel Engelhart
db7f30fb81 Fix: Remove example library.xml because useless 2022-09-18 17:00:53 +02:00
Emmanuel Engelhart
3c6e8ed6c8 Fix: simple ALOS typo 2022-09-18 16:57:47 +02:00
Emmanuel Engelhart
cef30cd0b8 Rewritten kiwix-manage man page 2022-09-10 11:04:40 +02:00
Kelson
ce9e3e82e3 Merge pull request #569 from kiwix/rm-kiwix-search-man
Remove more references to kiwix-read
2022-07-31 09:45:54 +02:00
Kunal Mehta
0df3c14faa Remove more references to kiwix-read
Was removed in f9ce353ad1.
2022-07-31 09:43:53 +02:00
Kelson
092be45512 Merge pull request #571 from kiwix/rootLocation
Default kiwix-serve's rootLocation to "/"
2022-07-28 19:11:33 +02:00
renaud gaudin
442de30ff7 Normalize printed rootLocation
Reusing libkiwix's normalizeRootUrl() to display a more reliable representation of the
rootLocation the InternalServer will be using.

Can't reuse server.m_root as it is private.
2022-07-28 15:51:46 +00:00
renaud gaudin
9c16e53767 Default kiwix-serve's rootLocation to "/""
Usage mentions that the rootLocation defaults to `/` while it was not.
It defaulted to an empty string.

While it defaulting to "" or "/" has no technical consequence: libkiwix's server
normalizes the requested rootLocation ; it leads to users setting a "/"-prefixed
rootLocation when customizing it, resulting in double-slashed print of the URL
to access kiwix-serve at.

This harmonizes usage and actual default, fixing the URL print.
2022-07-28 11:30:48 +00:00
Matthieu Gautier
f9dc22a671 Merge pull request #565 from kiwix/multipleAddresses 2022-07-11 14:15:20 +02:00
Nikhil Tanwar
7526148f89 Do not allow multiple values for same option
Previously, kiwix-serve would take the last value for the same option. This was unintuitive.
This change exits the program if multiple values for the same option are found.
2022-07-11 11:21:09 +02:00
Kelson
da55468a88 Merge pull request #567 from kiwix/exit-if-argument-error
Exit if wrong argument given to kiwix-serve
2022-07-11 11:11:50 +02:00
Emmanuel Engelhart
86fac0e9af Exit if wrong argument given to kiwix-serve 2022-07-10 21:33:27 +02:00
Kelson
5709d4d489 Merge pull request #564 from kiwix/fixHeader
Add iostream header and namespace std
2022-07-07 06:34:51 +02:00
Nikhil Tanwar
8efa71d307 Use std namespace consistently
Previously, there was an inconsistent usage of no namespace vs namespace.
This change fixes that by correctly adding std:: whenever required.
Adds iostream header in src/version.h to fix cout/cerr problems.
2022-07-06 20:55:44 +05:30
Kelson
3f076c2b27 Merge pull request #560 from kiwix/fix-identation
Fix broken indentation in usage()
2022-06-23 10:30:47 +02:00
Emmanuel Engelhart
6266c3baa8 Fix broken indentation in usage() 2022-06-23 10:26:43 +02:00
Matthieu Gautier
b2bc6cead2 Merge pull request #559 from kiwix/version_3.3.0 2022-06-15 14:46:15 +02:00
Matthieu Gautier
b7a6f78150 New version 3.3.0 2022-06-15 14:25:48 +02:00
Kelson
9e3d4c9615 Merge pull request #558 from kiwix/limit_books_search
Add a option to limit the number of zim in a fulltext multizim search.
2022-06-14 11:03:14 +02:00
Matthieu Gautier
472ff19861 [CI] Use last docker image (and dependencies) 2022-06-14 10:49:46 +02:00
Matthieu Gautier
97aa28c74d Add a option to limit the number of zim in a fulltext multizim search. 2022-06-14 10:41:31 +02:00
Kelson
2c40d23991 Merge pull request #555 from kiwix/manager_add_no_library
It is ok to not be able to read library if we ADD book to non existant library
2022-06-06 17:37:24 +02:00
Matthieu Gautier
ca8d6e570c It is ok to not be able to read library if we ADD book to non existant lib 2022-06-03 10:54:43 +02:00
Matthieu Gautier
78887d6815 Merge pull request #553 from kiwix/manager_return_code 2022-06-03 09:11:59 +02:00
Matthieu Gautier
643a07f653 Make kiwix-manage return with something !0 if something went wrong 2022-06-02 23:01:58 +02:00
Matthieu Gautier
9a07dd8314 Merge pull request #546 from kiwix/fix_win_cross_compilation 2022-03-11 14:45:04 +01:00
Matthieu Gautier
bdd36f0379 Do not define stat if not necessary.
On recent mingw compiler, `stat` is already defined the same way we do.
So we don't need to do it.
2022-03-11 14:41:47 +01:00
Kelson
62195c788e Merge pull request #541 from kiwix/ci_fix 2022-02-14 10:34:52 +01:00
Veloman Yunkan
fa7948abbe Fixed armhf_static CI build 2022-02-14 11:17:37 +04:00
Kelson
2c701cb260 Merge pull request #535 from kiwix/saying_no_to_deprecated_libkiwix_api
Removed the usage of libkiwix deprecated API
2022-02-10 10:34:32 +01:00
Veloman Yunkan
8b36e94d50 Now kiwix-tools is built with werror=true 2022-02-10 13:13:11 +04:00
Veloman Yunkan
f9ce353ad1 Goodbye kiwix-read
`kiwix-read` was a confusing tool. It was a loose equivalent of
`kiwix-search --suggest` also able to work on old ZIM archives that didn't
contain a title index. Its existence is not justified.
2022-02-10 13:13:10 +04:00
Veloman Yunkan
2bb080ee3b Cleared kiwix-search of libkiwix deprecated API 2022-02-10 13:13:10 +04:00
Kelson
dd5aa33775 Merge pull request #534 from kiwix/ipLimit
Add ip connection limit option
2022-02-06 15:23:39 +01:00
Emmanuel Engelhart
0ed608f5c2 Cosmetic changes in kiwix-serve usage() 2022-02-06 15:22:09 +01:00
Nikhil Tanwar
8f4758a6a9 Add ip connection limit option
Adds --ipConnectionLimit/-L option to change MHD_OPTION_PER_IP_CONNECTION_LIMIT by calling server.setIpConnectionLimit()
2022-02-05 18:31:01 +05:30
Kelson
b10f2ed1a1 Merge pull request #530 from kiwix/legoktm-patch-1
PPA: Remove Ubuntu Hirsute, EOL
2022-02-01 08:29:22 +01:00
Kunal Mehta
94549828cb PPA: Remove Ubuntu Hirsute, EOL 2022-01-31 23:13:46 -08:00
Kelson
f342bd5e24 Merge pull request #526 from kiwix/legoktm-patch-1 2022-01-24 06:42:36 +01:00
Kunal Mehta
f316bb14a2 PPA: Fix libzim-dev and libkiwix-dev dependencies
Our libzim packages are "7.2.0~focal" but the ~ means that "7.2.0" is greater than
"7.2.0~focal" so the dependency can't be satisfied. Depending on "7.2.0~" will
allow "7.2.0~focal" to satisfy the dependency. Same for libkiwix.
2022-01-23 20:31:31 -08:00
Matthieu Gautier
ea44dc76f6 Merge pull request #525 from kiwix/version_3.2.0 2022-01-20 14:38:07 +01:00
Matthieu Gautier
6dfdcea5ce New version 3.2.0 2022-01-19 17:03:14 +01:00
Matthieu Gautier
0ef85944b8 Update dependencies.
zlib and microhttpd are used by libkiwix, not kiwix-tools.

We indeed need libzim, but we use no feature related to xapian so no
need to mark it as mandatory.
(Libkiwix needs it and the check is there)
2022-01-19 17:03:14 +01:00
Kelson
04ac15508f New deps needed (#523)
* kiwix-tools need libkiwix 10.0.0

* Compilation requires libzim 7.2.0 now
2022-01-19 13:04:25 +01:00
rgaudin
eeb41d8047 Merge pull request #524 from OlegSmelov/fix/dockerfile
Fix dumb-init HTTPS download in Dockerfile
2022-01-17 09:00:28 +00:00
Oleg Smelov
85a3093df3 Fix dumb-init HTTPS download in Dockerfile 2022-01-16 20:39:19 +02:00
Kelson
2c435926ca Merge pull request #522 from kiwix/showCustomRoot
Add root location in startup message
2022-01-14 16:18:34 +01:00
Nikhil Tanwar
b8c4791dd0 Add root location in startup message 2022-01-14 17:41:34 +05:30
Kelson
701541aa2f Merge pull request #520 from kiwix/no_werror
Do not compile with `werror=true`.
2022-01-12 19:20:17 +01:00
Matthieu Gautier
527981ba66 Do not compile with werror=true.
We are using `kiwix::Reader` and `kiwix::Searcher` which are now
deprecated.
Remove `werror` until we fix this.
2022-01-12 18:22:46 +01:00
Kelson
d8ed915c80 Merge pull request #517 from kiwix/fileExists
Change kiwix::fileExists to kiwix::fileReadable
2022-01-09 20:17:26 +01:00
Nikhil Tanwar
74d3bffde0 Change kiwix::fileExists to kiwix::fileReadable 2022-01-09 20:10:45 +01:00
Kelson
b974e121b4 Merge pull request #516 from kiwix/dependences_version
Print dependence versions
2022-01-03 09:02:58 +01:00
Emmanuel Engelhart
d2bb9d123e Print dependence versions 2022-01-03 08:54:38 +01:00
Kelson
9b158360a6 Merge pull request #499 from kiwix/startup-message
Add startup message to provide http url to server
2021-12-22 18:38:25 +01:00
Nikhil Tanwar
7d2c67f43d Add startup message to provide http url to server 2021-12-22 18:37:13 +01:00
Kelson
a080a3137e Merge pull request #515 from kiwix/dumb-init
Fixed docker image for non-amd64 platforms
2021-12-21 12:00:29 +01:00
renaud gaudin
dedcae83cd Fixed docker image for non-amd64 platforms
PR#489 (01430603b6) introduced dumb-init for better
signals handling.
While this has the intended effect, it was done ny downloading the dumb-init static bin
into the image… only using the amd64 version.

Ever since, the image(s) have been broken for armv7 and arm64.

As dumb-init doesn't provide 32b arm binary and because it's such a simple/small code,
this fix compiles it in a builder shallow image ; ensuring we're getting an appropriate
binary for the target arch.

We are also statically linking against musl-C as this is supported by dumb-init and is
much smaller than glibc.
2021-12-21 10:27:28 +00:00
Kelson
c0fa06c931 Merge pull request #514 from kiwix/legoktm-patch-1
PPA: Reinstate Ubuntu Impish, add Jammy
2021-12-20 07:57:17 +01:00
Kunal Mehta
dbe6126496 PPA: Reinstate Ubuntu Impish, add Jammy 2021-12-19 16:47:59 -08:00
Kelson
94bf71eb82 Merge pull request #512 from kiwix/updated-kiwix-serve-usage-message 2021-12-13 19:19:17 +01:00
Veloman Yunkan
25e9941f6a Mentioned --monitorLibrary in the help message 2021-12-13 22:16:47 +04:00
Kelson
81d8ad964a Merge pull request #511 from kiwix/kiwix-serve-help-option 2021-12-13 17:16:19 +01:00
Emmanuel Engelhart
9a49623879 Add -h/--help option to kiwix-serve 2021-12-13 15:48:42 +01:00
Kelson
f7f10597eb Merge pull request #504 from fazlerabbi37/feature-docker-compose
Add docker-compose for kiwix-server
2021-12-11 05:13:30 +01:00
Fazle Rabbi
c8be7c47ca Modify README.md to link to docker-compose doc 2021-12-10 21:09:14 +06:00
Fazle Rabbi
f356587b23 Add docker-compose for kiwix-server
added docker-compose for kiwix-server via docker-compose.yml.example which supports both local and remote zim file.
updated README.md to update about docker-compose.yml.example
2021-12-09 18:16:41 +06:00
Matthieu Gautier
32432a7113 Merge pull request #503 from kiwix/automatic_library_reloading 2021-12-06 10:53:13 +01:00
Veloman Yunkan
7985ba1b0c kiwix-serve [--monitorLibrary|-M] 2021-12-05 19:53:18 +04:00
Kelson
933aa0cd63 Merge pull request #497 from kiwix/library_reloading
Library reloading on SIGHUP
2021-12-03 16:34:26 +01:00
Veloman Yunkan
098e1cfe51 Library reloading on SIGHUP
Note that this enhancement drops the --donottrustlibrary mode.
2021-12-03 18:52:34 +04:00
Kelson
43b5be179a Merge pull request #501 from kiwix/fix_option_parsing
Add missing break in the switch case.
2021-12-01 15:44:12 +01:00
Matthieu Gautier
88213b3f3b Add missing break in the switch case.
Fix #500
2021-12-01 15:41:16 +01:00
Matthieu Gautier
7659efa97c Merge pull request #488 from kiwix/kiwix-serve_sigterm_handling 2021-10-18 10:42:54 +02:00
Veloman Yunkan
4faaa978f7 Handling of SIGTERM & SIGINT in kiwix-serve 2021-10-18 00:01:25 +04:00
Matthieu Gautier
d73fcb357f Merge pull request #491 from kiwix/fix_ci_docker_version 2021-10-14 14:18:52 +02:00
Matthieu Gautier
61e82228a4 Last CI docker image is 31 2021-10-14 14:16:13 +02:00
Matthieu Gautier
01430603b6 Merge pull request #489 from kiwix/docker-signals 2021-10-14 14:12:23 +02:00
renaud gaudin
6c31d0d7b0 Fixed #482: use dumb-init in docker for signal forwarding
Following-up on discussion in #488, now using https://github.com/Yelp/dumb-init
as entrypoint so our kiwix-* tools properly receives signals
2021-10-14 09:30:04 +02:00
Kelson
c1731c9697 Merge pull request #490 from kiwix/ci-disable-impish
Disable Ubuntu Impish in CI
2021-10-14 09:29:35 +02:00
Emmanuel Engelhart
929c36c930 Disable Ubuntu Impish in CI 2021-10-14 09:26:46 +02:00
Kelson
3df4a94863 Merge pull request #477 from kiwix/kiwix-serve/issue/571
added --customIndexTemplate option
2021-10-13 06:55:12 +02:00
Emmanuel Engelhart
2cd190e965 Tune a bit an error message 2021-10-11 15:32:08 +02:00
Manan Jethwani
6a7c737d48 added --customIndexTemplate option 2021-10-11 18:55:47 +05:30
Kelson
b20e83bd0b Merge pull request #485 from karandeeppotato/issue#483 2021-09-29 18:36:25 +02:00
karandeeppotato
7a3f77dbf2 Removed a redundant error message from kiwix-serve
The error message about failing to open the specified port was produced both
by kiwix-tools/src/server/kiwix-serve.cpp and by the InternalServer
constructor (in libkiwix/src/server/internalServer.cpp).
2021-09-29 18:47:55 +05:30
Kelson
71e065312f Merge pull request #474 from kiwix/remove_groovy_package
Remove Groovy package
2021-07-28 21:38:40 +02:00
Emmanuel Engelhart
9f207a61f9 Remove Groovy package 2021-07-28 21:35:58 +02:00
Kelson
43656554f1 Merge pull request #465 from kiwix/ppa-impish
PPA: Build for Ubuntu Impish
2021-07-08 13:16:03 +02:00
Kunal Mehta
7d55c0f6ac PPA: Build for Ubuntu Impish 2021-07-08 13:13:21 +02:00
Kelson
c3721970c5 Merge pull request #468 from kiwix/new_tools_libkiwix
Adapt kiwix-tools to the new libkiwix headers.
2021-07-08 13:10:45 +02:00
Matthieu Gautier
81ac333cc9 Adapt kiwix-tools to the new libkiwix headers.
Fix #467
2021-07-08 10:09:17 +02:00
Kelson
d1edbc11d3 Merge pull request #462 from kiwix/update-readme-libkiwix
Kiwix-tools does not depend on libmicrohttpd anymore
2021-05-30 15:55:05 +02:00
Emmanuel Engelhart
47929008cf Kiwix-tools does not depend on libmicrohttpd anymore 2021-05-30 15:33:52 +02:00
Kelson
4ba79d9776 Merge pull request #459 from kiwix/update-readme-libkiwix
Update readme libkiwix
2021-05-28 14:10:45 +02:00
Emmanuel Engelhart
c1e2913f24 Kiwix-lib has been renamed to libkiwix, update README.md 2021-05-28 09:56:37 +02:00
Kelson
ac3e889388 Merge pull request #461 from kiwix/use_suggestion_class_functions
Use SuggestionItem member function getTitle()
2021-05-28 09:55:17 +02:00
Maneesh P M
6d9fa0cb45 Use SuggestionItem member function getTitle()
We have introduced a new class SuggestionItem in libkiwix, it must be
used in kiwix-tools as well for handling suggestions.
2021-05-28 12:56:22 +05:30
rgaudin
c76bbabd10 Merge pull request #455 from kiwix/kiwix-tools-docker-badge
Add kiwix-tools Docker badge
2021-05-03 07:55:06 +00:00
Kelson
a5cf735ffe Add kiwix-tools Docker badge 2021-05-02 09:50:05 +02:00
Matthieu Gautier
b064796c2d Merge branch 'arjun-369-master' 2021-04-28 14:49:20 +02:00
arjun-369
6f2316bc8a Update kiwix-search.cpp for a bug fix 2021-04-28 14:48:46 +02:00
Kelson
b2aeb08051 Merge pull request #433 from kiwix/better-pid-type-conversion
Better PID type conversion
2021-01-24 19:41:11 +01:00
luddens
17b7fb2145 Better PID type conversion 2021-01-24 11:22:57 +01:00
Kelson
36c7bf4d6f Better Docker badge 2021-01-11 10:41:38 +01:00
renaud gaudin
a3ed7ad3e1 using two jobs to isolate envs 2021-01-08 18:35:23 +00:00
rgaudin
b7d884ceb2 Merge pull request #429 from kiwix/docker
CI built docker image
2021-01-08 15:33:26 +00:00
renaud gaudin
19322958b3 Support for non-release builds
- only building on workflow_dispatch with a specified version that can be a release or release-build
2021-01-08 15:29:19 +00:00
renaud gaudin
ccb8d11dce CI built docker image
- added a new generic kiwix/kiwix-tools image
- kiwix/kiwix-serve now based on kiwix/kiwix-tools ; with its entrypoint
- both images are built with official binary distribution
- both images are built on github action and pushed to both docker.io and ghcr.io
- both images are multi-arch and support arm/v7, arm64 and amd64
- built on release published or workflow_dispatch event (to be triggered by kiwix-build)
2021-01-07 22:13:49 +00:00
Kelson
7bdbe901db Merge pull request #419 from kiwix/legoktm-patch-1
PPA: Build for Ubuntu Hirsute
2020-12-18 23:51:42 +01:00
Kunal Mehta
7e6e74330a PPA: Build for Ubuntu Hirsute 2020-12-03 22:48:19 -08:00
Matthieu Gautier
9efd18a9a4 Merge pull request #409 from kiwix/kelson42-patch-1
Add instructions to build image for ARM
2020-09-21 18:12:29 +02:00
Kelson
0e9f406180 Add instructions to build image for ARM 2020-09-19 13:55:15 +02:00
Kelson
0160f356a6 Merge pull request #405 from kiwix/multiarch-docker
Add support for ARM in Docker
2020-09-02 17:13:37 +02:00
renaud gaudin
8cc34782bc support arm arch for kiwix-serve image 2020-08-31 11:27:29 +02:00
Kelson
b2c68d7f22 Merge pull request #403 from hashworks/archCommunityPkg
Add repology package badge
2020-08-30 22:06:42 +02:00
hashworks
977cfb9887 Switch to repology package badge 2020-08-30 21:00:28 +02:00
hashworks
1671effaf4 Replace AUR shield with official Arch Linux package
I recently became an Arch Linux Trusted User and moved kiwix-tools to
the official community repository. Hence, the shield needs to be
updated.
2020-08-30 13:19:28 +02:00
Kelson
8d00e45d2a Merge pull request #398 from kiwix/ppa-sync
PPA: Drop eoan and sync with proper Debian package
2020-07-24 12:42:19 +02:00
Kunal Mehta
730f20e86f debian: Sync with proper Debian package, bump to debhelper 13 2020-07-24 03:08:53 -07:00
Kunal Mehta
ff5f1d96d2 PPA: Drop Ubuntu eoan, EOL
Launchpad no longer accepts eoan uploads.
2020-07-24 03:07:47 -07:00
Kelson
d1d72218b3 Example with multiple ZIM files 2020-07-22 16:53:31 +02:00
Matthieu Gautier
88269c1ff2 Merge pull request #394 from kiwix/ppa 2020-07-20 11:54:56 +02:00
Kunal Mehta
4ee202514e PPA: Set fail-fast: false
See discussion/rationale on <https://github.com/openzim/libzim/pull/370>.
2020-07-16 06:04:01 -07:00
Kunal Mehta
98b372ee17 Automatically build and publish packages via Github Actions
Same exact configuration as kiwix-lib.
2020-07-13 17:46:02 -07:00
Kunal Mehta
8e5df188b3 Add minimal Debianization for our PPA 2020-07-13 17:45:59 -07:00
Matthieu Gautier
ed709454bd Merge pull request #392 from kiwix/manpages
Add man pages for kiwix-read and kiwix-search
2020-07-09 10:47:06 +02:00
Kunal Mehta
f5762c72d3 Add man pages for kiwix-read and kiwix-search 2020-07-09 10:44:34 +02:00
Matthieu Gautier
1744b152ac Merge pull request #393 from kiwix/legoktm-grammar
Improve grammar in kiwix-search help
2020-07-09 10:42:20 +02:00
Kunal Mehta
7f09e55077 Improve grammar in kiwix-search help
Suggested by Debian's lintian.
2020-07-09 00:35:24 -07:00
Matthieu Gautier
fdec897bc7 Release 3.1.2 2020-07-02 15:20:01 +02:00
Matthieu Gautier
764dd8848b Merge pull request #391 from kiwix/new_kiwixlib_suggestion_api
Use new suggestion API of kiwix-lib.
2020-07-02 14:39:53 +02:00
Matthieu Gautier
4a944cc901 Use new suggestion API of kiwix-lib.
Old API is not threadsafe and is deprecated.
2020-07-01 16:51:41 +02:00
Matthieu Gautier
4120e7fd25 New version 3.1.1 2020-05-18 15:17:14 +02:00
Matthieu Gautier
8736a2f4ea Merge pull request #383 from kiwix/include_windows 2020-05-18 13:38:38 +02:00
Matthieu Gautier
00b810d649 Include missing "windows.h"
Now that libzim doesn't inculde "windows.h" in its public headers it fails
if we don't include it.
2020-05-18 13:27:14 +02:00
Matthieu Gautier
5d21baa759 Fix typo in meson.build 2020-04-09 23:51:23 +02:00
Matthieu Gautier
6ba6046850 New version 3.1.0 2020-04-08 18:01:34 +02:00
Matthieu Gautier
d24f474dda Merge pull request #367 from kiwix/block-external-links
Add support for external links blocking in kiwix-serve
2020-04-06 20:15:08 +02:00
Kelson
07de2d29c4 Merge pull request #371 from kiwix/better-ci-event
Run Github actions on any push (not only in PR)
2020-04-03 16:28:34 +02:00
Kelson
d99e5cd975 Run Github actions on any push (not only in PR) 2020-04-03 16:26:47 +02:00
Kelson
f82d5aa7e5 CI badge from Github actions (instead of Travis) 2020-04-03 16:24:04 +02:00
renaud gaudin
824aef9189 Add support for external links blocking in kiwix-serve
Add a new `-b` `--blockexternallinks` option to kiwix-serve
triggering the corresponding response taskbar option in kiwix-lib.
2020-04-02 09:10:00 +00:00
Kelson
d6914eb34f Bump-up version to 3.0.3 2020-03-01 15:50:32 +01:00
Kelson
b65212fab7 Merge pull request #364 from kiwix/fix-argument-parsing
Fix argument parsing
2020-03-01 15:49:17 +01:00
Kelson
83427af3d2 Update Changelog 2020-03-01 15:45:31 +01:00
Kelson
d572bf875d Better --version argument parsing 2020-03-01 15:42:44 +01:00
Kelson
833c997782 Remove usell origId option parsing 2020-03-01 15:36:31 +01:00
Kelson
44613aae5d Print information about /data if error 2020-02-18 08:38:18 +01:00
Matthieu Gautier
62e6c7ffb0 Merge pull request #359 from kiwix/new_version
New version 3.0.2
2020-02-13 11:44:29 +01:00
Matthieu Gautier
1df899ea87 New version 3.0.2 2020-02-12 15:23:29 +01:00
Kelson
3dd357e8ac Merge pull request #356 from kiwix/missing-options
added shortcut for options --address and --nodatealiases
2020-02-10 16:42:24 +01:00
renaud gaudin
2744879df0 added shortcut for options --address and --nodatealiases
* allowed shortcut `-i` for `--address`
* allowed shortcut `-z` for `--nodatealiases`
2020-02-10 15:30:31 +00:00
Matthieu Gautier
19c3ebe629 Merge pull request #353 from kiwix/trust_library
[serve] Trust the library by default.
2020-02-05 11:06:05 +01:00
Kelson
cccd17a394 Github Kiwix Sponsoring page link 2020-02-01 17:56:27 +01:00
Matthieu Gautier
e9676ae66f [serve] Trust the library by default.
Now `kiwix-serve` trust the information in the library.xml.
We do not open all zim file at startup and so kiwix-serve starts faster.

Need kiwix/kiwix-lib#314
Fix #319
2020-01-30 17:58:41 +01:00
Matthieu Gautier
2fd393285f Use github action for the CI. (#352)
Use github action for the CI.
2020-01-21 18:52:26 +01:00
Matthieu Gautier
a44fd1a4d0 Use github action for the CI. 2020-01-21 18:50:58 +01:00
Kelson
a9ff2aebee Simpliciation of README 2020-01-16 16:02:59 +01:00
Kelson
a2b944618f More debug messages at kiwix-serve start 2020-01-16 14:57:53 +01:00
Kelson
d27abb41b7 Fix wrong URL in Kiwix serve Docker documentation 2020-01-16 14:49:17 +01:00
Kelson
5f12d0349f Use latest version of kiwix-serve in Dockerfile 2020-01-16 14:19:46 +01:00
Kelson
7ec2308053 Add ability to download a file at container start 2020-01-16 14:04:03 +01:00
Kelson
e8b33a7136 Merge pull request #326 from kiwix/version
Version
2019-12-05 02:06:42 -05:00
Kelson
ca943b9d0b Rename VERSION to KIWIX_TOOLS_VERSION to avoid collision 2019-12-05 07:59:57 +01:00
Kelson
c6757dd309 Various README.md improvements 2019-12-05 07:59:07 +01:00
Kelson
23b0ff3d01 Update changelog 2019-12-05 07:57:52 +01:00
Kelson
93116c76b3 Add --version option to kiwix-read 2019-12-05 07:57:52 +01:00
Kelson
4aca5ff551 Add --version option to kiwix-search 2019-12-05 07:57:52 +01:00
Kelson
4eb38869c1 New --version argument to kiwix-manage 2019-12-05 07:57:52 +01:00
Kelson
d17fd2af94 Add --version argument to kiwix-serve 2019-12-05 07:57:52 +01:00
Kelson
48db92af09 Move version.h to src/ 2019-12-05 07:57:52 +01:00
Kelson
612081ec51 Compile with Meson version #defined 2019-12-05 07:57:52 +01:00
Kelson
4b5eb482b5 New version() function 2019-12-05 07:57:52 +01:00
Kelson
28997ccd58 Bump-up version to 3.0.2 2019-12-05 07:57:52 +01:00
Kelson
9dd042d813 travis-ci.org -> travis-ci.com 2019-12-05 06:56:43 +01:00
Kelson
61580bb738 Add 'Distribution' section in README.md 2019-11-23 17:57:12 +01:00
Kelson
dbae6439b2 Use latest version of kiwix-serve 2019-09-29 01:56:45 +02:00
Kelson
d6094b4112 Merge pull request #334 from kiwix/docker-badge-fix
Fix Docker badge
2019-09-08 20:07:33 +02:00
Kelson
64f1aa2408 Fix Docker badge 2019-09-08 20:06:51 +02:00
Kelson
ed1bae76c3 Merge pull request #333 from kiwix/aur-badges
Add AUR badge
2019-09-08 17:10:27 +02:00
Kelson
7418702a07 Add AUR badge 2019-09-08 17:08:09 +02:00
Kelson
796614fd7d New kiwix-serve screenshots 2019-08-27 16:37:22 +02:00
Kelson
2ba9037687 Merge pull request #328 from kiwix/better-readme
Better README.md
2019-08-27 14:59:51 +02:00
Kelson
22be7c0dcf Better README.md 2019-08-27 14:59:03 +02:00
Kelson
3fc9525754 Remove benchmark.sh 2019-08-27 14:46:10 +02:00
Kelson
a9d8f77526 Merge pull request #327 from kiwix/remove-backticks
Remove backticks from benchmark.sh
2019-08-27 14:42:38 +02:00
Kelson
1109b62570 Remove backticks from benchmark.sh 2019-08-27 14:27:44 +02:00
Kelson
3248c0f233 Merge pull request #325 from kiwix/last-kiwix-serve
Use kiwix-serve 3.0.1
2019-08-22 20:49:26 +02:00
Kelson
f8f66288ea Use kiwix-serve 3.0.1 2019-08-22 20:42:49 +02:00
Matthieu Gautier
98c810eb2a Nodatealiases regression fix (#324)
Nodatealiases regression fix
2019-08-22 17:31:51 +02:00
Kelson
50ca36417f Remove [[gnu::unused]] for noDateAliasesFlag variable 2019-08-22 17:28:25 +02:00
Kelson
5a2714c9c9 Fix --nodatealiases inverted logic regression 2019-08-22 17:23:18 +02:00
Kelson
63cc513974 Bump-up version to 3.0.1 2019-08-22 17:23:11 +02:00
Matthieu Gautier
63ec03a3d4 New version (#320)
New version
2019-08-20 14:32:54 +02:00
Matthieu Gautier
e2f7c7a0ac New version 3.0.0 2019-08-19 17:26:37 +02:00
Matthieu Gautier
a14cd5de23 Fix kiwix-serve usage message. 2019-08-19 17:26:28 +02:00
Matthieu Gautier
06c31430c5 Port kiwix-serve to new api in kiwix-lib to serve a content. (#315)
Port kiwix-serve to new api in kiwix-lib to serve a content.
2019-08-12 15:25:35 +02:00
Matthieu Gautier
8ffff9cd47 Port kiwix-serve to new api in kiwix-lib to serve a content.
A lot of code removed from this repository !!
2019-08-11 11:59:21 +02:00
Kelson
ef0fc514ad Configure the Move bot 2019-08-05 10:32:37 +02:00
Kelson
6c1739d4cd Merge pull request #314 from kiwix/nolibrarybutton-fix
Fix buggy --nolibrarybutton (regression)
2019-08-04 22:15:40 +02:00
Kelson
cd44ba53a5 Fix buggy --nolibrarybutton (regression) 2019-08-04 20:19:47 +02:00
Matthieu Gautier
d82f9e7d5e Merge pull request #312 from kiwix/new_version
New version 2.1.0
2019-07-31 14:33:54 +02:00
Matthieu Gautier
720a319d53 New version 2.1.0 2019-07-30 17:46:38 +02:00
Matthieu Gautier
2426c35547 Merge pull request #306 from kiwix/multiple-tags-api
search api accept multiple tags parameter
2019-07-30 17:32:27 +02:00
luddens
794f63e22b search api accept multiple tags parameter 2019-07-30 16:56:48 +02:00
Matthieu Gautier
79a64d5af3 Merge pull request #305 from kiwix/notag-parameter
add notag parameter to the api
2019-07-29 14:51:31 +02:00
luddens
2ef160bcad add notag parameter to the api
this parameter get a string that contains all tags to exclude separated by
a ";". The kiwix::Filter() is set with this rejected tags.
2019-07-25 15:17:42 +02:00
Kelson
817a5d4847 Merge pull request #311 from kiwix/tools-details
Infos about the tools
2019-07-21 15:58:08 +02:00
Kelson
2c3882671b Infos about the tools 2019-07-21 15:36:27 +02:00
Kelson
7e2c5bda03 Merge pull request #310 from kiwix/better-taskbar-padding
Increase a bit the taskbar padding
2019-07-13 07:19:40 +02:00
Kelson
59281bf496 Increase a bit the taskbar padding 2019-07-12 21:33:37 +02:00
Kelson
ee9ae0e81f Merge pull request #309 from kiwix/better-taskbar-padding
Better kiwix-serve content (because of taskbar) top-padding
2019-07-12 20:18:25 +02:00
Kelson
2dbe0a0016 Better kiwix-serve content (because of taskbar) top-padding 2019-07-12 20:14:00 +02:00
Kelson
64717c2124 Merge pull request #300 from kiwix/ISNIT0/server-toolbar
Make server toolbar auto-hide and collapse buttons into dropdown on small screens
2019-07-09 12:36:23 +02:00
Kelson
fc1eb3c282 Bump-up kiwix-tools version to 2.1.0 2019-07-09 12:31:25 +02:00
Kelson
e31c1cd9a3 Update Changelog 2019-07-09 12:31:22 +02:00
Joe Reeve
e897dd4e59 Update classes and ids to have Kiwix namespace 2019-07-09 12:24:57 +02:00
Joe Reeve
7db7d2a2ab Switch caret to image and move JS to separate file 2019-07-09 12:24:57 +02:00
Joe Reeve
5b612e67bd Fix a few bugs found in code review 2019-07-09 12:24:57 +02:00
Joe Reeve
df047588a9 fix kiwix-serve toolbar search icon on article pages 2019-07-09 12:24:57 +02:00
Joe Reeve
9dede26717 Search icon positioning fix for Firefox 2019-07-09 12:24:57 +02:00
Joe Reeve
a22ae3d467 👌 updates from pr review 2019-07-09 12:24:57 +02:00
Joe Reeve
ea93a8a195 Fix padding and search bug, update button toggle icon 2019-07-09 12:24:57 +02:00
Joe Reeve
0a7f375f3a Format taskbar.css 2019-07-09 12:24:57 +02:00
Joe Reeve
66c35b7b3e Fix alignment, improve search box appearance 2019-07-09 12:24:57 +02:00
Joe Reeve
bad7f2ddf1 Make server toolbar auto-hide and collapse buttons into dropdown on small screens 2019-07-09 12:24:57 +02:00
Matthieu Gautier
758014a5ba Merge pull request #304 from kiwix/int_retcode
Use integer to store the returnCode.
2019-07-01 11:24:22 +02:00
Matthieu Gautier
4fd961a761 Use integer to store the returnCode.
If we want to return `-1` we must use a integer, not a bool.
2019-06-27 19:15:41 +02:00
Matthieu Gautier
c063587a69 Merge pull request #303 from kiwix/no_unistd
Remove include of unistd.h
2019-06-27 18:49:13 +02:00
Matthieu Gautier
9b24676b02 Remove include of unistd.h
unistd.h is useless.
2019-06-27 18:20:22 +02:00
Matthieu Gautier
fc5572f495 Merge pull request #302 from kiwix/adapt_to_new_book_filter
Adapt kiwix-serve to the new api to filter library.
2019-06-27 09:55:50 +02:00
Matthieu Gautier
a1b3f46e4e Adapt kiwix-serve to the new api to filter library.
See kiwix/kiwix-lib#234
2019-06-26 17:38:35 +02:00
Kelson
e0177c4923 Create FUNDING.yml 2019-06-22 07:58:19 +02:00
Matthieu Gautier
a365c1e720 Merge pull request #297 from kiwix/new_version
New version 2.0.0
2019-05-29 12:00:23 +02:00
Matthieu Gautier
3e97352128 [CI] Build on xenial. 2019-05-29 11:52:03 +02:00
Matthieu Gautier
78d2530878 New version 2.0.0 2019-05-29 11:52:03 +02:00
Kelson
d09f481b47 Merge pull request #298 from kiwix/better_usage
Small updates of the README
2019-05-29 10:37:27 +02:00
Emmanuel Engelhart
e0f07086d5 Small updates of the README 2019-05-29 10:29:48 +02:00
Kelson
bbff57e6aa Merge pull request #290 from kiwix/add_footer
Add footer
2019-05-14 13:29:47 +02:00
Kelson
3c24d0a026 Add kiwix-serve welcome page footer 2019-05-04 14:09:26 +02:00
Kelson
6107bad17e Remove deprecated js code 2019-05-04 13:44:06 +02:00
Kelson
5931ac45c4 Merge pull request #289 from kiwix/fix_multiple_add
Correctly set the zimPathToSave if there are several zim file to add.
2019-05-03 12:50:19 +02:00
Matthieu Gautier
4de8623a52 Correctly set the zimPathToSave if there are several zim file to add.
The variable `zimPathToSave` is used to store the option passed by the
user.
If we reuse this variable to store the real path to use for the first
zim file, then we will mess the path to save of other zim files.

Let's use a local variable here.

Fix #288
2019-05-03 12:09:23 +02:00
Kelson
6eace310a2 Merge pull request #284 from kiwix/better_kiwix-serve_usage
Better kiwix-serve usage()
2019-05-03 11:49:58 +02:00
Kelson
c6499ad5c6 Fix typo in kiwix-manage usage() 2019-05-03 11:41:18 +02:00
Emmanuel Engelhart
34ceaf37f2 Better kiwix-serve usage() 2019-05-03 11:38:35 +02:00
Kelson
f05096e2ce Merge pull request #282 from kiwix/better_usage
Better kiwix-manage usage()
2019-05-03 11:31:48 +02:00
Emmanuel Engelhart
3864b2404c Better kiwix-manage usage() 2019-05-03 11:23:53 +02:00
Kelson
4cd74dca4b Merge pull request #283 from kiwix/remove_download_action
Remove kiwix-manage download action
2019-05-03 10:50:11 +02:00
Kelson
88cea54520 Revert "[kiwix-manage] Add a download command to kiwix-manage."
This reverts commit c1e635bd4e.
2019-05-03 10:42:14 +02:00
Matthieu Gautier
3061c8bba3 Merge pull request #281 from kiwix/thread_win
Do not use this_thread::sleep or thread::hardware_concurrency.
2019-04-17 17:57:03 +02:00
Matthieu Gautier
2774eb9529 Do not use this_thread::sleep or thread::hardware_concurrency.
Mingw doesn't implement them. So, we should not use it.
I suppose that it was working before because mingw package for debian trusty
simply no provides a "thread" header.
We may face to include the native "thread" header.
2019-04-17 15:48:33 +00:00
Kelson
77dc2ef2ed Merge pull request #280 from kiwix/3_columns_fix
Display cards in 3 columns properly
2019-04-17 16:44:18 +02:00
Emmanuel Engelhart
17d11f9772 Display cards in 3 columns properly 2019-04-17 09:12:23 +02:00
67 changed files with 1121 additions and 12056 deletions

12
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: kiwix # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # https://kiwix.org/support-us/

27
.github/move.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
# Configuration for Move Issues - https://github.com/dessant/move-issues
# Delete the command comment when it contains no other content
deleteCommand: true
# Close the source issue after moving
closeSourceIssue: true
# Lock the source issue after moving
lockSourceIssue: false
# Mention issue and comment authors
mentionAuthors: true
# Preserve mentions in the issue content
keepContentMentions: true
# Move labels that also exist on the target repository
moveLabels: true
# Set custom aliases for targets
# aliases:
# r: repo
# or: owner/repo
# Repository to extend settings from
# _extends: repo

72
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
name: CI
on: [push]
jobs:
Linux:
strategy:
fail-fast: false
matrix:
target:
- native_static
- native_dyn
- win32_static
- win32_dyn
include:
- target: native_static
image_variant: bionic
lib_postfix: '/x86_64-linux-gnu'
- target: native_dyn
image_variant: bionic
lib_postfix: '/x86_64-linux-gnu'
- target: win32_static
image_variant: f35
lib_postfix: '64'
- target: win32_dyn
image_variant: f35
lib_postfix: '64'
env:
HOME: /home/runner
runs-on: ubuntu-latest
container:
image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-31"
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Checkout code
shell: python
run: |
from subprocess import check_call
from os import environ
command = [
'git', 'clone',
'https://github.com/${{github.repository}}',
'--depth=1',
'--branch', '${{steps.extract_branch.outputs.branch}}'
]
check_call(command, cwd=environ['HOME'])
- name: Install deps
shell: bash
run: |
ARCHIVE_NAME=deps2_${OS_NAME}_${{matrix.target}}_kiwix-tools.tar.xz
wget -O- http://tmp.kiwix.org/ci/${ARCHIVE_NAME} | tar -xJ -C /home/runner
- name: Compile
shell: bash
run: |
if [[ "${{matrix.target}}" =~ .*_static ]]; then
MESON_OPTION="-Dstatic-linkage=true"
else
MESON_OPTION=""
fi
if [[ ! "${{matrix.target}}" =~ native_.* ]]; then
MESON_OPTION="$MESON_OPTION --cross-file $HOME/BUILD_${{matrix.target}}/meson_cross_file.txt"
fi
cd $HOME/kiwix-tools
meson . build ${MESON_OPTION}
cd build
ninja
env:
PKG_CONFIG_PATH: "/home/runner/BUILD_${{matrix.target}}/INSTALL/lib/pkgconfig:/home/runner/BUILD_${{matrix.target}}/INSTALL/lib${{matrix.lib_postfix}}/pkgconfig"
CPPFLAGS: "-I/home/runner/BUILD_${{matrix.target}}/INSTALL/include"

65
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,65 @@
name: Docker
on:
workflow_dispatch:
inputs:
version:
description: Specific version to build (overrides on-master and tag-pattern)
required: false
default: ''
jobs:
build-and-push-kiwix-tools:
name: Deploy kiwix-tools Docker Image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3.1.0
- name: build and publish kiwix-tools
uses: openzim/docker-publish-action@v9
with:
image-name: kiwix/kiwix-tools
credentials: |
DOCKERIO_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
DOCKERIO_TOKEN=${{ secrets.DOCKERHUB_PASSWORD }}
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
context: docker
latest-on-tag: true
build-args:
VERSION={tag}
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
restrict-to: kiwix/kiwix-tools
manual-tag: ${{ github.event.inputs.version }}
repo_description: auto
repo_overview: Kiwix command line tools
build-and-push-kiwix-serve:
name: Deploy kiwix-serve Docker Image
runs-on: ubuntu-20.04
needs: build-and-push-kiwix-tools
steps:
- uses: actions/checkout@v3.1.0
- name: build and publish kiwix-serve
uses: openzim/docker-publish-action@v9
with:
image-name: kiwix/kiwix-serve
credentials: |
DOCKERIO_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
DOCKERIO_TOKEN=${{ secrets.DOCKERHUB_PASSWORD }}
GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }}
GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }}
context: docker/server
latest-on-tag: true
build-args:
VERSION={tag}
platforms: |
linux/amd64
linux/arm/v7
linux/arm64
restrict-to: kiwix/kiwix-tools
manual-tag: ${{ github.event.inputs.version }}
repo_description: auto
repo_overview: Kiwix web-server

82
.github/workflows/package.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
name: Packages
on: [push, pull_request]
jobs:
build-deb:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distro:
- ubuntu-jammy
- ubuntu-impish
- ubuntu-focal
steps:
- uses: actions/checkout@v2
# Determine which PPA we should upload to
- name: PPA
id: ppa
run: |
if [[ $REF == refs/tags* ]]
then
echo "::set-output name=ppa::kiwixteam/release"
else
echo "::set-output name=ppa::kiwixteam/dev"
fi
env:
REF: ${{ github.ref }}
- uses: legoktm/gh-action-auto-dch@master
with:
fullname: Kiwix builder
email: release+launchpad@kiwix.org
distro: ${{ matrix.distro }}
- uses: legoktm/gh-action-build-deb@ubuntu-jammy
if: matrix.distro == 'ubuntu-jammy'
name: Build package for ubuntu-jammy
id: build-ubuntu-jammy
with:
args: --no-sign
ppa: ${{ steps.ppa.outputs.ppa }}
- uses: legoktm/gh-action-build-deb@ubuntu-impish
if: matrix.distro == 'ubuntu-impish'
name: Build package for ubuntu-impish
id: build-ubuntu-impish
with:
args: --no-sign
ppa: ${{ steps.ppa.outputs.ppa }}
- uses: legoktm/gh-action-build-deb@ubuntu-focal
if: matrix.distro == 'ubuntu-focal'
name: Build package for ubuntu-focal
id: build-ubuntu-focal
with:
args: --no-sign
ppa: ${{ steps.ppa.outputs.ppa }}
- uses: actions/upload-artifact@v2
with:
name: Packages for ${{ matrix.distro }}
path: output
- uses: legoktm/gh-action-dput@master
name: Upload dev package
# Only upload on pushes to master
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' && startswith(matrix.distro, 'ubuntu-')
with:
gpg_key: ${{ secrets.LAUNCHPAD_GPG }}
repository: ppa:kiwixteam/dev
packages: output/*_source.changes
- uses: legoktm/gh-action-dput@master
name: Upload release package
# Only upload on pushes to master or tag
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && startswith(matrix.distro, 'ubuntu-')
with:
gpg_key: ${{ secrets.LAUNCHPAD_GPG }}
repository: ppa:kiwixteam/release
packages: output/*_source.changes

View File

@@ -1,12 +0,0 @@
language: cpp
dist: trusty
sudo: required
cache: ccache
install: travis/install_deps.sh
script: travis/compile.sh
env:
matrix:
- PLATFORM="native_static"
- PLATFORM="native_dyn"
- PLATFORM="win32_static"
- PLATFORM="win32_dyn"

135
Changelog
View File

@@ -1,3 +1,138 @@
kiwix-tools 3.4.0
=================
* Remove last reference to kiwix-read tool (@legoktm #569)
kiwix-serve
-----------
* Fix broken indentation in usage (@kelson42 #560)
* Exit if wrong arguments are passed (@kelson42 #567)
* Do not allow multiple values for same option (@juuz0 #564)
* Fix default location of "rootLocation" (@rgaudin #571)
* [DOCKER] Change default port to 8080 (@neyder #581)
* [DOCKER] Simplify dockerfile (@rgaudin #582)
kiwix-manage
------------
* Fix man page (@kelson42 #576)
kiwix-tools 3.3.0
=================
* Remove kiwix-read tool (@veloman-yunkan #535)
kiwix-serve
-----------
* Add an option to limit the number of connections for a same IP (@juuz0 #534)
* Add an option to limit the number of zim in a multizim fulltext search (@mgautierfr #558)
kiwix-search
------------
* Remove usage of libkiwix's deprecated api (@veloman-yunkan #535)
kiwix-manage
------------
* Correctly return a value !0 if something went wrong (@mgautierfr #553)
kiwix-tools 3.2.0
=================
* Print the version of all dependencies (@kelson42 #516)
* Better Docker images (@kelson42 @rgaudin)
* Update Readme (@kelson42)
* Build debian packages on CI (@legoktm #394)
* Add man pages for kiwix-read and kiwix-search (@legoktm #392)
* Various fixes (@legoktm @hashworks @mgautierfr)
kiwix-serve
-----------
* Print the url on which a user can connect to on startup (@juuz0 #499 #522)
* Reload library on SIGHUP signal (@veloman-yunkan #497)
* Add a option `--monitorLibrary` to monitor and automically reload the library
(@veloman-yunkan #503)
* Correct handling of SIGTERM and SIGINT (@veloman-yunkan #488)
* Add `--customIndexTemplate` option (@manan #477)
* Add `--help` option (@kelson42 #511)
kiwix-tools 3.1.2
=================
* Use new threadsafe API of kiwix-lib to do suggestions search.
kiwix-tools 3.1.1
=================
* Fix compilation on Windows' CI
kiwix-tools 3.1.0
=================
* [SERVER] Add option to block external links
kiwix-tools 3.0.3
=================
* [MANAGER] Fix broken --version argument parsing
kiwix-tools 3.0.2
=================
* New option --version for all tools
* Remove benchmark.sh file.
* [DOCKER] Add ability to download a file at container start.
* [CI] Move to github actions instead of travis.
* [SERVER] Trust the given library by default.
* [SERVER] Add shortcut alias for option `--address` and `--nodatealias`
kiwix-tools 3.0.1
=================
* Fix --nodatealiases inverted logic regression
kiwix-tools 3.0.0
=================
* Move kiwix-serve implementation in kiwix-lib.
kiwix-tools 2.1.0
=================
* Fix few compilation errors.
kiwix-serve
-----------
* Use new api to filter the library.
* Mobile friendly top bar.
* Add notag parameter to be able to exclude tags from the zim search.
kiwix-tools 2.0.0
=================
kiwix-manage
-----------
* Better usage()
* Adding multiple files bug fix
* Remove download command.
kiwix-serve
-----------
* Better usage()
* Display properly welcome page on 3 columns
* New welcome page footer "Powered by Kiwix"
kiwix-tools 1.2.1
=================

View File

@@ -1,7 +1,20 @@
Kiwix tools
===========
The Kiwix tools is a collection of Kiwix related command line tools.
The Kiwix tools is a collection of [Kiwix](https://kiwix.org) related
command line tools:
* kiwix-manage: Manage XML based library of ZIM files
* kiwix-search: Fulltext search in ZIM files
* kiwix-serve: HTTP daemon serving ZIM files
[![latest release](https://img.shields.io/github/v/tag/kiwix/kiwix-tools?label=latest%20release&sort=semver)](https://download.kiwix.org/release/kiwix-tools/)
[![Repositories](https://img.shields.io/repology/repositories/kiwix-tools?label=repositories)](https://github.com/kiwix/kiwix-tools/wiki/Repology)
[![Docker](https://img.shields.io/docker/v/kiwix/kiwix-tools?arch=amd64&label=Docker&sort=date)](https://hub.docker.com/r/kiwix/kiwix-tools)
[![Docker (kiwix-serve)](https://img.shields.io/docker/v/kiwix/kiwix-serve?arch=amd64&label=Docker%20(kiwix-serve)&sort=date)](https://hub.docker.com/r/kiwix/kiwix-serve)
[![Sandstorm](https://img.shields.io/badge/Sandstorm-kiwix-blue)](https://apps.sandstorm.io/app/5uh349d0kky2zp5whrh2znahn27gwha876xze3864n0fu9e5220h)
[![Build Status](https://github.com/kiwix/kiwix-tools/workflows/CI/badge.svg?query=branch%3Amaster)](https://github.com/kiwix/kiwix-tools/actions?query=branch%3Amaster)
[![CodeFactor](https://www.codefactor.io/repository/github/kiwix/kiwix-tools/badge)](https://www.codefactor.io/repository/github/kiwix/kiwix-tools)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
Disclaimer
----------
@@ -17,7 +30,9 @@ Preamble
Although the Kiwix tools can be compiled/cross-compiled on/for many
sytems, the following documentation explains how to do it on POSIX
ones. It is primarly thought for GNU/Linux systems and has been tested
on recent releases of Ubuntu and Fedora.
on recent releases of
[Debian](https://debian.org)/[Ubuntu](https://ubuntu.com) and
[Fedora](https://getfedora.org).
Dependencies
------------
@@ -25,15 +40,8 @@ Dependencies
The Kiwix tools rely on a few third party software libraries. They are
prerequisites to the Kiwix tools compilation. Therefore, following
libraries need to be available:
* Kiwix lib ....................... https://github.com/kiwix/kiwix-lib
(no package so far)
* Libmicrohttpd .......... https://www.gnu.org/software/libmicrohttpd/
(package libmicrohttpd-dev on Ubuntu)
* CTPP2 ..................................... http://ctpp.havoc.ru/en/
(package libctpp2-dev on Ubuntu)
* Zlib .......................................... http://www.zlib.net/
(package zlib1g-dev on Ubuntu)
* [libkiwix](https://github.com/kiwix/libkiwix) (package `libkiwix` on Debian/Ubuntu)
* [libzim](https://github.com/openzim/libzim) (package `libzim` on Debian/Ubuntu)
These dependencies may or may not be packaged by your operating
system. They may also be packaged but only in an older version. They
@@ -46,31 +54,28 @@ If you want to install these dependencies locally, then use the
kiwix-tools directory as install prefix.
If you want to compile Kiwix tools statically, the dependencies should
be compile statically (provide a lib...a library), for example by
using "--enable-static" with "./configure".
If you compile manually Libmicrohttpd, you might need to compile it
without GNU TLS, a bug here will empeach further compilation of Kiwix
tools otherwise.
be compiled statically (provide a `lib...a` library), for example by
using `--enable-static` with `./configure`.
Environment
-------------
The Kiwix tools build using [Meson](http://mesonbuild.com/) version
0.39 or higher. Meson relies itself on Ninja, pkg-config and few other
0.43 or higher. Meson relies itself on Ninja, pkg-config and few other
compilation tools. Install them first:
* Meson
* Ninja
* Pkg-config
* [Meson](http://mesonbuild.com/)
* [Ninja](https://ninja-build.org/)
* [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/)
These tools should be packaged if you use a cutting edge operating
system. If not, have a look to the "Troubleshooting" section.
system. If not, have a look to the [Troubleshooting](#Troubleshooting)
section.
Compilation
-----------
Once all dependencies are installed, you can compile Kiwix tools with:
```
```bash
meson . build
ninja -C build
```
@@ -85,38 +90,38 @@ Installation
------------
If you want to install the Kiwix tools, here we go:
```
```bash
ninja -C build install
```
You might need to run the command as root (or using 'sudo'), depending
where you want to install the Kiwix tools. After the installation
succeeded, you may need to run ldconfig (as root).
You might need to run the command as `root` (or using `sudo`),
depending where you want to install the Kiwix tools. After the
installation succeeded, you may need to run ldconfig (as `root`).
Uninstallation
------------
If you want to uninstall the Kiwix tools:
```
```bash
ninja -C build uninstall
```
Like for the installation, you might need to run the command as root
(or using 'sudo').
Like for the installation, you might need to run the command as `root`
(or using `sudo`).
Docker
------
An official Docker image of `kiwix-serve` can be found at
https://hub.docker.com/r/kiwix/kiwix-serve.
An official Docker image of the Kiwix tools can be found in the
[Docker Hub](https://hub.docker.com/r/kiwix/kiwix-tools). A
`kiwix-serve` dedicated Docker image [exists
too](https://hub.docker.com/r/kiwix/kiwix-serve).
Troubleshooting
---------------
If you need to install Meson "manually":
```
```bash
virtualenv -p python3 ./ # Create virtualenv
source bin/activate # Activate the virtualenv
pip3 install meson # Install Meson
@@ -124,7 +129,7 @@ hash -r # Refresh bash paths
```
If you need to install Ninja "manually":
```
```bash
git clone git://github.com/ninja-build/ninja.git
cd ninja
git checkout release
@@ -143,4 +148,5 @@ repository.
License
-------
GPLv3 or later, see COPYING for more details.
[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see
[COPYING](COPYING) for more details.

5
debian/changelog vendored Normal file
View File

@@ -0,0 +1,5 @@
kiwix-tools (0.0.0) unstable; urgency=medium
* Initial release
-- Kunal Mehta <legoktm@debian.org> Mon, 13 Jul 2020 17:21:11 -0700

25
debian/control vendored Normal file
View File

@@ -0,0 +1,25 @@
Source: kiwix-tools
Section: utils
Priority: optional
Maintainer: Kiwix team <kiwix@kiwix.org>
Build-Depends: debhelper-compat (= 13),
libkiwix-dev (>= 10.0.0~),
libzim-dev (>= 7.2.0~),
meson,
pkg-config,
Standards-Version: 4.5.0
Homepage: https://github.com/kiwix/kiwix-tools
Rules-Requires-Root: no
Package: kiwix-tools
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: collection of Kiwix tools
kiwix-tools is a collection of various command-line tools used to help
users interact with and manage ZIM files. It includes:
* kiwix-serve is a standalone HTTP server for serving ZIM files
over the network.
* kiwix-manage allows one to manage the content of the Kiwix library (an
XML file listing available ZIM files).
* kiwix-search allows one to find articles in a ZIM file using fulltext
search patterns.

1
debian/copyright vendored Normal file
View File

@@ -0,0 +1 @@
See COPYING in the repository root.

5
debian/rules vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh $@

1
debian/source/format vendored Normal file
View File

@@ -0,0 +1 @@
3.0 (native)

21
docker/Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
FROM alpine:3.16
LABEL org.opencontainers.image.source https://github.com/openzim/kiwix-tools
ARG VERSION
RUN apk --no-cache add dumb-init curl && \
ARCH=$(cat /etc/apk/arch) && \
if [ "$ARCH" = "x86" ]; then ARCH="i586"; \
elif [ "$ARCH" = "aarch64" ]; then ARCH="armhf"; \
elif [ "$ARCH" = "armv7" ]; then ARCH="armhf"; fi && \
# download requested kiwix-tools version
url="http://mirror.download.kiwix.org/release/kiwix-tools/kiwix-tools_linux-$ARCH-$VERSION.tar.gz" && \
echo "URL: $url" && \
curl -k -L $url | tar -xz -C /usr/local/bin/ --strip-components 1 && \
# only needed in dockerfile
apk del curl
# expose kiwix-serve default port
EXPOSE 80
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/bin/sh", "-c", "echo 'Welcome to kiwix-tools! The following binaries are available:' && ls /usr/local/bin/"]

32
docker/README.md Normal file
View File

@@ -0,0 +1,32 @@
Kiwix-tools Docker image
===
- Available on [docker.io](https://hub.docker.com/r/kiwix/kiwix-tools) and [ghcr.io](https://ghcr.io/kiwix/kiwix-tools).
- multi-arch (`linux/amd64`, `linux/arm64`, `linux/arm/v7`)
- based on official `kiwix-tools` binaries.
## Usage
``` sh
$ docker run -it kiwix/kiwix-tools:3.1.2
Welcome to kiwix-tools! The following binaries are available:
kiwix-manage kiwix-search kiwix-serve
```
`kiwix-tools` operates on zim files. You shall mount a volume to access the files.
```sh
docker run -v $(pwd):/data -it kiwix/kiwix-tools kiwix-search /data/wikipedia_fr_test.zim "Mali"
```
## Building and reusing
- `kiwix/kiwix-tools` is multi-arch and is ideally built using `buildx`.
- requires a `--build-arg VERSION=` with the kiwix-tools release.
- can be built using `docker build` in which case it expects an additionnal `--build-arg ARCH=arm` for arm. Otherwise defaults to `amd64`.
**Notes:**
- `wget` in `alpine:3` on `arm/v7` (__inside github action only__) crashes when downloading from HTTPs locations. Keep http-only in Dockerfile.
- Was also unhappy when using the mirrors so it's using `mirror.download` on purpose.

View File

@@ -1,15 +1,14 @@
FROM alpine:latest
LABEL maintainer Emmanuel Engelhart <kelson@kiwix.org>
ARG VERSION=latest
# Install kiwix-serve
WORKDIR /
RUN apk add --no-cache curl bzip2
RUN curl -kL https://download.kiwix.org/release/kiwix-tools/kiwix-tools_linux-x86_64-1.2.1.tar.gz | tar -xz && \
mv kiwix-tools*/kiwix-serve /usr/local/bin && \
rm -r kiwix-tools*
# kiwix-tools is multi-arch
FROM kiwix/kiwix-tools:$VERSION
LABEL org.opencontainers.image.source https://github.com/openzim/kiwix-tools
# Run kiwix-serve
EXPOSE 80
# expose kiwix-serve default port and workdir
EXPOSE 8080
VOLUME /data
WORKDIR /data
ENTRYPOINT ["/usr/local/bin/kiwix-serve", "--port", "80"]
COPY ./start.sh /usr/local/bin/
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/start.sh"]

View File

@@ -1,13 +1,45 @@
kiwix-serve Docker image
Kiwix serve Docker image
========================
With local ZIM file(s)
----------------------
* Download a ZIM file from <https://wiki.kiwix.org/wiki/Content>
* Given `wikipedia.zim` resides in `/tmp/zim/`, execute the following:
* Given `wikipedia.zim` and `wiktionary.zim` reside in `/tmp/zim/`, execute the following:
```bash
docker run -v /tmp/zim:/data -p 8080:8080 kiwix/kiwix-serve wikipedia.zim wiktionary.zim
```
docker run -v /tmp/zim:/data -p 8080:80 kiwix/kiwix-serve wikipedia.zim
With remote ZIM file
--------------------
```bash
docker run -e "DOWNLOAD=https://download.kiwix.org/zim/wikipedia_bm_all.zim" -p 8080:8080 kiwix/kiwix-serve
```
Change default port
-------------------
You can change port to expose with environment variable PORT, useful if running on Podman, K8s or OpenShift
```bash
podman run -e "DOWNLOAD=https://download.kiwix.org/zim/wikipedia_bm_all.zim" -e PORT=8888 -p 8080:8888 kiwix/kiwix-serve
```
ARM
---
Build an image for an ARM based GNU/Linux:
```bash
docker build . -t kiwix/kiwix-serve:latest --build-arg ARCH="arm32v7/"
```
You can also deploy kiwix with [`docker-compose`](https://docs.docker.com/compose/). Check out a sample at [docker-compose.yml.example](docker-compose.yml.example)
Screenshots
-----------
![screenshot_1.png](https://github.com/kiwix/kiwix-tools/raw/master/docker/server/pictures/screenshot_1.png)
![screenshot_2.png](https://github.com/kiwix/kiwix-tools/raw/master/docker/server/pictures/screenshot_2.png)

View File

@@ -0,0 +1,14 @@
version: '3.3'
services:
kiwix-serve:
ports:
- 8080:8080
image: kiwix/kiwix-serve
# uncomment next 4 lines to use it with local zim file in /tmp/zim
# volumes:
# - /tmp/zim:/data
# command:
# - *.zim
# uncomment next 2 lines to use it with remote zim file
# environment:
# - 'DOWNLOAD=https://download.kiwix.org/zim/wikipedia_bm_all.zim'

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 187 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 KiB

After

Width:  |  Height:  |  Size: 302 KiB

29
docker/server/start.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
# Download if necessary a file
if [ ! -z "$DOWNLOAD" ]
then
ZIM=`basename $DOWNLOAD`
wget $DOWNLOAD -O "$ZIM"
# Set arguments
if [ "$#" -eq "0" ]
then
set -- "$@" $ZIM
fi
fi
if [ -z "$PORT" ]
then
PORT=8080
fi
CMD="/usr/local/bin/kiwix-serve --port=$PORT $@"
echo $CMD
$CMD
# If error, print the content of /data
if [ $? -ne 0 ]
then
echo "Here is the content of /data:"
find /data -type f
fi

View File

@@ -3,7 +3,6 @@
files=(
"src/installer/kiwix-install.cpp"
"src/searcher/kiwix-search.cpp"
"src/reader/kiwix-read.cpp"
"src/manager/kiwix-manage.cpp"
"src/server/kiwix-serve.cpp"
)

View File

@@ -1,21 +1,22 @@
project('kiwix-tools', 'cpp',
version : '1.2.1',
version : '3.4.0',
license : 'GPL',
default_options: ['c_std=c11', 'cpp_std=c++11', 'werror=true'])
compiler = meson.get_compiler('cpp')
add_global_arguments('-DKIWIX_TOOLS_VERSION="@0@"'.format(meson.project_version()), language : 'cpp')
static_linkage = get_option('static-linkage')
if static_linkage
add_global_link_arguments('-static-libstdc++', '--static', language:'cpp')
endif
thread_dep = dependency('threads')
kiwixlib_dep = dependency('kiwix', version:'>=4.1.0', static:static_linkage)
microhttpd_dep = dependency('libmicrohttpd', static:static_linkage)
z_dep = dependency('zlib', static:static_linkage)
kiwixlib_dep = dependency('kiwix', version:'>=12.0.0', static:static_linkage)
libzim_dep = dependency('libzim', version:'>=8.1.0', static:static_linkage)
all_deps = [thread_dep, kiwixlib_dep, microhttpd_dep, z_dep]
all_deps = [thread_dep, kiwixlib_dep, libzim_dep]
if static_linkage
librt = compiler.find_library('rt', required:false)
@@ -24,6 +25,4 @@ if static_linkage
endif
endif
#subdir('include')
subdir('static')
subdir('src')

View File

@@ -1,62 +1,69 @@
.TH KIWIX 1 "21 May 2012"
.TH KIWIX-MANAGE 1 "21 May 2012"
.SH NAME
kiwix\-manage \- Kiwix Library Manager
.SH SYNOPSIS
.IX Header SYNOPSIS
.B kiwix\-manage
.br
kiwix\-manage LIBRARY_PATH add ZIM_PATH ...
.br
kiwix-manage LIBRARY_PATH show [CONTENTID1] [CONTENTID2] ...
.br
kiwix\-manage LIBRARY_PATH remove CONTENTID1 [CONTENTID2]
.SH DESCRIPTION
.SS kiwix\-manage
.PP
\fBkiwix\-manage\fP tool for managing a kiwix library.
.PP
Allows one to manage the content of the kiwix library. The library file is a
flat XML file listing ZIM files with all necessary information like favicon,
date, creator, description, indexpath, filepath, title, source/metalink, etc.
.
.PP
Example library file can be found at https://www.kiwix.org/library\.xml
.br
.TP
\fBadd\fR
Add \fBZIM_FILE\fP to \fBLIBRARY_FILE\fP.
\fBkiwix\-manage\fR LIBRARY_PATH \fBadd\fR ZIM_PATH ...
.TP
\fBkiwix\-manage\fR LIBRARY_PATH \fBshow\fR [ZIM_ID_1] [ZIM_ID_2] ...
.TP
\fBkiwix\-manage\fR LIBRARY_PATH \fBremove\fR ZIM_ID_1 [ZIM_ID_2] ...
.TP
\fBkiwix\-manage\fR --version
.TP
\fBkiwix\-manage\fR --help
.SH DESCRIPTION
.PP
\fBkiwix\-manage\fP is a command line tool for manipulating a Kiwix XML library.
.PP
\fBkiwix\-manage\fP allows to manage the entries of the Kiwix
library. The library file is a flat XML file listing ZIM files with
all necessary information like id, favicon, date, creator,
description, filepath, title, url, etc.
.SH ACTIONS
.TP
\fBshow\fR
Show given \fBCONTENT_ID\fP from \fBLIBRARY_FILE\fR. If no \fBCONTENT_ID\fP is given then all contents from \fBLIBRARY_FILE\fR are shown.
\fBadd\fR
Add \fBZIM_FILE\fP to \fBLIBRARY_FILE\fP. Create the library file if necessary.
.TP
\fBremove\fR
Remove the given \fBCONTENT_ID\fR from \fBLIBRARY_FILE\fR. At least one \fBCONTENT_ID\fR should be specified.
Remove the given \fBZIM_ID\fR from \fBLIBRARY_FILE\fR. At least one \fBZIM_ID\fR should be specified.
.TP
\fB\-\-zimPathToSave=\fR
Change the location reference of the ZIM file in the library.
\fBshow\fR
Show given \fBZIM_ID\fP from \fBLIBRARY_FILE\fR. If no \fBZIM_ID\fP is given then all contents from \fBLIBRARY_FILE\fR are shown.
.SH OPTIONS
.TP
Options to be used with the action \fBadd\fR:
.TP
\fB\-\-current\fR
Mark this content as the current (default) content in the library.
\fB\-\-url=HTTP_URL\fR
Set the ZIM online HTTP(S) URL
.TP
\fB\-\-backend=xapian|clucene\fR
Select an indexing backend.
\fB\-\-zimPathToSave=OTHER_FS_PATH\fR
Set an arbitrary ZIM filesystem path (instead of the ZIM_PATH)
.TP
\fB\-\-indexPath=FULLTEXT_IDX_PATH\fR
Path to full-text index for that ZIM file.
Other options (to be used alone):
.TP
\fBurl\fR
Set the content location of the ZIM file over the network for in\-kiwix download.
\fB\-\-help | \-h\fR
Display the kiwix-manage help
.TP
\fB\-\-version | \-v\fR
Display the version of kiwix-manage and all dependences
.SH SEE ALSO
kiwix(1) kiwix\-serve(1)
.SH AUTHOR
Emmanuel Engelhart <kelson@kiwix.org>
.br
Vasudev Kamath <kamathvasudev@gmail.com> (Manual)
kiwix\-serve(1)
.SH AUTHORS
Kiwix team <contact@kiwix.org>

21
src/man/kiwix-search.1 Normal file
View File

@@ -0,0 +1,21 @@
.TH KIWIX-SEARCH "1" "July 2020" "kiwix-tools" "User Commands"
.SH NAME
kiwix-search \- find articles using a fulltext search pattern
.SH SYNOPSIS
\fBkiwix-search\fR [OPTIONS] ZIM PATTERN\fR
.SH DESCRIPTION
.TP
ZIM
ZIM file to search
.TP
PATTERN
Words or parts of words to search for in the ZIM file
.TP
\fB\-s\fR, \fB\-\-suggestion\fR
Suggest article titles based on the PATTERN instead of a fulltext search
.TP
\fB\-V\fR, \fB\-\-version\fR
print software version
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Give details about the search process

View File

@@ -1,3 +1,4 @@
install_man('kiwix-manage.1',
'kiwix-search.1',
'kiwix-serve.1')
subdir('fr')

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011 Emmanuel Engelhart <kelson@kiwix.org>
* Copyright 2011-2019 Emmanuel Engelhart <kelson@kiwix.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,23 +17,17 @@
* MA 02110-1301, USA.
*/
#ifndef _WIN32
#include <unistd.h>
#endif
#include <getopt.h>
#include <kiwix/tools/pathTools.h>
#include <kiwix/tools/stringTools.h>
#include <kiwix/manager.h>
#include <kiwix/downloader.h>
#include <kiwix/tools.h>
#include <cstdlib>
#include <iostream>
#include <thread>
#include <chrono>
#include "../version.h"
using namespace std;
enum supportedAction { NONE, ADD, SHOW, REMOVE, DOWNLOAD };
enum supportedAction { NONE, ADD, SHOW, REMOVE };
void show(kiwix::Library* library, const std::string& bookId)
{
@@ -57,21 +51,52 @@ void show(kiwix::Library* library, const std::string& bookId)
std::cout << std::endl;
}
/* Print correct console usage options */
void usage()
{
cerr << "Usage:" << endl;
cerr << "\tkiwix-manage LIBRARY_PATH add ZIM_PATH "
"[--zimPathToSave=../content/foobar.zim] [--current] "
"[--url=http://...metalink]"
<< endl;
cerr << "\tkiwix-manage LIBRARY_PATH show [CONTENTID1] [CONTENTID2] ... "
"(show everything if no param.)"
<< endl;
cerr << "\tkiwix-manage LIBRARY_PATH remove CONTENTID1 [CONTENTID2]" << endl;
std::cout << "Usage:" << std::endl
<< "\tkiwix-manage LIBRARY_PATH add ZIM_PATH [OPTIONS]" << std::endl
<< "\tkiwix-manage LIBRARY_PATH remove ZIM_ID [ZIM_ID]..." << std::endl
<< "\tkiwix-manage LIBRARY_PATH show [ZIM_ID]..." << std::endl
<< std::endl
<< "Purpose:" << std::endl
<< "\tManipulates the Kiwix library XML file"
<< std::endl << std::endl
<< "Arguments:" << std::endl
<< "\tLIBRARY_PATH\tis the XML library file path."
<< std::endl << std::endl
<< "\tACTION\t\tis the pre-defined string to specify the action to run on the XML library file."
<< std::endl << std::endl
<< "\t\t\tMust be one of the following values:" << std::endl
<< "\t\t\t* add: add a ZIM file to the library" << std::endl
<< "\t\t\t* remove: remove a ZIM file from the library" << std::endl
<< "\t\t\t* show: show the content of the library"
<< std::endl << std::endl
<< "\tZIM_ID\t\tZIM file unique ID"
<< std::endl << std::endl
<< "\tOPTIONS\t\tCustom options for \"add\" action:" << std::endl
<< "\t\t\t--zimPathToSave=CUSTOM_ZIM_PATH to replace the current ZIM file path" << std::endl
<< "\t\t\t--url=HTTP_ZIM_URL to create an \"url\" attribute for the online version of the ZIM file" << std::endl
<< std::endl
<< "\t\t\tOther options:" << std::endl
<< "\t\t\t-v, --version to print the software version" << std::endl
<< std::endl
<< "Examples:" << std::endl
<< "\tAdd ZIM files to library: kiwix-manage my_library.xml add first.zim second.zim" << std::endl
<< "\tRemove ZIM files from library: kiwix-manage my_library.xml remove e5c2c003-b49e-2756-5176-5d9c86393dd9" << std::endl
<< "\tShow all library ZIM files: kiwix-manage my_library.xml show" << std::endl
<< std::endl
<< "Documentation:" << std::endl
<< "\tSource code\thttps://github.com/kiwix/kiwix-tools" << std::endl
<< "\tMore info\thttps://wiki.kiwix.org/wiki/Kiwix-manage" << std::endl
<< std::endl;
}
bool handle_show(kiwix::Library* library, const std::string& libraryPath,
int handle_show(kiwix::Library* library, const std::string& libraryPath,
int argc, char* argv[])
{
if (argc > 3 ) {
@@ -88,16 +113,15 @@ bool handle_show(kiwix::Library* library, const std::string& libraryPath,
return(0);
}
bool handle_add(kiwix::Library* library, const std::string& libraryPath,
int handle_add(kiwix::Library* library, const std::string& libraryPath,
int argc, char* argv[])
{
string zimPath;
string zimPathToSave = ".";
string url;
string origID = "";
int option_index = 0;
int c = 0;
bool resultCode = 0;
int resultCode = 0;
if (argc <= 3) {
std::cerr << "Path to zim file to add is missing in the command line" << std::endl;
@@ -108,7 +132,6 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
optind = 3;
static struct option long_options[] = {
{"url", required_argument, 0, 'u'},
{"origId", required_argument, 0, 'o'},
{"zimPathToSave", required_argument, 0, 'z'},
{0, 0, 0, 0}
};
@@ -124,11 +147,6 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
case 'u':
url = optarg;
break;
case 'o':
origID = optarg;
break;
case 'z':
zimPathToSave = optarg;
break;
@@ -150,8 +168,11 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
for(auto i=optind; i<argc; i++) {
std::string zimPath = argv[i];
if (!zimPath.empty()) {
zimPathToSave = zimPathToSave == "." ? zimPath : zimPathToSave;
manager.addBookFromPathAndGetId(zimPath, zimPathToSave, url, false);
auto _zimPathToSave = zimPathToSave == "." ? zimPath : zimPathToSave;
if (manager.addBookFromPathAndGetId(zimPath, _zimPathToSave, url, false).empty()) {
std::cerr << "Cannot add zim " << zimPath << " to the library." << std::endl;
resultCode = 1;
}
} else {
std::cerr << "Invalid zim file path" << std::endl;
resultCode = 1;
@@ -161,12 +182,12 @@ bool handle_add(kiwix::Library* library, const std::string& libraryPath,
return(resultCode);
}
bool handle_remove(kiwix::Library* library, const std::string& libraryPath,
int handle_remove(kiwix::Library* library, const std::string& libraryPath,
int argc, char* argv[])
{
std::string bookId;
const unsigned int totalBookCount = library->getBookCount(true, true);
bool exitCode = 0;
int exitCode = 0;
if (argc <= 3) {
std::cerr << "BookId to remove missing in the command line" << std::endl;
@@ -191,69 +212,33 @@ bool handle_remove(kiwix::Library* library, const std::string& libraryPath,
return(exitCode);
}
bool handle_download(kiwix::Library* library, const std::string& libraryPath,
int argc, char* argv[])
{
std::string bookId;
bool exitCode = false;
if (argc > 3) {
bookId = argv[3];
}
auto& book = library->getBookById(bookId);
auto did = book.getDownloadId();
kiwix::Downloader downloader;
kiwix::Download* download = nullptr;
if (!did.empty()) {
std::cout << "try resume " << did << std::endl;
try {
download = downloader.getDownload(did);
} catch(...) {}
}
if (nullptr == download || download->getStatus() == kiwix::Download::K_UNKNOWN) {
download = downloader.startDownload(book.getUrl());
book.setDownloadId(download->getDid());
}
int step = 60*5;
while (step--) {
download->updateStatus();
if (download->getStatus() == kiwix::Download::K_COMPLETE) {
auto followingId = download->getFollowedBy();
if (followingId.empty()) {
book.setPath(download->getPath());
book.setDownloadId("");
std::cout << "File downloaded to " << book.getPath() << std::endl;
break;
} else {
download = downloader.getDownload(followingId);
}
} else if (download->getStatus() == kiwix::Download::K_ACTIVE) {
std::cout << download->getDid() << " : "
<< kiwix::beautifyFileSize(download->getCompletedLength()) << "/"
<< kiwix::beautifyFileSize(download->getTotalLength())
<< " (" << kiwix::beautifyFileSize(download->getDownloadSpeed()) << "/s) "
<< " [" << kiwix::beautifyFileSize(download->getVerifiedLength()) << "]"
<< "[" << step << "] \n" << std::flush;
} else if (download->getStatus() == kiwix::Download::K_ERROR) {
std::cout << "File Error" << std::endl;
exitCode = true;
break;
}
std::this_thread::sleep_for(std::chrono::seconds(1));
}
downloader.close();
return exitCode;
}
int main(int argc, char** argv)
{
string libraryPath = "";
supportedAction action = NONE;
kiwix::Library library;
/* Argument parsing */
/* General argument parsing */
static struct option long_options[] = {
{"version", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
int option_index = 0;
int c;
while (true && argc == 2) {
c = getopt_long(argc, argv, "v", long_options, &option_index);
if (c == -1)
break;
switch (c) {
case 'v':
version();
return 0;
}
}
/* Action related argument parsing */
if (argc > 2) {
libraryPath = argv[1];
string actionString = argv[2];
@@ -264,25 +249,28 @@ int main(int argc, char** argv)
action = SHOW;
else if (actionString == "remove" || actionString == "delete")
action = REMOVE;
else if (actionString == "download")
action = DOWNLOAD;
}
/* Print usage)) if necessary */
if (libraryPath == "" || action == NONE) {
usage();
exit(1);
return -1;
}
/* Try to read the file */
libraryPath = isRelativePath(libraryPath)
? computeAbsolutePath(getCurrentDirectory(), libraryPath)
libraryPath = kiwix::isRelativePath(libraryPath)
? kiwix::computeAbsolutePath(kiwix::getCurrentDirectory(), libraryPath)
: libraryPath;
kiwix::Manager manager(&library);
manager.readFile(libraryPath, false);
if (!manager.readFile(libraryPath, false)) {
if (kiwix::fileExists(libraryPath) || action!=ADD) {
std::cerr << "Cannot read the library " << libraryPath << std::endl;
return 1;
}
}
/* SHOW */
bool exitCode = 0;
int exitCode = 0;
switch (action) {
case SHOW:
exitCode = handle_show(&library, libraryPath, argc, argv);
@@ -293,17 +281,22 @@ int main(int argc, char** argv)
case REMOVE:
exitCode = handle_remove(&library, libraryPath, argc, argv);
break;
case DOWNLOAD:
exitCode = handle_download(&library, libraryPath, argc, argv);
break;
case NONE:
break;
}
/* Rewrite the library file */
if (action == REMOVE || action == ADD || action == DOWNLOAD) {
library.writeToFile(libraryPath);
if (exitCode) {
return exitCode;
}
exit(exitCode);
/* Rewrite the library file */
if (action == REMOVE || action == ADD) {
// writeToFile return true (1) if everything is ok => exitCode is 0
if (!library.writeToFile(libraryPath)) {
std::cerr << "Cannot write the library " << libraryPath << std::endl;
return 1;
}
}
return 0;
}

View File

@@ -1,6 +1,4 @@
subdir('manager')
subdir('reader')
subdir('searcher')
subdir('server')
subdir('man')

View File

@@ -1,102 +0,0 @@
/*
* Copyright 2011 Emmanuel Engelhart <kelson@kiwix.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include <getopt.h>
#include <kiwix/reader.h>
#include <unistd.h>
#include <map>
#include <string>
void usage()
{
cout << "Usage: kiwix-read --suggest=<PATTERN> ZIM_FILE_PATH" << endl;
exit(1);
}
int main(int argc, char** argv)
{
/* Init the variables */
const char* filePath = NULL;
const char* pattern = NULL;
int option_index = 0;
int c = 0;
kiwix::Reader* reader = NULL;
/* Argument parsing */
while (42) {
static struct option long_options[]
= {{"verbose", no_argument, 0, 'v'},
{"suggest", required_argument, 0, 's'},
{0, 0, 0, 0}};
if (c != -1) {
c = getopt_long(argc, argv, "vs:", long_options, &option_index);
switch (c) {
case 'v':
break;
case 's':
pattern = optarg;
break;
}
} else {
if (optind < argc) {
if (filePath == NULL) {
filePath = argv[optind++];
} else {
usage();
}
} else {
break;
}
}
}
/* Check if we have enough arguments */
if (filePath == NULL) {
usage();
}
/* Instanciate the reader */
reader = new kiwix::Reader(filePath);
/* Start to read an article */
if (reader != NULL) {
string content;
string contentType;
string suggestion;
if (pattern != NULL) {
std::cout << "Searching suggestions for: " << pattern << std::endl;
reader->searchSuggestionsSmart(pattern, 10);
while (reader->getNextSuggestion(suggestion)) {
std::cout << suggestion << std::endl;
}
}
delete reader;
} else {
cerr << "Unable instanciate the Kiwix reader." << endl;
exit(1);
}
exit(0);
}

View File

@@ -1,3 +0,0 @@
executable('kiwix-read', ['kiwix-read.cpp'],
dependencies:all_deps,
install:true)

View File

@@ -18,19 +18,25 @@
*/
#include <getopt.h>
#include <kiwix/reader.h>
#include <kiwix/searcher.h>
#include <unistd.h>
#include <zim/search.h>
#include <zim/suggestion.h>
#include <iostream>
#include "../version.h"
using namespace std;
void usage()
{
cout << "Usage: kiwix-search [OPTIONS] ZIM PATTERN" << endl << endl
<< " kiwix-search allows to find articles based on the a fulltext search pattern." << endl << endl
<< " kiwix-search allows one to find articles based on the a fulltext search pattern." << endl << endl
<< " ZIM is the full path of the ZIM file." << endl
<< " PATTERN is/are word(s) - or part of - to search in the ZIM." << endl << endl
<< " -s, --suggestion\tSuggest article titles based on the few letters of the PATTERN instead of making a fulltext search. Work a bit like a completion solution." << endl
<< " -v, --verbose\t\tGive details about the search process" << endl;
<< " -v, --verbose\t\tGive details about the search process" << endl
<< " -V, --version\t\tPrint software version" << endl;
exit(1);
}
@@ -47,23 +53,24 @@ int main(int argc, char** argv)
int option_index = 0;
int c = 0;
kiwix::Searcher* searcher = NULL;
kiwix::Reader* reader = NULL;
/* Argument parsing */
while (42) {
static struct option long_options[]
= {{"verbose", no_argument, 0, 'v'},
{"suggestion", no_argument, 0, 's'},
{"version", no_argument, 0, 'V'},
{0, 0, 0, 0}};
if (c != -1) {
c = getopt_long(argc, argv, "vsb:", long_options, &option_index);
c = getopt_long(argc, argv, "Vvsb:", long_options, &option_index);
switch (c) {
case 'v':
verboseFlag = true;
break;
case 'V':
version();
return 0;
case 's':
suggestionFlag = true;
break;
@@ -91,40 +98,24 @@ int main(int argc, char** argv)
/* Try to prepare the indexing */
try {
reader = new kiwix::Reader(zimPath);
} catch (...) {
/* Cannot open the zimPath, maybe it is a plain old xapian database
* directory */
}
zim::Archive archive(zimPath);
if (reader) {
searcher = new kiwix::Searcher();
searcher->add_reader(reader, "");
} else {
cerr << "Unable to search through zim '" << zimPath << "'." << endl;
exit(1);
}
/* Start the indexing */
if (searcher != NULL) {
string searchString(search);
if (suggestionFlag) {
searcher->suggestions(searchString, verboseFlag);
} else {
searcher->search(searchString, 0, 10, verboseFlag);
zim::SuggestionSearcher searcher(archive);
searcher.setVerbose(verboseFlag);
for (const auto& r : searcher.suggest(search).getResults(0, 10) ) {
cout << r.getTitle() << endl;
}
} else {
zim::Searcher searcher(archive);
searcher.setVerbose(verboseFlag);
const zim::Query query(search);
for (const auto& r : searcher.search(query).getResults(0, 10) ) {
cout << r.getTitle() << endl;
}
}
kiwix::Result* p_result;
while ((p_result = searcher->getNextResult())) {
cout << p_result->get_title() << endl;
delete p_result;
}
delete searcher;
delete reader;
// kiwix::XapianSearcher::terminate();
} else {
cerr << "Unable instanciate the Kiwix searcher." << endl;
} catch ( const std::runtime_error& err) {
cerr << err.what() << endl;
exit(1);
}

View File

@@ -1,72 +0,0 @@
#!/bin/bash
# Parse command line
zim=$1
serve=$2
if (( $# != 2 ))
then
echo "Usage: ./benchmark ZIM_PATH KIWIX-SERVE_PATH"
exit 1
fi
# Constants
delay=0.01
top_log=/tmp/top.log
top_calc=/tmp/top.calc
# Available memory
memory_kb=`cat /proc/meminfo | grep "MemTotal" | tr -d " " | cut -f2 -d: | sed -e 's/[^0123456789]//g'`
memory_mb=`echo "scale=2;$memory_kb/1024" | bc -l`
# Start Kiwix-serve
echo "Starting kiwix-serve to be tested..."
$serve --port=8080 "$zim" &
serve_pid=$!
# Start top to monitor resource usage
top -d $delay -b -p $serve_pid | grep $serve_pid > "$top_log" &
top_pid=$!
# Print environnement informations
echo "Process to monitor: $serve_pid"
echo "Monitoring process: $top_pid"
echo "Monitoring delay: $delay s"
echo "ZIM file path: $zim"
echo "Kiwix-serve path: $serve"
echo "Total memory: $memory_mb MB"
echo
# Compute artice list
echo "Computing article list snippet..."
articles=`zimdump -l $zim | grep ".html" | shuf | head -n 1000`
# Run wget against kiwix-serve
start_date=`date +%s`
for LINE in $articles
do
echo "Scrapping $LINE..."
wget --quiet p -P /dev/shm/tmp "http://localhost:8080/wikipedia_en_medicine_2016-09/A/$LINE"
rm -rf /dev/shm/tmp
done
end_date=`date +%s`
# Kill top instance
kill -s STOP $top_pid 2>&1 > /dev/null
sed -i '$ d' "$top_log"
times=`cat "$top_log" | wc -l`
# Compute KPI
duration=`echo "$end_date-$start_date" | bc -l`
cpu_percent=`cat "$top_log" | sed -r -e "s;\s\s*; ;g" -e "s;^ *;;" | cut -d' ' -f9 | tr '\n' '+0' | sed -r -e "s;(.*)[+]$;\1;" -e "s/.*/scale=2\n(&)\/$times\nquit\n/" > "$top_calc" ; bc -q "$top_calc"`
memory_percent=`cat "$top_log" | sed -r -e "s;\s\s*; ;g" -e "s;^ *;;" | cut -d' ' -f10 | tr '\n' '+' | sed -r -e "s;(.*)[+]$;\1;" -e "s/.*/scale=2\n(&)\/$times\nquit\n/" > "$top_calc" ; bc -q "$top_calc"`
memory_absolut=`echo "scale=2;$memory_mb/100*$memory_percent" | bc -l`
echo
echo "Measure count: $times"
echo "Duration: $duration s"
echo "CPU (average): $cpu_percent %"
echo "Memory (average): $memory_absolut MB"
# Kill kiwix-serve & top instances
kill -s STOP $serve_pid 2>&1 > /dev/null
#rm "$top_log" "$top_calc"

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
sources = ['kiwix-serve.cpp', 'request_context.cpp']
sources += server_resources
sources = ['kiwix-serve.cpp']
executable('kiwix-serve', sources,
dependencies:all_deps,

View File

@@ -1,201 +0,0 @@
/*
* Copyright 2009-2016 Emmanuel Engelhart <kelson@kiwix.org>
* Copyright 2017 Matthieu Gautier<mgautier@kymeria.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "request_context.h"
#include <string.h>
#include <stdexcept>
#include <sstream>
#include <cstdio>
RequestContext::RequestContext(struct MHD_Connection* connection,
std::string rootLocation,
const std::string& _url,
const std::string& method,
const std::string& version) :
full_url(_url),
url(_url),
valid_url(true),
version(version),
acceptEncodingDeflate(false),
accept_range(false),
range_pair(0, -1)
{
if (method == "GET") {
this->method = RequestMethod::GET;
} else if (method == "HEAD") {
this->method = RequestMethod::HEAD;
} else if (method == "POST") {
this->method = RequestMethod::POST;
} else if (method == "PUT") {
this->method = RequestMethod::PUT;
} else if (method == "DELETE") {
this->method = RequestMethod::DELETE_;
} else if (method == "CONNECT") {
this->method = RequestMethod::CONNECT;
} else if (method == "OPTIONS") {
this->method = RequestMethod::OPTIONS;
} else if (method == "TRACE") {
this->method = RequestMethod::TRACE;
} else if (method == "PATCH") {
this->method = RequestMethod::PATCH;
} else {
this->method = RequestMethod::OTHER;
}
MHD_get_connection_values(connection, MHD_HEADER_KIND, &RequestContext::fill_header, this);
MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND, &RequestContext::fill_argument, this);
valid_url = true;
if (rootLocation.empty()) {
// nothing special to handle.
url = full_url;
} else {
if (full_url.size() > rootLocation.size() &&
full_url.substr(0, rootLocation.size()+1) == rootLocation + "/") {
url = full_url.substr(rootLocation.size());
} else {
valid_url = false;
}
}
try {
acceptEncodingDeflate =
(get_header(MHD_HTTP_HEADER_ACCEPT_ENCODING).find("deflate") != std::string::npos);
} catch (const std::out_of_range&) {}
/*Check if range is requested. */
try {
auto range = get_header(MHD_HTTP_HEADER_RANGE);
int start = 0;
int end = -1;
std::istringstream iss(range);
char c;
iss >> start >> c;
if (iss.good() && c=='-') {
iss >> end;
if (iss.fail()) {
// Something went wrong will extracting.
end = -1;
}
if (iss.eof()) {
accept_range = true;
range_pair = std::pair<int, int>(start, end);
}
}
} catch (const std::out_of_range&) {}
}
RequestContext::~RequestContext()
{}
int RequestContext::fill_header(void *__this, enum MHD_ValueKind kind,
const char *key, const char *value)
{
RequestContext *_this = static_cast<RequestContext*>(__this);
_this->headers[key] = value;
return MHD_YES;
}
int RequestContext::fill_argument(void *__this, enum MHD_ValueKind kind,
const char *key, const char* value)
{
RequestContext *_this = static_cast<RequestContext*>(__this);
_this->arguments[key] = value == nullptr ? "" : value;
return MHD_YES;
}
void RequestContext::print_debug_info() {
printf("method : %s (%d)\n", method==RequestMethod::GET ? "GET" :
method==RequestMethod::POST ? "POST" :
"OTHER", (int)method);
printf("version : %s\n", version.c_str());
printf("headers :\n");
for (auto it=headers.begin(); it!=headers.end(); it++) {
printf(" - %s : '%s'\n", it->first.c_str(), it->second.c_str());
}
printf("arguments :\n");
for (auto it=arguments.begin(); it!=arguments.end(); it++) {
printf(" - %s : '%s'\n", it->first.c_str(), it->second.c_str());
}
printf("Parsed : \n");
printf("url : %s\n", url.c_str());
printf("acceptEncodingDeflate : %d\n", acceptEncodingDeflate);
printf("has_range : %d\n", accept_range);
printf(".............\n");
}
RequestMethod RequestContext::get_method() {
return method;
}
std::string RequestContext::get_url() {
return url;
}
std::string RequestContext::get_url_part(int number) {
size_t start = 1;
while(true) {
auto found = url.find('/', start);
if (number == 0) {
if (found == std::string::npos) {
return url.substr(start);
} else {
return url.substr(start, found-start);
}
} else {
if (found == std::string::npos) {
throw std::out_of_range("No parts");
}
start = found + 1;
number -= 1;
}
}
}
std::string RequestContext::get_full_url() {
return full_url;
}
bool RequestContext::is_valid_url() {
return valid_url;
}
bool RequestContext::has_range() {
return accept_range;
}
std::pair<int, int> RequestContext::get_range() {
return range_pair;
}
template<>
std::string RequestContext::get_argument(const std::string& name) {
return arguments.at(name);
}
std::string RequestContext::get_header(const std::string& name) {
return headers.at(name);
}

View File

@@ -1,108 +0,0 @@
/*
* Copyright 2009-2016 Emmanuel Engelhart <kelson@kiwix.org>
* Copyright 2017 Matthieu Gautier<mgautier@kymeria.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef REQUEST_CONTEXT_H
#define REQUEST_CONTEXT_H
#include <string>
#include <sstream>
#include <map>
#include <stdexcept>
extern "C" {
#include <microhttpd.h>
}
enum class RequestMethod {
GET,
HEAD,
POST,
PUT,
DELETE_,
CONNECT,
OPTIONS,
TRACE,
PATCH,
OTHER
};
class KeyError : public std::runtime_error {};
class IndexError: public std::runtime_error {};
class RequestContext {
public:
RequestContext(struct MHD_Connection* connection,
std::string rootLocation,
const std::string& url,
const std::string& method,
const std::string& version);
~RequestContext();
void print_debug_info();
bool is_valid_url();
std::string get_header(const std::string& name);
template<typename T=std::string>
T get_argument(const std::string& name) {
std::istringstream stream(arguments.at(name));
T v;
stream >> v;
return v;
}
RequestMethod get_method();
std::string get_url();
std::string get_url_part(int part);
std::string get_full_url();
bool has_range();
std::pair<int, int> get_range();
bool can_compress() { return acceptEncodingDeflate; }
// [TODO] Move this to the response builder
int httpResponseCode;
private:
std::string full_url;
std::string url;
bool valid_url;
RequestMethod method;
std::string version;
bool acceptEncodingDeflate;
bool accept_range;
std::pair<int, int> range_pair;
std::map<std::string, std::string> headers;
std::map<std::string, std::string> arguments;
static int fill_header(void *, enum MHD_ValueKind, const char*, const char*);
static int fill_argument(void *, enum MHD_ValueKind, const char*, const char*);
};
template<> std::string RequestContext::get_argument(const std::string& name);
#endif //REQUEST_CONTEXT_H

39
src/version.h Normal file
View File

@@ -0,0 +1,39 @@
/*
* Copyright 2009-2016 Emmanuel Engelhart <kelson@kiwix.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef _KIWIX_TOOLS_VERSION_H_
#define _KIWIX_TOOLS_VERSION_H_
#ifndef KIWIX_TOOLS_VERSION
#define KIWIX_TOOLS_VERSION "undefined"
#endif
#include <kiwix/version.h>
#include <zim/version.h>
#include <iostream>
void version()
{
std::cout << "kiwix-tools " << KIWIX_TOOLS_VERSION << std::endl << std::endl;
kiwix::printVersions();
std::cout << std::endl;
zim::printVersions();
}
#endif //_KIWIX_TOOLs_VERSION_H_

View File

@@ -1,4 +0,0 @@
res_compiler = find_program('kiwix-compile-resources', 'compile_resources.py')
subdir('server')

View File

@@ -1,13 +0,0 @@
<span class="kiwix">
<span id="kiwixtoolbar" class="ui-widget-header">
<div class="kiwix_centered">
<div class="kiwix_searchform">
<form class="kiwixsearch" method="GET" action="__ROOT_LOCATION__/search" id="kiwixsearchform">
<input autocomplete="off" class="ui-autocomplete-input" id="kiwixsearchbox" name="pattern" type="text">
<input type="submit" value="&#x1f50d;">
</form>
</div>
</div>
</span>
</span>
<div style="display: block; height: 5em;"></div>

View File

@@ -1,55 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>Welcome to Kiwix Server</title>
<script type="text/javascript" src="__ROOT_LOCATION__/skin/jquery-ui/external/jquery/jquery.js"></script>
<script type="text/javascript" src="__ROOT_LOCATION__/skin/jquery-ui/jquery-ui.min.js"></script>
<link type="text/css" href="__ROOT_LOCATION__/skin/jquery-ui/jquery-ui.min.css" rel="Stylesheet" />
<link type="text/css" href="__ROOT_LOCATION__/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" />
<style>
body {
background:
radial-gradient(#EEEEEE 15%, transparent 16%) 0 0,
radial-gradient(#EEEEEE 15%, transparent 16%) 8px 8px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px,
radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px;
background-color:#E8E8E8;
background-size:16px 16px;
margin-left: auto;
margin-right: auto;
max-width: 65.8em;
}
.book__list { text-align: center; }
.book {
display: inline-block; vertical-align: bottom; margin: 8px; padding: 12px 15px; width: 300px;
border: 1px solid #ccc; border-radius: 8px;
text-align: left; color: #000; font-family: sans-serif; font-size: 13px;
background-color:#F1F1F1;
box-shadow: 2px 2px 5px 0px #ccc;
}
.book:hover { background-color: #F9F9F9; box-shadow: none;}
.book__background { background-repeat: no-repeat; background-size: auto; background-position: top right; }
.book__title {
padding: 0 55px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
font-size: 18px; color: #0645ad;
}
.book__description {
padding: 5px 55px 5px 0px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
font-size: 15px;
}
.book__info { line-height: 18px; color: #777; font-weight: bold; font-size: 13px; }
</style>
<script>
$(function() {
$( "#accordion" ).accordion();
});
</script>
</head>
<body class="kiwix">
<div class="kiwix">
__BOOKS__
</div>
</body>
</html>

View File

@@ -1,27 +0,0 @@
<link type="text/css" href="__ROOT_LOCATION__/skin/jquery-ui/jquery-ui.min.css" rel="Stylesheet" />
<link type="text/css" href="__ROOT_LOCATION__/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" />
<link type="text/css" href="__ROOT_LOCATION__/skin/taskbar.css" rel="Stylesheet" />
<script type="text/javascript" src="__ROOT_LOCATION__/skin/jquery-ui/external/jquery/jquery.js"></script>
<script type="text/javascript" src="__ROOT_LOCATION__/skin/jquery-ui/jquery-ui.min.js"></script>
<script>
var jk = jQuery.noConflict();
jk(function() {
jk( "#kiwixsearchbox" ).autocomplete({
source: "__ROOT_LOCATION__/suggest?content=__CONTENT_ESCAPED__",
dataType: "json",
cache: false,
select: function(event, ui) {
jk( "#kiwixsearchbox" ).val(ui.item.value);
jk( "#kiwixsearchform" ).submit();
},
});
});
/* cybook hack */
if (navigator.userAgent.indexOf("bookeen/cybook") != -1) {
jk("html").addClass("cybook");
}
</script>

View File

File diff suppressed because it is too large Load Diff

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +0,0 @@
server_resources = custom_target('resources',
input: 'resources_list.txt',
output: ['server-resources.cpp', 'server-resources.h'],
command:[res_compiler, '--cxxfile', '@OUTPUT0@', '--hfile', '@OUTPUT1@', '@INPUT@'],
build_always: true
)

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Zim catalog search</ShortName>
<Description>Search zim files in the catalog.</Description>
<Url type="application/atom+xml;profile=opds-catalog"
xmlns:atom="http://www.w3.org/2005/Atom"
indexOffset="0"
template="/__ROOT_LOCATION__/catalog/search?q={searchTerms}&lang={language}&count={count}&start={startIndex}"/>
</OpenSearchDescription>

View File

@@ -1,25 +0,0 @@
jquery-ui/jquery-ui.structure.min.css
jquery-ui/jquery-ui.min.js
jquery-ui/external/jquery/jquery.js
jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png
jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png
jquery-ui/images/ui-icons_222222_256x240.png
jquery-ui/images/ui-bg_glass_55_fbf9ee_1x400.png
jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png
jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png
jquery-ui/images/ui-icons_2e83ff_256x240.png
jquery-ui/images/ui-icons_cd0a0a_256x240.png
jquery-ui/images/ui-icons_888888_256x240.png
jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png
jquery-ui/images/animated-overlay.gif
jquery-ui/images/ui-bg_glass_75_dadada_1x400.png
jquery-ui/images/ui-icons_454545_256x240.png
jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png
jquery-ui/jquery-ui.theme.min.css
jquery-ui/jquery-ui.min.css
home.html.tmpl
include.html.part
taskbar.css
taskbar.html.part
global_taskbar.html.part
opensearchdescription.xml

View File

@@ -1,88 +0,0 @@
#kiwixtoolbar {
position: fixed;
padding: .5em;
left:0;
right:0;
top: 0;
z-index:100;
}
#kiwixtoolbar > a {
float: left;
}
.height_separator {
height: 3em;
}
#kiwixsearchbox {
width: 20em;
}
.kiwix .kiwix_centered {
max-width: 720px;
margin: 0 auto;
}
.kiwix .kiwix_button_wrapper {
float: left;
}
.kiwix .kiwix_searchform {
float: right;
}
.kiwix #kiwixtoolbar button,
.kiwix #kiwixtoolbar input[type="submit"] {
box-sizing: border-box !important;
height: 26px !important;
line-height: 20px !important;
margin-right: 5px !important;
padding: 2px 6px !important;
border: 1px solid #999 !important;
border-radius: 3px !important;
background-color: #ededed !important;
font-weight: normal !important;
cursor: pointer !important;
font-size: 16px !important;
}
.kiwix #kiwixtoolbar a {
margin-bottom: 5px;
}
.kiwix #kiwixtoolbar #kiwixsearchform input[type='text'] {
box-sizing: border-box !important;
height: 26px !important;
line-height: 20px !important;
border: 1px solid #999 !important;
border-radius: 3px !important;
background-color: #fff !important;
padding: 2px 2px 2px 3px !important;
font-size: 16px !important;
}
/* Try to fix buggy stuff in jquery-ui autocomplete */
#ui-id-1, .ui-autocomplete {
background: white !important;
border: solid 1px grey !important;
}
li.ui-state-focus {
font-weight: bold;
}
@media (max-width: 520px) {
.kiwixsearch {
margin-top: 5px;
}
}
@media (max-width: 645px) {
.kiwixsearch {
float: none;
}
#kiwixsearchbox {
width: 65%;
}
#kiwixsearchform input[type="submit"] {
width: 28%;
}
.height_separator {
height: 6em;
}
}

View File

@@ -1,19 +0,0 @@
<span class="kiwix">
<span id="kiwixtoolbar" class="ui-widget-header">
<div class="kiwix_centered">
<div class="kiwix_button_wrapper">
<a id="kiwix_serve_taskbar_library_button" href="__ROOT_LOCATION__/"><button>&#x1f3e0;</button></a>
<a id="kiwix_serve_taskbar_home_button" href="__ROOT_LOCATION__/__CONTENT__/"><button>__ZIM_TITLE__</button></a>
<a id="kiwix_serve_taskbar_random_button" href="__ROOT_LOCATION__/random?content=__CONTENT_ESCAPED__"><button>&#x1F3B2;</button></a>
</div>
<div class="kiwix_searchform">
<form class="kiwixsearch" method="GET" action="__ROOT_LOCATION__/search" id="kiwixsearchform">
<input type="hidden" name="content" value="__CONTENT__" />
<input autocomplete="off" class="ui-autocomplete-input" id="kiwixsearchbox" name="pattern" type="text">
<input type="submit" value="&#x1f50d;">
</form>
</div>
</div>
</span>
</span>
<div style="display: block; height: 5em;"></div>

View File

@@ -1,29 +0,0 @@
#!/usr/bin/env bash
set -e
BUILD_DIR=${HOME}/BUILD_${PLATFORM}
INSTALL_DIR=${BUILD_DIR}/INSTALL
case ${PLATFORM} in
"native_static")
MESON_OPTION="-Dstatic-linkage=true"
;;
"native_dyn")
MESON_OPTION=""
;;
"win32_static")
MESON_OPTION="-Dstatic-linkage=true --cross-file ${BUILD_DIR}/meson_cross_file.txt"
;;
"win32_dyn")
MESON_OPTION="--cross-file ${BUILD_DIR}/meson_cross_file.txt"
;;
esac
cd ${TRAVIS_BUILD_DIR}
export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/x86_64-linux-gnu/pkgconfig
export PATH=${INSTALL_DIR}/bin:$PATH
meson . build ${MESON_OPTION}
cd build
ninja

View File

@@ -1,48 +0,0 @@
#!/usr/bin/env bash
set -e
REPO_NAME=${TRAVIS_REPO_SLUG#*/}
ARCHIVE_NAME=deps_${TRAVIS_OS_NAME}_${PLATFORM}_${REPO_NAME}.tar.xz
# Packages.
case ${PLATFORM} in
"native_static")
PACKAGES="gcc python3.5 cmake libbz2-dev ccache zlib1g-dev uuid-dev"
;;
"native_dyn")
PACKAGES="gcc python3.5 cmake libbz2-dev ccache zlib1g-dev uuid-dev libmicrohttpd-dev"
;;
"win32_static")
PACKAGES="g++-mingw-w64-i686 gcc-mingw-w64-i686 gcc-mingw-w64-base mingw-w64-tools ccache python3.5"
;;
"win32_dyn")
PACKAGES="g++-mingw-w64-i686 gcc-mingw-w64-i686 gcc-mingw-w64-base mingw-w64-tools ccache python3.5"
;;
"android_arm")
PACKAGES="gcc python3.5 cmake ccache"
;;
"android_arm64")
PACKAGES="gcc python3.5 cmake ccache"
;;
esac
sudo apt-get update -qq
sudo apt-get install -qq python3-pip ${PACKAGES}
wget https://bootstrap.pypa.io/get-pip.py
python3.5 get-pip.py --user
python3.5 -m pip install --user --upgrade pip
python3.5 -m pip install --user meson==0.49.2
# Ninja
cd $HOME
git clone git://github.com/ninja-build/ninja.git
cd ninja
git checkout release
./configure.py --bootstrap
sudo cp ninja /bin
# Dependencies comming from kiwix-build.
cd ${HOME}
wget http://tmp.kiwix.org/ci/${ARCHIVE_NAME}
tar xf ${HOME}/${ARCHIVE_NAME}