Commit Graph

1046 Commits

Author SHA1 Message Date
99dcdd849a Jni fix (#251)
Jni fix
2019-08-12 14:55:30 +02:00
a65e192f0f [JNI] Allow android to know that an article is a redirect.
Android need to handle the redirection by doing a redirection in the web
view, not by providing the content of the targeted article.

This is already what we do in kiwix-serve or ios.

The API should be far better by returning a Entry but for now,
we just change the given url if the article is a redirection.
2019-08-12 13:03:20 +02:00
513cc9c90f [JNI] Fix log typo. 2019-08-12 12:43:52 +02:00
231ae095f6 Correctly set that book's path is valid when updating it from a reader. 2019-08-12 12:43:52 +02:00
9a0c6da018 Library construction doesn't take argument 2019-08-12 12:43:52 +02:00
52299ef767 Fix computeAbsolutePath.
Correctly delete the duplicated string.
Use strtok_r to be thread safe.
2019-08-12 12:43:52 +02:00
44bec86f31 Ci test (#248)
Ci test
2019-08-12 12:39:51 +02:00
c4963268ba Fix regexTools.
The buildMatcher must not take a rvalue as it will keep a reference
to it.
2019-08-12 12:05:51 +02:00
fee2da57e6 Add tests of regex tools. 2019-08-12 12:05:51 +02:00
0154131d74 Run test on the CI. 2019-08-12 12:05:51 +02:00
3fa503efb1 [JNI] Fix implementation of setDataDirectory. (#247)
[JNI] Fix implementation of setDataDirectory.
2019-08-11 15:14:24 +02:00
73a29ccb24 [JNI] Fix implementation of setDataDirectory.
Now that setDataDirectory is a static method, we need to take an
jclass instead of a jobject.
2019-08-11 15:09:26 +02:00
1e94665c07 Http integration (#246)
Http integration
2019-08-11 11:54:09 +02:00
7060afae66 [SERVER] Catch any error and return a 500 response instead of crashing.
The server will be running some code on the behalf of the calling code.
We really don't what to crash the library (and the binary) because
of a wrong request.
2019-08-11 11:30:43 +02:00
de819dff25 Fix few errors in static files. 2019-08-11 11:30:43 +02:00
4d3df4e889 Add JNI wrapper around the library and the server. 2019-08-11 11:30:43 +02:00
cd050ddcc8 Use camelCase. 2019-08-11 11:30:43 +02:00
635d4438e5 Make the server take a pointer to the library instead of a reference. 2019-08-11 11:30:43 +02:00
ce09375c6c Reduce complexity of handle_search. 2019-08-11 11:30:43 +02:00
fae0918f49 Reduce complexity of handle_catalog. 2019-08-11 11:30:43 +02:00
d90f8b0f05 Add a name_mapper mapping the HumanReadable name to the id. 2019-08-11 11:30:43 +02:00
abb5db0193 Clean up includes in server.cpp 2019-08-11 11:30:43 +02:00
e452f5cf36 Ensure that the root is correctly formatted. 2019-08-11 11:30:43 +02:00
c890e1c87e Add support of a binding to a specific ip address. 2019-08-11 11:30:43 +02:00
e5ef3780db Rename humanReadableBookId to bookName.
`humanReadableBookId` is a bit long and doesn't represent what it is
(this is not a id).
`bookName` is far better.
2019-08-11 11:30:43 +02:00
2aeed65205 Better handling of invalid request.
Do no crash if we can get a book or a reader for the requested content.
2019-08-11 11:30:43 +02:00
c1faf55ae8 Introduce the server functionality in the kiwix-lib.
This code is mainly copied from kiwix-tools.

But :
- Move all the response thing in a new class Response.
- This Response class is responsible to handle all the MHD_response
  configuration. This way the server handle a global object and do
  no call to MHD_response*
- Server uses a lot more the templating system with mustache.
  There are still few regex operations (because we need to
  change a content already existing).
- By default, the server serves the content using the id as name.
- Server creates a new Searcher per request. This way, we don't have
  to protect the search for multi-thread and we can do several search
  in the same time.
- search results are not cached, this will allow future improvement in the
  search algorithm.
- the home page is not cached.
- Few more verbose information (number of request served, time spend to
  respond to a request).

TOOD:
 - Readd interface selection.
 - Do Android wrapper.
 - Remove KiwixServer (who use a external process).
 -
2019-08-11 11:30:43 +02:00
64dfea2547 Move the search html renderer in a different class than the searcher.
This is two different functionnalies, we don't need to polute the searcher
api with things to render the html.
2019-08-11 10:19:48 +02:00
cca5980b27 Remove limitation of the search len in the Searcher.
The limitation should be made elsewhere (the code using the searcher).
2019-08-11 10:19:48 +02:00
68a768f58a Introduce the new class NameMapper.
This class is used to map an id (uuid) to a name (potentially human
readable).

This will be use by the server to or renderer to use a different "name"
than the id.

The default NameMapper provided use the id as a name.
2019-08-11 10:19:48 +02:00
ce8fff0b42 Make the library create the reader. 2019-08-11 10:19:48 +02:00
e56335109c Make appendToFirstOccurence take argument by reference. 2019-08-11 10:19:48 +02:00
656bf183b7 Make getHumanReadableFromPath method const. 2019-08-11 10:19:48 +02:00
cbe8e20118 Fix include in otherTools.h 2019-08-11 10:19:48 +02:00
e013d38cc6 Add startWith function in stringTools.h 2019-08-11 10:19:48 +02:00
6234457920 Fix include in stringTools.h 2019-08-11 10:19:48 +02:00
72223d69fe Fix include in pathTools.h 2019-08-10 11:02:23 +02:00
ddeb862395 Add getMimeTypeForFile in pathTool. 2019-08-10 10:59:13 +02:00
61c28f0e3d Make the regexTool thread safe. 2019-08-10 10:59:13 +02:00
c8e719101e Add a new tool Lock to lock a mutex.
And automaticlly unlock it when the `Lock` got out of scope.
2019-08-10 10:59:13 +02:00
1b8e7849bd Merge pull request #244 from kiwix/badges
Add badges to the README
2019-07-31 18:09:46 +02:00
efce01aec4 Add badges to the README 2019-07-31 18:08:09 +02:00
d55976271f Merge pull request #243 from kiwix/new_version
New version 5.2.0
5.2.0
2019-07-30 18:01:31 +02:00
5eeccbae21 New version 5.2.0 2019-07-30 17:40:46 +02:00
77770e1bd4 Merge pull request #105 from kiwix/verbose_search
Set the verbosity of the underlying zim::Search.
2019-07-30 17:33:01 +02:00
654a8e304c Set the verbosity of the underlying zim::Search. 2019-07-30 17:03:44 +02:00
ed7a8343fa Merge pull request #241 from kiwix/relinker
#239 ReLinker should be used to load library
2019-07-30 16:58:22 +02:00
5adf7891cc #239 ReLinker should be used to load library 2019-07-29 18:31:57 +02:00
93c404a952 Merge pull request #238 from kiwix/http-https
Replace HTTP link by HTTPs one
2019-07-23 16:06:56 +02:00
f33f4eb381 Replace HTTP links by HTTPs one 2019-07-23 15:19:01 +02:00