mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2026-01-14 08:57:45 -05:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d21baa759 | ||
|
|
6ba6046850 | ||
|
|
d24f474dda | ||
|
|
07de2d29c4 | ||
|
|
d99e5cd975 | ||
|
|
f82d5aa7e5 | ||
|
|
824aef9189 | ||
|
|
d6914eb34f | ||
|
|
b65212fab7 | ||
|
|
83427af3d2 | ||
|
|
d572bf875d | ||
|
|
833c997782 | ||
|
|
44613aae5d |
@@ -1,6 +1,6 @@
|
||||
name: CI
|
||||
|
||||
on: [pull_request]
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Linux:
|
||||
@@ -31,25 +31,20 @@ jobs:
|
||||
container:
|
||||
image: "kiwix/kiwix-build_ci:${{matrix.image_variant}}-26"
|
||||
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: |
|
||||
import json
|
||||
from subprocess import check_call
|
||||
from os import environ
|
||||
with open(environ['GITHUB_EVENT_PATH'], 'r') as f:
|
||||
content = f.read()
|
||||
event_data = json.loads(content)
|
||||
try:
|
||||
branch_ref = event_data['ref'].split('/')[-1]
|
||||
except KeyError:
|
||||
branch_ref = event_data['pull_request']['head']['ref']
|
||||
print("Cloning branch", branch_ref)
|
||||
command = [
|
||||
'git', 'clone',
|
||||
'https://github.com/${{github.repository}}',
|
||||
'--depth=1',
|
||||
'--branch', branch_ref
|
||||
'--branch', '${{steps.extract_branch.outputs.branch}}'
|
||||
]
|
||||
check_call(command, cwd=environ['HOME'])
|
||||
- name: Install deps
|
||||
10
Changelog
10
Changelog
@@ -1,3 +1,13 @@
|
||||
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
|
||||
=================
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ command line tools:
|
||||
* kiwix-search: Fulltext search in ZIM files
|
||||
* kiwix-serve: HTTP daemon serving ZIM files
|
||||
|
||||
[](https://travis-ci.com/kiwix/kiwix-tools)
|
||||
[](https://github.com/kiwix/kiwix-tools/actions?query=branch%3Amaster)
|
||||
[](https://www.codefactor.io/repository/github/kiwix/kiwix-tools)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
|
||||
|
||||
@@ -16,3 +16,10 @@ fi
|
||||
CMD="/usr/local/bin/kiwix-serve --port=80 $@"
|
||||
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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
project('kiwix-tools', 'cpp',
|
||||
version : '3.0.2',
|
||||
version : '3.1.0',
|
||||
license : 'GPL',
|
||||
default_options: ['c_std=c11', 'cpp_std=c++11', 'werror=true'])
|
||||
|
||||
@@ -13,7 +13,7 @@ if static_linkage
|
||||
endif
|
||||
|
||||
thread_dep = dependency('threads')
|
||||
kiwixlib_dep = dependency('kiwix', version:'>=9.0.0', static:static_linkage)
|
||||
kiwixlib_dep = dependency('kiwix', version:'>=9.1.0', static:static_linkage)
|
||||
microhttpd_dep = dependency('libmicrohttpd', static:static_linkage)
|
||||
z_dep = dependency('zlib', static:static_linkage)
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ int handle_add(kiwix::Library* library, const std::string& libraryPath,
|
||||
string zimPath;
|
||||
string zimPathToSave = ".";
|
||||
string url;
|
||||
string origID = "";
|
||||
int option_index = 0;
|
||||
int c = 0;
|
||||
int resultCode = 0;
|
||||
@@ -133,7 +132,6 @@ int 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}
|
||||
};
|
||||
@@ -149,9 +147,6 @@ int handle_add(kiwix::Library* library, const std::string& libraryPath,
|
||||
case 'u':
|
||||
url = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
origID = optarg;
|
||||
break;
|
||||
case 'z':
|
||||
zimPathToSave = optarg;
|
||||
break;
|
||||
@@ -228,7 +223,7 @@ int main(int argc, char** argv)
|
||||
|
||||
int option_index = 0;
|
||||
int c;
|
||||
while (true) {
|
||||
while (true && argc == 2) {
|
||||
c = getopt_long(argc, argv, "v", long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
@@ -60,6 +60,7 @@ void usage()
|
||||
<< "\t-i, --address\t\tlisten only on this ip address, all available ones otherwise" << std::endl
|
||||
<< "\t-m, --nolibrarybutton\tdo not print the builtin home button in the builtin top bar overlay" << std::endl
|
||||
<< "\t-n, --nosearchbar\tdo not print the builtin bar overlay on the top of each served page" << std::endl
|
||||
<< "\t-b, --blockexternal\tprevent users from directly accessing external links" << std::endl
|
||||
<< "\t-p, --port\t\tTCP port on which to listen to HTTP requests (default: 80)" << std::endl
|
||||
<< "\t-r, --urlRootLocation\tURL prefix on which the content should be made available (default: /)" << std::endl
|
||||
<< "\t-t, --threads\t\tnumber of threads to run in parallel (default: " << DEFAULT_THREADS << ")" << std::endl
|
||||
@@ -90,6 +91,7 @@ int main(int argc, char** argv)
|
||||
bool noLibraryButtonFlag = false;
|
||||
bool noSearchBarFlag = false;
|
||||
bool noDateAliasesFlag = false;
|
||||
bool blockExternalLinks = false;
|
||||
bool isVerboseFlag = false;
|
||||
bool trustlibrary = true;
|
||||
string PPIDString;
|
||||
@@ -103,6 +105,7 @@ int main(int argc, char** argv)
|
||||
{"nolibrarybutton", no_argument, 0, 'm'},
|
||||
{"nodatealiases", no_argument, 0, 'z'},
|
||||
{"nosearchbar", no_argument, 0, 'n'},
|
||||
{"blockexternallinks", no_argument, 0, 'b'},
|
||||
{"attachToProcess", required_argument, 0, 'a'},
|
||||
{"port", required_argument, 0, 'p'},
|
||||
{"address", required_argument, 0, 'i'},
|
||||
@@ -115,7 +118,7 @@ int main(int argc, char** argv)
|
||||
while (true) {
|
||||
int option_index = 0;
|
||||
int c
|
||||
= getopt_long(argc, argv, "zmndvVla:p:f:t:r:i:", long_options, &option_index);
|
||||
= getopt_long(argc, argv, "zmnbdvVla:p:f:t:r:i:", long_options, &option_index);
|
||||
|
||||
if (c != -1) {
|
||||
switch (c) {
|
||||
@@ -134,6 +137,9 @@ int main(int argc, char** argv)
|
||||
case 'n':
|
||||
noSearchBarFlag = true;
|
||||
break;
|
||||
case 'b':
|
||||
blockExternalLinks = true;
|
||||
break;
|
||||
case 'z':
|
||||
noDateAliasesFlag = true;
|
||||
break;
|
||||
@@ -249,6 +255,7 @@ int main(int argc, char** argv)
|
||||
server.setNbThreads(nb_threads);
|
||||
server.setVerbose(isVerboseFlag);
|
||||
server.setTaskbar(!noSearchBarFlag, !noLibraryButtonFlag);
|
||||
server.setBlockExternalLinks(blockExternalLinks);
|
||||
|
||||
if (! server.start()) {
|
||||
cerr << "Unable to instantiate the HTTP daemon. The port " << serverPort
|
||||
|
||||
Reference in New Issue
Block a user