diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..3226aa9 --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,19 @@ +version = "1.0" + +[main] +name.en = "Upload content" + + [main.upload] + + [main.upload.upload_url] + default = "" + type = "string" + ask.en = "Content URL" + help.en = "For example: https://download.kiwix.org/zim/other/pokepedia_fr_all_maxi_2021-01.zim" + help.fr = "Par exemple : https://download.kiwix.org/zim/other/pokepedia_fr_all_maxi_2021-01.zim" + + [main.upload.upload_button] + ask.en = "Upload" + type = "button" + style = "success" + enabled = "upload_url" diff --git a/doc/ADMIN.md b/doc/ADMIN.md index ef264bb..e5c678e 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,5 +1,9 @@ ### How to add zim files? +#### Add a zin file through its URL +- Click on the "Upload content" tab above. + +#### Add a zim file by hand - Download one or more ZIM files, e.g. from [https://download.kiwix.org/zim/](https://download.kiwix.org/zim/) - Put the ZIM files into `__DATA_DIR__` - Add them to the library with the following command: diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 79f4ef7..883280d 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,5 +1,10 @@ ### Comment ajouter des fichiers ZIM ? + +#### Ajouter un fichier ZIM via son URL +- Sélectionnez l'onglet "Upload content" qui se trouve ci-dessus. + +#### Ajouter un fichier ZIM à la main - Téléchargez un ou plusieurs fichiers ZIM, par ex. [https://download.kiwix.org/zim/](https://download.kiwix.org/zim/) - Mettez les fichiers ZIM dans `__DATA_DIR__/` - Ajoutez-les à la bibliothèque avec la commande suivante : diff --git a/manifest.toml b/manifest.toml index 8ebfde3..7f0a509 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Kiwix" description.en = "Sharing Web content with people without Internet access" description.fr = "Partager du contenu Web avec des personnes sans accès à Internet" -version = "3.5.0~ynh3" +version = "3.5.0~ynh4" maintainers = ["eric_G"] diff --git a/scripts/config b/scripts/config new file mode 100644 index 0000000..26a4c5e --- /dev/null +++ b/scripts/config @@ -0,0 +1,15 @@ +#!/bin/bash +source /usr/share/yunohost/helpers +ynh_abort_if_errors + +function run__upload_button() { + local data_dir=$(ynh_app_setting_get --app=$app --key=data_dir) + local filename="$(echo "$upload_url" | awk -F/ '{print $NF}')" + ynh_print_info --message="Downloading file…" + wget --tries 3 --no-dns-cache --timeout 900 --output-document="$data_dir/$filename" "$upload_url" 2>&1 + ynh_print_info --message="Adding file to Kiwix library" + $install_dir/kiwix-manage $data_dir/library.xml add "$data_dir/$filename" + yunohost service restart kiwix +} + +ynh_app_config_run $1