Matthieu Gautier
f1035fa472
Fix win32 compilation.
...
WSASocket return a `INVALID_SOCKET` if something goes wrong,
not SOCKET_ERROR.
2021-12-23 18:32:43 +01:00
Nikhil Tanwar
9554ab5db0
Make getNetworkInterfaces() and getBestPublicIp() available via tools.h
...
Remove HTTP URL helper line - should be done in kiwix-serve
Add getters at server level - getAddress and getPort
2021-12-22 22:38:16 +05:30
Manan Jethwani
30e4c549e4
exposed fileExist, getMimeTypeForFile and getFileCoontent functions
2021-10-12 19:44:38 +05:30
Veloman Yunkan
452283cfe6
Handling of /meta?name=Illustration_WxH@1 requests
2021-08-05 22:28:09 +04:00
Maneesh P M
19afe9442f
Remove OriginId functions since they are not useful right now
2021-08-03 11:42:58 +02:00
Maneesh P M
8b12434ff2
Update kiwix::book to use libzim structure
...
Some methods in kiwix::Book uses wrapper structure reader. This usage should
be extended from the native libzim structure zim::Archive
2021-08-03 11:42:58 +02:00
Matthieu Gautier
0b6b6716de
Rename split argument from `trimEmpty` to `dropEmpty`.
2021-07-07 14:43:13 +02:00
Matthieu Gautier
b70c92cade
Move back used helper functions to the public API.
...
- Add docstring
- Move the declaration in kiwix namespace.
- Adapt our include to include the right headers.
2021-07-07 14:43:13 +02:00
Matthieu Gautier
fa83a61a54
Move all public *Tools.h in src.
...
This by definition remove all the tool functions from the public API.
2021-07-07 14:43:13 +02:00
Maneesh P M
c046f64d83
Drop Reader and Entry wrappers from handle_content
2021-07-03 14:05:50 +05:30
Maneesh P M
75b4d311d7
Drop Reader from InternalServer::handle_random
2021-07-03 14:04:04 +05:30
Maneesh P M
a236751c74
Drop usage of Reader from InternalServer::handle_suggest
2021-07-03 14:04:04 +05:30
Maneesh P M
7d68926539
Drop usage of Reader from InternalServer::handle_meta
...
This is essentially a code move of meta handlers from using Reader
functions to directly using Archive.
2021-07-03 14:04:02 +05:30
Veloman Yunkan
cdacc0caf1
/catalog/v2/entries going through OPDSDumper
...
OPDSDumper sensed threats to its job security, so it lobbied to be
involved in handling the /catalog/v2 endpoints, too.
2021-06-08 20:37:00 +04:00
Veloman Yunkan
54b78eaf56
Moved gen_date_str() to tools/otherTools.cpp
2021-06-08 16:03:43 +04:00
Emmanuel Engelhart
d4e35c7067
Rename kiwix-lib in libkiwix
2021-05-23 21:46:52 +02:00
Matthieu Gautier
3fd1310008
Use c++11 std::thread instead of pthread.
2021-01-26 17:53:25 +01:00
Emmanuel Engelhart
a8bf9dd5b4
Better Kiwix Serve Taskbar insertion (after charset definition)
2021-01-18 11:18:53 +01:00
Veloman Yunkan
0f8fe1f63f
Alternative implementation of parseMimetypeCounter()
2020-10-29 14:11:27 +04:00
Matthieu Gautier
08464f23bc
Better parsing of `M/Counter`
...
Mimetype may contain a parameters.
Then, the mimetype would be something like "text/html;foo=bar;foz=baz"
It will contains a `;` and `=` and it conflicts with the same operators
we use to separate the items in our list.
We have to use a more advanced algorithm which takes the context into
account.
Fix #416
2020-10-28 16:03:18 +01:00
Matthieu Gautier
ef42abea4b
Add some tests of `parseMimetypeCounter`
2020-10-28 14:44:23 +01:00
Matthieu Gautier
4407dd12bd
Move mimetypeCounter parsing in its own function.
2020-10-28 14:08:06 +01:00
Matthieu Gautier
7ece383004
Add support for samba path on windows.
...
Fix kiwix/kiwix-desktop#429
2020-07-15 11:40:02 +02:00
Matthieu Gautier
9d8bf8ddcb
Create the dataDirectory before returning its path.
2020-04-15 08:24:55 +02:00
Matthieu Gautier
4c8aad0e68
Do not use std::fstream has it doesn't support wchar path.
...
This is surprising, but C++11 fstream doesn't have a constructor
that take wchar as path.
So, on windows, we cannot open a stream on a path containing non ascii
char. VC++ provide an extension for that, but it is not standard and
g++ mingwin doesn't provide it.
So move all our write/read tools function to the plain old c versions,
using _wopen to open wide path on windows.
2020-04-14 18:13:35 +02:00
Matthieu Gautier
eb6f0f710c
Correctly detetect the dataDir on windows.
...
We must use the wide version of the getenv to correctly handle the case
we have accents in the user directory.
This also change the default dataDirectory on windows from $APPDATA to
$APPDATA/kiwix.
2020-04-14 12:12:34 +02:00
Kelson
6a975994cc
Include stdexcept to fix GCC v10 compilation
2020-02-01 13:52:27 +01:00
Matthieu Gautier
7275f9b8e3
Move function to convert and use tags inside otherTools.
2020-01-30 17:48:56 +01:00
Kelson
b7c5e5f339
Remove trailing spaces
2019-12-08 11:52:16 +01:00
Matthieu Gautier
67170709bb
Convert path get from windows environment to utf8.
...
Fix kiwix/kiwix-desktop#203
2019-09-25 18:07:42 +02:00
Matthieu Gautier
598dd3c175
[API Break] Fix pathTools (and a bit stringTools).
...
Api changes :
- removeLastPathElement do not takes extra arguments
`removePreSeparator` and `removePostSeparator`.
This is not needed as path do not need special tailing separator.
- Only one function `split`. Arguments can be implicitly convert to
string. No need for overloading functions to explicitly cast them.
- `split` function takes another argument `trimEmpty`. If true, empty
element are removed.
Path manipulation now almost pass trough a vector<string> to store each
path's part.
Most of the complex works is now made in the normalizeParts function.
2019-09-19 18:16:06 +02:00
Matthieu Gautier
2f4636e2df
Fix stringTools join function.
2019-09-17 16:22:28 +02:00
Matthieu Gautier
9b4419f3fc
[ABI Break] Correctly detect the executable path in appimage.
...
There are two executable path :
- The user one (the appimage path)
- The real one (in the appimage archive)
When we search of `library.xml` we need the user one.
But when we search of `aria2c` or `kiwix-serve` we need the real one.
Fix kiwix/kiwix-desktop#256
2019-09-17 11:23:16 +02:00
Matthieu Gautier
157c1c939c
Add a string tool to join a list of strings together.
2019-09-16 09:42:10 +02:00
Matthieu Gautier
a32363e6a2
Correctly detect the executable path if we use a AppImage.
...
AppImage works by decompressing the "program" in a temporary directory.
So the executable path is not the path of the AppImage file.
By using the environment variables set by appimage we can find the correct
"path" of the executable.
Fix kiwix/kiwix-desktop#46
2019-09-09 18:27:53 +02:00
Matthieu Gautier
12a93c3e29
Fix use of strtok on windows.
...
On windows, strtok_r is called strto_s.
2019-08-19 17:35:22 +02:00
Matthieu Gautier
52299ef767
Fix computeAbsolutePath.
...
Correctly delete the duplicated string.
Use strtok_r to be thread safe.
2019-08-12 12:43:52 +02:00
Matthieu Gautier
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
Matthieu Gautier
e56335109c
Make appendToFirstOccurence take argument by reference.
2019-08-11 10:19:48 +02:00
Matthieu Gautier
cbe8e20118
Fix include in otherTools.h
2019-08-11 10:19:48 +02:00
Matthieu Gautier
e013d38cc6
Add startWith function in stringTools.h
2019-08-11 10:19:48 +02:00
Matthieu Gautier
6234457920
Fix include in stringTools.h
2019-08-11 10:19:48 +02:00
Matthieu Gautier
72223d69fe
Fix include in pathTools.h
2019-08-10 11:02:23 +02:00
Matthieu Gautier
ddeb862395
Add getMimeTypeForFile in pathTool.
2019-08-10 10:59:13 +02:00
Matthieu Gautier
61c28f0e3d
Make the regexTool thread safe.
2019-08-10 10:59:13 +02:00
Matthieu Gautier
4e746916a7
Remove unnecessary include.
...
And unistd.h is not available on windows.
2019-06-12 14:27:15 +02:00
Matthieu Gautier
e7e88617d5
Remove unused include unistd.h
...
We don't use it anymore and it is not present on Windows.
2019-04-15 10:50:26 +02:00
Matthieu Gautier
f8522fb26e
Remove getNetworkInterfaces and getBestPublicIp function.
...
They are not used at all and the windows version need some extra libs
that complexify the code.
Remove them for now. If it happens that they are needed, we will readd
them.
2019-04-04 17:00:45 +02:00
Matthieu Gautier
938e2a81c1
Rewrite makeTmpDirectory to not use Uuid methods on windows.
...
`UuidCreate`, `UuidToString` and `RpcStringFree` need special library
on windows. Lets not use them.
2019-04-04 16:11:36 +02:00
Matthieu Gautier
93af3aa2d1
Fix the language mapping.
...
The previous mapping was taken from an unknown (:/) source.
The new mapping is generated with a script taking
https://www.loc.gov/standards/iso639-2/php/code_list.php as source.
The source list is sanitized to keep only language for which we
(http://library.kiwix.org/ ) have content.
2019-03-05 17:53:37 +01:00