diff --git a/README.md b/README.md index ad1864e..a57fe37 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Kiwix is an offline reader for online content like Wikipedia, Project Gutenberg, - Able to deal with one ZIM file or XML library files -**Shipped version:** 3.5.0~ynh3 +**Shipped version:** 3.5.0~ynh4 **Demo:** http://library.kiwix.org/ diff --git a/README_fr.md b/README_fr.md index 2c02e16..3061e17 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,7 +26,7 @@ Kiwix est un lecteur hors-ligne pour contenus web qui permet en particulier d’ - Embedded in Kiwix UI - Capable de traiter un fichier ZIM ou des fichiers de bibliothèque XML -**Version incluse :** 3.5.0~ynh3 +**Version incluse :** 3.5.0~ynh4 **Démo :** http://library.kiwix.org/ diff --git a/conf/systemd.service b/conf/systemd.service index 9ee4928..c5ca7f5 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -5,8 +5,7 @@ Description=Kiwix: Sharing Web content Type=simple User=__APP__ Group=__APP__ -ExecStart=__INSTALL_DIR__/kiwix-serve --daemon --address 127.0.0.1 --port __PORT__ --library __DATA_DIR__/library.xml --urlRootLocation=__PATH__/ -RemainAfterExit=yes +ExecStart=__INSTALL_DIR__/kiwix-serve --address 127.0.0.1 --port __PORT__ --library __DATA_DIR__/library.xml --urlRootLocation=__PATH__/ Restart=on-abort RestartSec=5s 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..013312f 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,5 +1,9 @@ ### 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..7386b5f 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"] @@ -23,13 +23,12 @@ multi_instance = true ldap = false sso = false disk = "50M" -ram.build = "50M" +ram.build = "100M" ram.runtime = "50M" [install] [install.domain] type = "domain" - full_domain = true [install.init_main_permission] type = "group" 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 diff --git a/scripts/install b/scripts/install index e73a20e..059d53b 100755 --- a/scripts/install +++ b/scripts/install @@ -23,13 +23,18 @@ chown -R $app:www-data "$install_dir" chmod +x $install_dir/{kiwix-manage,kiwix-serve,kiwix-search} #================================================= -# NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="Internet without Internet access" --log="systemd" + #================================================= # CREATE DATA DIRECTORY #================================================= @@ -38,25 +43,9 @@ ynh_script_progression --message="Creating a data directory..." --weight=1 pushd $data_dir ynh_exec_warn_less ynh_exec_as $app curl -LO https://download.kiwix.org/zim/wikipedia/wikipedia_fr_climate_change_mini_2023-04.zim > /dev/null popd + ynh_exec_warn_less ynh_exec_as $app $install_dir/kiwix-manage $data_dir/library.xml add $data_dir/*.zim -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=2 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --log="systemd" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 06fb827..4c29204 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE +# REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null @@ -22,19 +23,9 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 7f62f91..5af63ad 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,15 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -26,8 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= @@ -40,21 +29,16 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory chown -R $app:www-data "$data_dir" #================================================= -# SPECIFIC RESTORATION +# RESTORE SYSTEM CONFIGURATIONS #================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --log="systemd" +yunohost service add $app --description="Internet without Internet access" --log="systemd" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 2c79b2f..1126b63 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,35 +37,21 @@ then ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x $install_dir/{kiwix-manage,kiwix-serve,kiwix-search} #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=3 - # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 - -yunohost service add $app --log="systemd" +yunohost service add $app --description="Internet without Internet access" --log="systemd" #================================================= # START SYSTEMD SERVICE