From 4222fb446e1c6651065175bad3507763af24dc09 Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Mon, 8 Jun 2020 15:52:13 +0200 Subject: [PATCH 01/36] [conf/systemd] python3.5 not on buster --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index d166c60..877f964 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=/bin/sh -c '/usr/bin/python3.5 __FINALPATH__/cps.py' +ExecStart=/bin/sh -c '/usr/bin/python3 __FINALPATH__/cps.py' [Install] WantedBy=multi-user.target From 14802ae390a23d64d92d206161f88bfdd79cfbc7 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 21 Jun 2020 15:23:56 +0200 Subject: [PATCH 02/36] Version 0.6.8 --- README.md | 2 +- conf/app.src | 6 +++--- conf/app066.src | 2 +- manifest.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0625610..b4d702a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d Alternatively, you may use [COPS](https://github.com/YunoHost-Apps/cops_ynh) which also allows access to your Calibre Library, but in read-only mode. -**Shipped version:** The shipped version is 0.6.7, but as the numbering changed in the calibre-web app, it is numbered as 0.96.7 in yunohost. +**Shipped version:** The shipped version is 0.6.8, but as the numbering changed in the calibre-web app, it is numbered as 0.96.8 in yunohost. Users will be synchronized with authorized Yunohost users (having the calibreweb.main authorization group) automatically. In case of issue you may force the sync in the app itself. diff --git a/conf/app.src b/conf/app.src index 9723afd..e9c3099 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.7/calibre-web-0.6.7.zip -SOURCE_SUM=0c803df4b49993987a7f317c47ba38e680e45712b49da3cb7eb6c66f57379f30 -SOURCE_FORMAT=zip +SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.8/calibre-web-0.6.8.zip +SOURCE_SUM=41ff00685893bad9794102d20a757c221704f10976f8aa7e6a0fecc817c329bf +SOURCE_FORMAT=zip \ No newline at end of file diff --git a/conf/app066.src b/conf/app066.src index f3f4ee7..586a6ab 100644 --- a/conf/app066.src +++ b/conf/app066.src @@ -1,3 +1,3 @@ SOURCE_URL=https://github.com/janeczku/calibre-web/archive/0.6.6.zip SOURCE_SUM=87633c2817263ed2d12fce67ea292b1c6d042aa949aafb728789c15d495415cc -SOURCE_FORMAT=zip +SOURCE_FORMAT=zip \ No newline at end of file diff --git a/manifest.json b/manifest.json index 9387bc0..656a685 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Browsing, reading and downloading eBooks using a Calibre database", "fr": "Explorer, lire et télécharger des eBooks à partir d'une base de données Calibre" }, - "version": "0.96.7~ynh5", + "version": "0.96.8~ynh5", "url": "https://github.com/janeczku/calibre-web", "license": "free", "maintainer": { From a6fbf99cf0f583875caf632290ff2f6fcd6099f7 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Mon, 22 Jun 2020 22:19:23 +0200 Subject: [PATCH 03/36] Remove systemd stop/start on backup --- scripts/backup | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/backup b/scripts/backup index d434683..78fea1e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -42,8 +42,8 @@ source ../settings/scripts/_common.sh # STOP SYSTEMD SERVICE #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" +#Deactivate as per package linter +#ynh_systemd_action --service_name=$app --action="stop" #================================================= @@ -89,9 +89,9 @@ ynh_backup --src_path="$calibre_dir" --is_big #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=5 - -ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 30 +#deactivate as per package_linter +#ynh_script_progression --message="Starting a systemd service..." --weight=5 +#ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 30 #================================================= From 7a13f62fef542c08fd6fac884481e3b5a91317bd Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 20 Sep 2020 02:10:56 +0200 Subject: [PATCH 04/36] Port shouldn't be opened on the firewall ... it supposed to be only there for reverse proxying --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index a60559b..7db37be 100755 --- a/scripts/install +++ b/scripts/install @@ -67,14 +67,13 @@ ynh_app_setting_set $app is_public $is_public #================================================= # STANDARD MODIFICATIONS #================================================= -# FIND AND OPEN A PORT +# FIND AN AVAILABLE PORT #================================================= # Find a free port port=$(ynh_find_port 8083) # Open this port ynh_script_progression --message="Opening port $port..." --weight=5 -yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port #================================================= From 9de482b23ac465e69665c3dfa21cbb390d73084b Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 20 Sep 2020 17:43:10 +0200 Subject: [PATCH 05/36] remove opening of port 8083 --- .settings/org.eclipse.core.resources.prefs | 2 -- scripts/install | 3 +-- scripts/restore | 1 - scripts/upgrade | 8 ++++++++ 4 files changed, 9 insertions(+), 5 deletions(-) delete mode 100644 .settings/org.eclipse.core.resources.prefs diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 8e4e3b8..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding//conf/generate_password_hash.py=utf-8 diff --git a/scripts/install b/scripts/install index 7db37be..8b96265 100755 --- a/scripts/install +++ b/scripts/install @@ -72,8 +72,7 @@ ynh_app_setting_set $app is_public $is_public # Find a free port port=$(ynh_find_port 8083) -# Open this port -ynh_script_progression --message="Opening port $port..." --weight=5 +ynh_script_progression --message="Setting port $port..." --weight=5 ynh_app_setting_set $app port $port #================================================= diff --git a/scripts/restore b/scripts/restore index bdcbcac..70df492 100755 --- a/scripts/restore +++ b/scripts/restore @@ -51,7 +51,6 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="reopening port $port..." --weight=5 -yunohost firewall allow --no-upnp TCP $port 2>&1 ynh_app_setting_set $app port $port #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d330989..e5e31d6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,6 +56,14 @@ else #on est encore en 0.6.0 current_upstream_app_version='0.6.0' fi +#Close unwanted open port in firewall +if yunohost firewall list | grep -q "\- $port$" +then + ynh_script_progression --message="Closing port $port..." --weight=10 + yunohost firewall disallow TCP $port 2>&1 +fi + + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From 16eab13eaf177e39ea67de9be5278ac0b7d119b4 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 20 Sep 2020 17:44:52 +0200 Subject: [PATCH 06/36] update closing message --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index e5e31d6..fcf73ef 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -59,7 +59,7 @@ fi #Close unwanted open port in firewall if yunohost firewall list | grep -q "\- $port$" then - ynh_script_progression --message="Closing port $port..." --weight=10 + ynh_script_progression --message="Closing port $port as it shouldn't be open..." yunohost firewall disallow TCP $port 2>&1 fi From 88103ef9bf829cff55dc47bfbf77d93920f7c0ca Mon Sep 17 00:00:00 2001 From: Krakinou Date: Mon, 5 Oct 2020 21:34:30 +0200 Subject: [PATCH 07/36] Use 0.6.9 --- README.md | 8 ++++---- conf/app.src | 4 ++-- manifest.json | 2 +- sources/patches/app-optional-requirements.patch | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b4d702a..a088757 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d Alternatively, you may use [COPS](https://github.com/YunoHost-Apps/cops_ynh) which also allows access to your Calibre Library, but in read-only mode. -**Shipped version:** The shipped version is 0.6.8, but as the numbering changed in the calibre-web app, it is numbered as 0.96.8 in yunohost. +**Shipped version:** The shipped version is 0.6.9, but as the numbering changed in the calibre-web app, it is numbered as 0.96.9 in yunohost. Users will be synchronized with authorized Yunohost users (having the calibreweb.main authorization group) automatically. In case of issue you may force the sync in the app itself. @@ -71,13 +71,13 @@ chmod o+rw path/to/library Developers info ---------------- -Please do your pull request to the [testing branch](https://github.com/Yunohost-Apps/calibreweb_ynh/tree/Testing). +Please do your pull request to the [testing branch](https://github.com/Yunohost-Apps/calibreweb_ynh/tree/testing). To try the testing branch, please proceed like that. ``` -sudo yunohost app install https://github.com/Yunohost-Apps/calibreweb_ynh/tree/Testing --debug +sudo yunohost app install https://github.com/Yunohost-Apps/calibreweb_ynh/tree/testing --debug or -sudo yunohost app upgrade calibreweb -u https://github.com/Yunohost-Apps/calibreweb_ynh/tree/Testing --debug +sudo yunohost app upgrade calibreweb -u https://github.com/Yunohost-Apps/calibreweb_ynh/tree/testing --debug ``` diff --git a/conf/app.src b/conf/app.src index e9c3099..fbc1b41 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.8/calibre-web-0.6.8.zip -SOURCE_SUM=41ff00685893bad9794102d20a757c221704f10976f8aa7e6a0fecc817c329bf +SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.9/calibre-web-0.6.9.zip +SOURCE_SUM=e1e393e6f08f68d7aa11baf7a2f1d19b6e0ea83dadc52391470b7d1e6a3155b4 SOURCE_FORMAT=zip \ No newline at end of file diff --git a/manifest.json b/manifest.json index 656a685..6b501c0 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Browsing, reading and downloading eBooks using a Calibre database", "fr": "Explorer, lire et télécharger des eBooks à partir d'une base de données Calibre" }, - "version": "0.96.8~ynh5", + "version": "0.96.9~ynh5", "url": "https://github.com/janeczku/calibre-web", "license": "free", "maintainer": { diff --git a/sources/patches/app-optional-requirements.patch b/sources/patches/app-optional-requirements.patch index f798cca..b2b1aad 100644 --- a/sources/patches/app-optional-requirements.patch +++ b/sources/patches/app-optional-requirements.patch @@ -1,12 +1,12 @@ ---- a/optional-requirements.txt 2020-05-05 20:28:10.000000000 +0200 -+++ b/optional-requirements.txt 2020-05-10 21:21:53.032894653 +0200 +--- a/optional-requirements.txt 2020-09-27 07:15:03.000000000 +0200 ++++ b/optional-requirements.txt 2020-10-04 19:03:58.367531339 +0200 @@ -1,17 +1,3 @@ -# GDrive Integration -google-api-python-client==1.7.11,<1.8.0 --gevent>=1.2.1,<1.6.0 +-gevent>=1.2.1,<20.6.0 -greenlet>=0.4.12,<0.5.0 -httplib2>=0.9.2,<0.18.0 --oauth2client>=4.0.0,<4.14.0 +-oauth2client>=4.0.0,<4.1.4 -uritemplate>=3.0.0,<3.1.0 -pyasn1-modules>=0.0.8,<0.3.0 -pyasn1>=0.1.9,<0.5.0 From db8e39baf5efd73efefe7718797f17b3d75ce0cc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Dec 2020 13:09:14 +0100 Subject: [PATCH 08/36] Fix linter warnings --- check_process | 5 ++--- manifest.json | 4 ++-- scripts/_common.sh | 2 +- scripts/install | 23 +++-------------------- scripts/restore | 5 +++-- scripts/upgrade | 17 +++++++---------- 6 files changed, 18 insertions(+), 38 deletions(-) diff --git a/check_process b/check_process index b991b3d..e662171 100644 --- a/check_process +++ b/check_process @@ -38,12 +38,11 @@ # setup_sub_dir=1 # setup_root=1 # upgrade=1 from_commit=3b9c5041e4fa73cb965368379f2b83d076c65341 -;;; Levels - Level 5=auto ;;; Options Email=nicolas@aubonalbanais.ovh Notification=none ;;; Upgrade options ; commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9 name=Version 0.96.0~ynh4 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1& \ No newline at end of file + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1& + \ No newline at end of file diff --git a/manifest.json b/manifest.json index 6b501c0..7d1b69d 100644 --- a/manifest.json +++ b/manifest.json @@ -8,13 +8,13 @@ }, "version": "0.96.9~ynh5", "url": "https://github.com/janeczku/calibre-web", - "license": "free", + "license": "GPL-3.0-only", "maintainer": { "name": "Krakinou", "email": "misterl56@hotmail.com" }, "requirements": { - "yunohost": ">= 3.7.1" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index c6b3b07..3e67c31 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -27,7 +27,7 @@ ynh_multimedia_build_main_dir () { local checksum="806a827ba1902d6911095602a9221181" # Download yunohost.multimedia scripts - wget -nv https://github.com/Yunohost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz + wget -nv https://github.com/Yunohost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1 # Check the control sum echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ diff --git a/scripts/install b/scripts/install index 8b96265..b807e14 100755 --- a/scripts/install +++ b/scripts/install @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -27,8 +28,6 @@ if [ $is_public -eq 1 ]; then public_library=1 fi -source _common.sh - #================================================= # MANAGE SCRIPT FAILURE #================================================= @@ -36,7 +35,6 @@ source _common.sh # Exit if an error occurs during the execution of the script ynh_abort_if_errors - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -45,9 +43,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) - # Check web path availability ynh_webpath_available $domain $path_url # Register (book) web path @@ -63,7 +58,6 @@ ynh_app_setting_set $app path $path_url ynh_app_setting_set $app admin $admin ynh_app_setting_set $app is_public $is_public - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -192,16 +186,6 @@ eval sqlite3 $final_path/app.db "$conf" conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WHERE ID=1\"" eval sqlite3 $final_path/app.db "$conf" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -#disabled - do not work when calibreweb is not owner -#chown -R root: $final_path -#chown $app: $final_path/app.db - - #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE #================================================= @@ -210,10 +194,10 @@ eval sqlite3 $final_path/app.db "$conf" ynh_store_file_checksum "${final_path}/app.db" #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= -yunohost service add $app --description "Browse eBook in the web" --log "/var/log/$app/$app.log" +yunohost service add $app --description="Browse eBook in the web" --log="/var/log/$app/$app.log" #================================================= # SETUP SSOWAT @@ -230,7 +214,6 @@ if [ $public_library -eq 0 ]; then yunohost app addaccess $app -u $admin fi - #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/restore b/scripts/restore index 70df492..8bd3aea 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= @@ -19,6 +20,7 @@ ynh_abort_if_errors # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading settings..." --weight=1 + app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) @@ -27,7 +29,6 @@ final_path=$(ynh_app_setting_get $app final_path) calibre_dir=$(ynh_app_setting_get $app calibre_dir) is_public=$(ynh_app_setting_get $app is_public) port=$(ynh_app_setting_get $app port) -source ../settings/scripts/_common.sh #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -99,7 +100,7 @@ curl https://bootstrap.pypa.io/get-pip.py | python3 ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service +systemctl enable $app.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index fcf73ef..44a58c5 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,6 +10,7 @@ version_gt() { # IMPORT GENERIC HELPERS #================================================= +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -34,8 +35,6 @@ ynh_app_setting_set $app calibre_dir $calibre_dir upload=$(sqlite3 $final_path/app.db "SELECT config_uploading FROM settings WHERE ID=1") ynh_app_setting_set $app upload $upload -source _common.sh - #================================================= # CHECK VERSION #================================================= @@ -86,13 +85,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="stop" -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path $path_url) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -224,6 +216,12 @@ ynh_add_systemd_config # Set permissions on app files chown -R $app: $final_path +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= + +yunohost service add $app --description="Browse eBook in the web" --log="/var/log/$app/$app.log" + #================================================= # SETUP SSOWAT #================================================= @@ -262,4 +260,3 @@ ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t #================================================= ynh_script_progression --message="Upgrade of $app completed" --last - From 5f35a30f8007caf7eb33b4dc2a2d1891b3f1b976 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Dec 2020 13:11:29 +0100 Subject: [PATCH 09/36] Update backup --- scripts/backup | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/scripts/backup b/scripts/backup index 78fea1e..75680d2 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= - +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get $app final_path) @@ -31,26 +31,17 @@ port=$(ynh_app_setting_get $app port) calibre_dir=$(sqlite3 $final_path/app.db "SELECT config_calibre_dir FROM settings WHERE ID=1") #Save it in settings so that it can be used back afterward calibre_dir=${calibre_dir%/} -ynh_app_setting_set $app calibre_dir $calibre_dir - -source ../settings/scripts/_common.sh - +ynh_app_setting_set $app calibre_dir $calibre_dir #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP #================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 -#Deactivate as per package linter -#ynh_systemd_action --service_name=$app --action="stop" - +ynh_print_info --message="Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --weight=1 #This will backup the app.db file at the same time ynh_backup --src_path="$final_path" @@ -58,44 +49,30 @@ ynh_backup --src_path="$final_path" # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1 - ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # SPECIFIC BACKUP #================================================= # BACKUP LOGROTATE #================================================= -ynh_script_progression --message="Backing up logrotate configuration..." --weight=1 + ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= # BACKUP SYSTEMD #================================================= -ynh_script_progression --message="Backing up systemd configuration..." --weight=1 -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= # BACKUP THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Backing up data directory..." -ynh_print_info "Data directory will be backup up only if BACKUP_CORE_ONLY is unset" + ynh_backup --src_path="$calibre_dir" --is_big - -#================================================= -# START SYSTEMD SERVICE -#================================================= -#deactivate as per package_linter -#ynh_script_progression --message="Starting a systemd service..." --weight=5 -#ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 30 - - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last \ No newline at end of file +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." From 58da6726caa020d81e968be9cbc3d34514dd7282 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Dec 2020 13:13:49 +0100 Subject: [PATCH 10/36] Add badges --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a088757..6713c25 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ - # Calibre-web for YunoHost -[![Integration level](https://dash.yunohost.org/integration/calibreweb.svg)](https://ci-apps.yunohost.org/jenkins/job/calibreweb%20%28Community%29/lastBuild/consoleFull) + +[![Integration level](https://dash.yunohost.org/integration/calibreweb.svg)](https://dash.yunohost.org/appci/app/calibreweb) ![](https://ci-apps.yunohost.org/ci/badges/calibreweb.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/calibreweb.maintain.svg) [![Install calibreweb with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=calibreweb) > *This package allow you to install calibreweb quickly and simply on a YunoHost server. @@ -68,8 +68,7 @@ chmod o+rw path/to/library --- -Developers info ----------------- +## Developers info Please do your pull request to the [testing branch](https://github.com/Yunohost-Apps/calibreweb_ynh/tree/testing). From 4927434f0730e57cff1166336c943d569c1a7e78 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Tue, 5 Jan 2021 22:57:06 +0100 Subject: [PATCH 11/36] Remove unused var from _common.sh --- scripts/_common.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 3e67c31..9cd55c6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,12 +1,8 @@ #!/bin/bash PKG_DEPENDENCIES="sqlite3 libldap2-dev libsasl2-dev python3-dev imagemagick python3-lxml libjpeg-dev" -#PKG_DEPENDENCIES="sqlite3 python3-pip imagemagick" DOSSIER_MEDIA=/home/yunohost.multimedia -LOG_FILE=/var/log/$app/$app.log -ACCESS_LOG_FILE=/var/log/$app/$app-access.log - #================================================= # EXPERIMENTAL HELPERS # TO BE DELETED WHEN RELEASED From 2875012a5f25fa8bed7c535c1479a8b02fb9d740 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Tue, 5 Jan 2021 22:58:06 +0100 Subject: [PATCH 12/36] clean remove script --- scripts/remove | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index 33e2e6b..d3c1e5a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= - +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -20,7 +20,6 @@ port=$(ynh_app_setting_get $app port) final_path=$(ynh_app_setting_get $app final_path) calibre_dir=$(ynh_app_setting_get $app calibre_dir) -source _common.sh #================================================= # REMOVE SERVICE FROM ADMIN PANEL From adda84094db605a3559333ed20e4e924a2629176 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 9 Jan 2021 15:00:41 +0100 Subject: [PATCH 13/36] Restore _common.sh var and set some comments --- scripts/_common.sh | 3 +++ scripts/change_url | 3 +++ scripts/install | 7 ++++++- scripts/restore | 5 ++++- scripts/upgrade | 4 ++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 9cd55c6..d717f42 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,6 +3,9 @@ PKG_DEPENDENCIES="sqlite3 libldap2-dev libsasl2-dev python3-dev imagemagick python3-lxml libjpeg-dev" DOSSIER_MEDIA=/home/yunohost.multimedia +#These var are used in init_calibre_db_settings conf file +LOG_FILE=/var/log/$app/$app.log +ACCESS_LOG_FILE=/var/log/$app/$app-access.log #================================================= # EXPERIMENTAL HELPERS # TO BE DELETED WHEN RELEASED diff --git a/scripts/change_url b/scripts/change_url index cbed4c2..44657d9 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -26,6 +26,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get $app final_path) port=$(ynh_app_setting_get $app port) + +#Source common.sh required to be after var initialization as some variables are updated in it that are then used in the script +#when initializing the conf file of the app source _common.sh #================================================= diff --git a/scripts/install b/scripts/install index b807e14..cc3d20f 100755 --- a/scripts/install +++ b/scripts/install @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -source _common.sh + source /usr/share/yunohost/helpers #================================================= @@ -23,6 +23,11 @@ language=$YNH_APP_ARG_LANGUAGE upload=$YNH_APP_ARG_UPLOAD public_library=$YNH_APP_ARG_PUBLIC_LIBRARY +#Source common.sh required to be after var initialization as some variables are updated in it that are then used in the script +#when initializing the conf file of the app +source _common.sh + + #if app is public, we assume library is public if [ $is_public -eq 1 ]; then public_library=1 diff --git a/scripts/restore b/scripts/restore index 8bd3aea..bcb735f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,6 @@ # IMPORT GENERIC HELPERS #================================================= -source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= @@ -30,6 +29,10 @@ calibre_dir=$(ynh_app_setting_get $app calibre_dir) is_public=$(ynh_app_setting_get $app is_public) port=$(ynh_app_setting_get $app port) +#Source common.sh required to be after var initialization as some variables are updated in it that are then used in the script +#when initializing the conf file of the app +source ../settings/scripts/_common.sh + #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 44a58c5..f5450dc 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,6 +27,10 @@ is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) language=$(ynh_app_setting_get $app language) +#Source common.sh required to be after var initialization as some variables are updated in it that are then used in the script +#when initializing the conf file of the app +source _common.sh + #Get settings from database in case it has been changed in the app and save it in settings so that it can be used back afterward calibre_dir=$(sqlite3 $final_path/app.db "SELECT config_calibre_dir FROM settings WHERE ID=1") calibre_dir=${calibre_dir%/} From 67441379b422fc4100cd81ff5a56e1f698967de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 9 Jan 2021 16:16:26 +0100 Subject: [PATCH 14/36] Set badge to SVG --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6713c25..e774620 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Calibre-web for YunoHost [![Integration level](https://dash.yunohost.org/integration/calibreweb.svg)](https://dash.yunohost.org/appci/app/calibreweb) ![](https://ci-apps.yunohost.org/ci/badges/calibreweb.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/calibreweb.maintain.svg) -[![Install calibreweb with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=calibreweb) +[![Install calibreweb with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=calibreweb) > *This package allow you to install calibreweb quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* From 3083e97a2e1af4e9eaff042bbf3b26c67fc55ced Mon Sep 17 00:00:00 2001 From: Krakinou Date: Wed, 27 Jan 2021 22:27:27 +0100 Subject: [PATCH 15/36] Init 0.9.6.10 --- README.md | 3 +- check_process | 22 ++------- conf/app.src | 4 +- manifest.json | 4 +- pull_request_template.md | 18 +++++++ scripts/change_url | 2 +- scripts/install | 6 +-- scripts/restore | 4 +- scripts/upgrade | 4 +- sources/patches/app-admin.html.patch | 12 ++--- sources/patches/app-main.js.patch | 12 ----- .../patches/app-optional-requirements.patch | 34 ------------- .../app-optional-requirements.txt.patch | 30 ++++++++++++ sources/patches/app-web.py.patch | 48 +++---------------- 14 files changed, 79 insertions(+), 124 deletions(-) create mode 100644 pull_request_template.md delete mode 100644 sources/patches/app-main.js.patch delete mode 100644 sources/patches/app-optional-requirements.patch create mode 100644 sources/patches/app-optional-requirements.txt.patch diff --git a/README.md b/README.md index 6713c25..3b57e4c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d Alternatively, you may use [COPS](https://github.com/YunoHost-Apps/cops_ynh) which also allows access to your Calibre Library, but in read-only mode. -**Shipped version:** The shipped version is 0.6.9, but as the numbering changed in the calibre-web app, it is numbered as 0.96.9 in yunohost. +**Shipped version:** The shipped version is 0.6.10 - Florence, but as the numbering changed in the calibre-web app, it is numbered as 0.96.10 in yunohost. Users will be synchronized with authorized Yunohost users (having the calibreweb.main authorization group) automatically. In case of issue you may force the sync in the app itself. @@ -91,6 +91,7 @@ sudo yunohost app upgrade calibreweb -u https://github.com/Yunohost-Apps/calibre - [ ] Add cronjob to reload database (for nextcloud integration) - [X] OPDS activation - [ ] Add config-panel option to trigger do_not_backup_data +- [ ] Add config-panel to manage max upload size - [ ] Add action to restart the server - [ ] Add action to synchronize users - [ ] Add action to deactivate LDAP et retrieve admin password diff --git a/check_process b/check_process index e662171..ce2bb9b 100644 --- a/check_process +++ b/check_process @@ -16,28 +16,14 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9 +#Last version + upgrade=1 from_commit=69b86b123ddb3b13e25f39df32bc17a872d67e5e +#v0.6.6 +# upgrade=1 from_commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9 backup_restore=1 multi_instance=1 port_already_use=1 (8083) change_url=1 -#;; Failed upgrade -#Run to trigger an error during upgrade to check backup_restore -# ; pre-install -# touch /tmp/upgrade_error -# ; Manifest -# domain="domain.tld" (DOMAIN) -# path="/calibre" (PATH) -# calibre_path="/home/yunohost.app/calibreweb" -# admin="john" (USER) -# language="en" -# is_public=0 (PUBLIC|public=1|private=0) -# upload=1 -# password="a very long password" -# ; Checks -# setup_sub_dir=1 -# setup_root=1 -# upgrade=1 from_commit=3b9c5041e4fa73cb965368379f2b83d076c65341 ;;; Options Email=nicolas@aubonalbanais.ovh Notification=none diff --git a/conf/app.src b/conf/app.src index fbc1b41..1b2b20a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.9/calibre-web-0.6.9.zip -SOURCE_SUM=e1e393e6f08f68d7aa11baf7a2f1d19b6e0ea83dadc52391470b7d1e6a3155b4 +SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.10/calibre-web-0.6.10.zip +SOURCE_SUM=ae19c1161c10e874be292e37412f367a62cbbba2d2806a35768bcc773152c788 SOURCE_FORMAT=zip \ No newline at end of file diff --git a/manifest.json b/manifest.json index 7d1b69d..79f795b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Browsing, reading and downloading eBooks using a Calibre database", "fr": "Explorer, lire et télécharger des eBooks à partir d'une base de données Calibre" }, - "version": "0.96.9~ynh5", + "version": "0.96.10~ynh1", "url": "https://github.com/janeczku/calibre-web", "license": "GPL-3.0-only", "maintainer": { @@ -14,7 +14,7 @@ "email": "misterl56@hotmail.com" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.0.0" }, "multi_instance": true, "services": [ diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..7d0417e --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,18 @@ +## Problem +- *Description of why you made this PR* + +## Solution +- *And how do you fix that problem* + +## PR Status +- [ ] Code finished. +- [ ] Tested with Package_check. +- [ ] Fix or enhancement tested. +- [ ] Upgrade from last version tested. +- [ ] Can be reviewed and tested. + +## Package_check results +--- +*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* + +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/calibreweb_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/calibreweb_ynh%20PR-NUM-%20(USERNAME)/) diff --git a/scripts/change_url b/scripts/change_url index 44657d9..082ff29 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -123,7 +123,7 @@ fi #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 30 +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" -t 30 #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index cc3d20f..0cd23a0 100755 --- a/scripts/install +++ b/scripts/install @@ -176,7 +176,7 @@ ynh_script_progression --message="Setting up database and settings..." --weight= #we need to start and stop the service so that initial app.db file is created and that we can set default data #If port 8083 is already in use (ex for second instance), then service start will fail, which is expected : so we do not want #to set $port on the line match. "server on" will be displayed in case the port is already in use and should be ok to spot the fact that the database is initialized. -ynh_systemd_action --service_name=$app --action="start" --line_match="server on " --log_path="$final_path/calibre-web.log" -t 30 +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" --log_path="$final_path/calibre-web.log" -t 30 #sleep required on low spec like raspberryPi sleep 2s #remove unwanted calibre-web.log @@ -216,7 +216,7 @@ then ynh_permission_update --permission "main" --add visitors fi if [ $public_library -eq 0 ]; then - yunohost app addaccess $app -u $admin + ynh_permission_update --permission "main" --add $admin fi #================================================= @@ -224,7 +224,7 @@ fi #================================================= ynh_script_progression --message="Reload nginx and start $app..." --weight=5 ynh_systemd_action --service_name=nginx --action=reload -ynh_systemd_action --service_name=$app --action="start" --line_match="server on :$port" -t 30 +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" -t 30 #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index bcb735f..d88612c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -109,7 +109,7 @@ systemctl enable $app.service --quiet # INTEGRATE SERVICE IN YUNOHOST #================================================= -yunohost service add $app --description "Browse eBook in the web" --log "/var/log/$app/$app.log" +yunohost service add $app --description="Browse eBook in the web" --log="/var/log/$app/$app.log" #================================================= # RESTORE THE LOGROTATE CONFIGURATION @@ -173,7 +173,7 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 30 +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" -t 30 #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index f5450dc..3989ca1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -180,7 +180,7 @@ ynh_backup_if_checksum_is_different "$final_path/app.db" if [ "$current_upstream_app_version" == '0.6.6' ]; then ynh_systemd_action --service_name=$app --action="start" --line_match="server on " --log_path="$final_path/calibre-web.log" -t 30 else - ynh_systemd_action --service_name=$app --action="start" --line_match="server on :$port" -t 30 + ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" -t 30 fi #sleep required on low spec like raspberryPi sleep 2s @@ -257,7 +257,7 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action="start" -l "server on :$port" -t 30 +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" -t 30 #================================================= # END OF SCRIPT diff --git a/sources/patches/app-admin.html.patch b/sources/patches/app-admin.html.patch index 4a8f42b..4a82736 100644 --- a/sources/patches/app-admin.html.patch +++ b/sources/patches/app-admin.html.patch @@ -1,11 +1,11 @@ ---- a/cps/templates/admin.html 2020-04-18 11:48:34.000000000 +0200 -+++ b/cps/templates/admin.html 2020-04-18 18:21:39.272422475 +0200 -@@ -149,8 +149,6 @@ +--- a/cps/templates/admin.html 2021-01-18 22:29:30.797813487 +0100 ++++ b/cps/templates/admin.html 2021-01-18 22:30:02.369665368 +0100 +@@ -169,8 +169,6 @@ - + --
{{_('Check for Update')}}
-- +-
{{_('Check for Update')}}
+- diff --git a/sources/patches/app-main.js.patch b/sources/patches/app-main.js.patch deleted file mode 100644 index 909cd60..0000000 --- a/sources/patches/app-main.js.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/cps/static/js/main.js 2020-04-18 11:48:34.000000000 +0200 -+++ b/cps/static/js/main.js 2020-04-18 17:39:49.405631791 +0200 -@@ -308,7 +308,8 @@ - $.ajax({ - method:"get", - dataType: "json", -- url: path + "/../../import_ldap_users", -+ url: window.location.pathname + "/../../import_ldap_users", -+// url: path + "/../../import_ldap_users", - success: function success(data) { - $("#spinner2").hide(); - ResultText = data.text; diff --git a/sources/patches/app-optional-requirements.patch b/sources/patches/app-optional-requirements.patch deleted file mode 100644 index b2b1aad..0000000 --- a/sources/patches/app-optional-requirements.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- a/optional-requirements.txt 2020-09-27 07:15:03.000000000 +0200 -+++ b/optional-requirements.txt 2020-10-04 19:03:58.367531339 +0200 -@@ -1,17 +1,3 @@ --# GDrive Integration --google-api-python-client==1.7.11,<1.8.0 --gevent>=1.2.1,<20.6.0 --greenlet>=0.4.12,<0.5.0 --httplib2>=0.9.2,<0.18.0 --oauth2client>=4.0.0,<4.1.4 --uritemplate>=3.0.0,<3.1.0 --pyasn1-modules>=0.0.8,<0.3.0 --pyasn1>=0.1.9,<0.5.0 --PyDrive>=1.3.1,<1.4.0 --PyYAML>=3.12 --rsa==3.4.2,<4.1.0 --six>=1.10.0,<1.15.0 -- - # goodreads - goodreads>=0.3.2,<0.4.0 - python-Levenshtein>=0.12.0,<0.13.0 -@@ -20,12 +6,8 @@ - python-ldap>=3.0.0,<3.3.0 - Flask-SimpleLDAP>=1.4.0,<1.5.0 - --#oauth --Flask-Dance>=1.4.0,<3.1.0 --SQLAlchemy-Utils>=0.33.5,<0.37.0 -- - # extracting metadata --lxml>=3.8.0,<4.6.0 -+#lxml>=3.8.0,<4.6.0 - Pillow>=4.0.0,<7.2.0 - rarfile>=2.7 - diff --git a/sources/patches/app-optional-requirements.txt.patch b/sources/patches/app-optional-requirements.txt.patch new file mode 100644 index 0000000..328bf98 --- /dev/null +++ b/sources/patches/app-optional-requirements.txt.patch @@ -0,0 +1,30 @@ +--- ./source/optional-requirements.txt.ori 2021-01-18 22:32:21.629010296 +0100 ++++ ./source/optional-requirements.txt.new 2021-01-18 23:43:53.721141321 +0100 +@@ -1,16 +1,6 @@ + # GDrive Integration +-google-api-python-client>=1.7.11,<1.8.0 + gevent>=1.2.1,<20.6.0 + greenlet>=0.4.12,<0.4.17 +-httplib2>=0.9.2,<0.18.0 +-oauth2client>=4.0.0,<4.1.4 +-uritemplate>=3.0.0,<3.1.0 +-pyasn1-modules>=0.0.8,<0.3.0 +-pyasn1>=0.1.9,<0.5.0 +-PyDrive2>=1.3.1,<1.8.0 +-PyYAML>=3.12 +-rsa>=3.4.2,<4.1.0 +-six>=1.10.0,<1.15.0 + + # goodreads + goodreads>=0.3.2,<0.4.0 +@@ -20,10 +10,6 @@ + python-ldap>=3.0.0,<3.3.0 + Flask-SimpleLDAP>=1.4.0,<1.5.0 + +-#oauth +-Flask-Dance>=1.4.0,<3.1.0 +-SQLAlchemy-Utils>=0.33.5,<0.37.0 +- + # extracting metadata + lxml>=3.8.0,<4.6.0 + rarfile>=2.7 diff --git a/sources/patches/app-web.py.patch b/sources/patches/app-web.py.patch index 6860156..63ce2ba 100644 --- a/sources/patches/app-web.py.patch +++ b/sources/patches/app-web.py.patch @@ -1,52 +1,18 @@ ---- a/cps/web.py 2020-05-05 20:28:10.000000000 +0200 -+++ b/cps/web.py 2020-05-07 08:52:47.151920968 +0200 -@@ -294,7 +294,10 @@ - if not config.db_configured and request.endpoint not in ( - 'admin.basic_configuration', 'login') and '/static/' not in request.path: - return redirect(url_for('admin.basic_configuration')) -- -+#Début Modif Yunohost 1/4 - Create LDAP user at login -+ if config.config_login_type == constants.LOGIN_LDAP and services.ldap: -+ import_ldap_users() -+#Fin Modif Yunohost 1/4 - - @app.route('/import_ldap_users') - def import_ldap_users(): -@@ -326,7 +329,10 @@ - log.warning("Could Not Parse LDAP User: %s", user) - continue - if ub.session.query(ub.User).filter(ub.User.nickname == user.lower()).first(): -- log.warning("LDAP User: %s Already in Database", user) -+# Début Modif Yunohost 2/4 - deactivate warning for existing LDAP user (clog the log) -+# log.warning("LDAP User: %s Already in Database", user) -+ log.debug("LDAP User: %s Already in Database", user) -+#Fin Modif Yunohost 2/4 - continue - user_data = services.ldap.get_object_details(user=user, - group=None, -@@ -1274,6 +1280,10 @@ - if not config.db_configured: - log.debug(u"Redirect to initial configuration") - return redirect(url_for('admin.basic_configuration')) -+#Début Modif Yunohost 3/4 - Create LDAP user at Login -+ if config.config_login_type == constants.LOGIN_LDAP and services.ldap: -+ import_ldap_users() -+#Fin Modif Yunohost 3/4 - if current_user is not None and current_user.is_authenticated: - return redirect(url_for('web.index')) - if config.config_login_type == constants.LOGIN_LDAP and not services.ldap: -@@ -1348,7 +1358,13 @@ +--- a/cps/web.py 2021-01-17 16:28:28.000000000 +0100 ++++ b/cps/web.py 2021-01-18 22:43:37.597311098 +0100 +@@ -1394,7 +1394,14 @@ if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3): logout_oauth_user() log.debug(u"User logged out") - return redirect(url_for('web.login')) -+#Début Modif Yunohost 4/4 - Redirect to Yunohost at exit ++#Début Modif Yunohost 1/1 - Redirect to Yunohost at exit +# return redirect(url_for('web.login')) + if config.config_login_type == constants.LOGIN_LDAP and services.ldap: + return redirect(request.host_url) + else: + return redirect(url_for('web.login')) -+#Fin Modif Yunohost 4/4 ++#Fin Modif Yunohost 1/1 ++ + - @web.route('/remote/login') From 4680f4eb9566a58fa58ba8f14c4bb41af1a801fb Mon Sep 17 00:00:00 2001 From: Krakinou Date: Tue, 2 Feb 2021 20:47:05 +0100 Subject: [PATCH 16/36] Upgdate Nginx buffer size --- conf/nginx.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 51f712c..73b2aa6 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,6 +4,11 @@ location __PATH__ { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + #Proxy buffering is required for Kobo sync on large library + proxy_busy_buffers_size 512k; + proxy_buffers 4 512k; + proxy_buffer_size 256k; + proxy_pass http://localhost:__PORT__; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; From b95d815d36bc37b959e0d1f9fbd7561b6d2d592b Mon Sep 17 00:00:00 2001 From: RBXII3 <22587474+psharma04@users.noreply.github.com> Date: Wed, 3 Feb 2021 09:48:07 +1100 Subject: [PATCH 17/36] Remove upload size from README Limitations Yunohost install used the Tornado server which limits the upload size of a single file to 200Mo. 0.6.10 has moved to Gevent, which removes this limitation. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c817c86..a429963 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ chmod o+rw path/to/library * Do not use a Nextcloud folder. It's all right if the folder is an external storage in Nextcloud but not if it's an internal one : Changing the data in the library will cause trouble with the sync * "Magic link feature is not yet available * Change to library made outside calibreweb are not automatically updated in calibreweb. It is required to disconnect and reconnect to see the changes : Do not open a database both in calibre & calibreweb! -* Yunohost install use the Tornado server which limits the upload size of a single file to 200Mo. + ## Links From a519f629efa4d63de457158c0b1ffd0e38c8e306 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Wed, 3 Feb 2021 21:18:42 +0100 Subject: [PATCH 18/36] Remove 200Mo Limit from nginx config --- conf/nginx.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 73b2aa6..7981d6a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,4 @@ location __PATH__ { - client_max_body_size 200M; # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; From 16baeffe6571fe5d3ccdbb4ff094e45918ee50f5 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 20 Feb 2021 19:51:44 +0100 Subject: [PATCH 19/36] Imagemagick Policy --- .gitignore | 3 ++- scripts/install | 7 +++++++ scripts/remove | 5 +++++ scripts/restore | 7 +++++++ scripts/upgrade | 6 ++++++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e8d0a97..8a5784c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ -*.sw[op] \ No newline at end of file +*.sw[op] +/check_process diff --git a/scripts/install b/scripts/install index 0cd23a0..133e47a 100755 --- a/scripts/install +++ b/scripts/install @@ -191,6 +191,13 @@ eval sqlite3 $final_path/app.db "$conf" conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WHERE ID=1\"" eval sqlite3 $final_path/app.db "$conf" +#Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files +ynh_replace_string --match_string="" \ + --replace_string="" \ + --target_file="/etc/ImageMagick-6/policy.xml" + + + #================================================= # STORE THE CHECKSUM OF THE CONFIG FILE #================================================= diff --git a/scripts/remove b/scripts/remove index d3c1e5a..388fde0 100755 --- a/scripts/remove +++ b/scripts/remove @@ -87,6 +87,11 @@ then yunohost firewall disallow TCP $port 2>&1 fi +#Restore Imagick policy +ynh_replace_string --match_string="" \ + --replace_string="" \ + --target_file="/etc/ImageMagick-6/policy.xml" + # Remove the log files ynh_script_progression --message="Removing log file..." --weight=1 ynh_secure_remove "/var/log/$app/" diff --git a/scripts/restore b/scripts/restore index d88612c..1940d75 100755 --- a/scripts/restore +++ b/scripts/restore @@ -146,6 +146,13 @@ else chown $app:$app $calibre_dir/* fi fi + +#Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files +ynh_replace_string --match_string="" \ + --replace_string="" \ + --target_file="/etc/ImageMagick-6/policy.xml" + + # Remove the option backup_core_only if it's in the settings.yml file ynh_app_setting_delete $app backup_core_only diff --git a/scripts/upgrade b/scripts/upgrade index 3989ca1..de73656 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -191,9 +191,15 @@ ynh_systemd_action --service_name=$app --action="stop" conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\"" eval sqlite3 $final_path/app.db "$conf" +#Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files +ynh_replace_string --match_string="" \ + --replace_string="" \ + --target_file="/etc/ImageMagick-6/policy.xml" + # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum "$final_path/app.db" + #================================================= # SETUP LOGROTATE #================================================= From 864a5143805880217e98d49f9406c96c2ba4a35c Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 20 Feb 2021 21:01:30 +0100 Subject: [PATCH 20/36] check imagemagick before removing --- scripts/remove | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index 388fde0..e03a266 100755 --- a/scripts/remove +++ b/scripts/remove @@ -88,9 +88,11 @@ then fi #Restore Imagick policy -ynh_replace_string --match_string="" \ - --replace_string="" \ - --target_file="/etc/ImageMagick-6/policy.xml" +if [ -z /etc/ImageMagick-6/policy.xml ]; then + ynh_replace_string --match_string="" \ + --replace_string="" \ + --target_file="/etc/ImageMagick-6/policy.xml" +fi # Remove the log files ynh_script_progression --message="Removing log file..." --weight=1 From 94284affda109dc89379829308646114361afd9f Mon Sep 17 00:00:00 2001 From: Krakinou Date: Thu, 1 Apr 2021 23:19:25 +0200 Subject: [PATCH 21/36] Correct patch path --- sources/patches/app-optional-requirements.txt.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/patches/app-optional-requirements.txt.patch b/sources/patches/app-optional-requirements.txt.patch index 328bf98..238127c 100644 --- a/sources/patches/app-optional-requirements.txt.patch +++ b/sources/patches/app-optional-requirements.txt.patch @@ -1,5 +1,5 @@ ---- ./source/optional-requirements.txt.ori 2021-01-18 22:32:21.629010296 +0100 -+++ ./source/optional-requirements.txt.new 2021-01-18 23:43:53.721141321 +0100 +--- ./source/optional-requirements.txt 2021-01-18 22:32:21.629010296 +0100 ++++ ./source/optional-requirements.txt 2021-01-18 23:43:53.721141321 +0100 @@ -1,16 +1,6 @@ # GDrive Integration -google-api-python-client>=1.7.11,<1.8.0 From d389d066bbfe0d319c2084c1c41a369c0a5b771f Mon Sep 17 00:00:00 2001 From: Krakinou Date: Fri, 2 Apr 2021 22:47:26 +0200 Subject: [PATCH 22/36] Correct patch path --- sources/patches/app-optional-requirements.txt.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/patches/app-optional-requirements.txt.patch b/sources/patches/app-optional-requirements.txt.patch index 238127c..980e5a4 100644 --- a/sources/patches/app-optional-requirements.txt.patch +++ b/sources/patches/app-optional-requirements.txt.patch @@ -1,5 +1,5 @@ ---- ./source/optional-requirements.txt 2021-01-18 22:32:21.629010296 +0100 -+++ ./source/optional-requirements.txt 2021-01-18 23:43:53.721141321 +0100 +--- a/optional-requirements.txt 2021-01-18 22:32:21.629010296 +0100 ++++ b/optional-requirements.txt 2021-01-18 23:43:53.721141321 +0100 @@ -1,16 +1,6 @@ # GDrive Integration -google-api-python-client>=1.7.11,<1.8.0 From cc6c451acb9ea40df862c924ed06958cd357d634 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Mon, 5 Apr 2021 19:38:29 +0200 Subject: [PATCH 23/36] Traduction --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 79f795b..4af987d 100644 --- a/manifest.json +++ b/manifest.json @@ -84,7 +84,7 @@ "optional": true, "ask": { "en": "Do you want to allow uploading of books?", - "fr": "Voulez vous autoriser l'upload de livres?" + "fr": "Voulez vous autoriser le téléversement de livres?" }, "help":{ "en":"You may change it later in the app", From 35f939bc43481414751ce55bb220cc28faa2c8b5 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Mon, 5 Apr 2021 19:39:13 +0200 Subject: [PATCH 24/36] Restore access to multimedia folders --- scripts/restore | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/scripts/restore b/scripts/restore index 1940d75..673c081 100755 --- a/scripts/restore +++ b/scripts/restore @@ -66,6 +66,7 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei # Create the dedicated user (if not existing) ynh_system_user_create --username=$app + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -81,6 +82,7 @@ ynh_restore_file --origin_path="$final_path" chown -R $app: $final_path #================================================= + # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES @@ -127,25 +129,37 @@ chown -R $app:$app /var/log/$app # RESTORE THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Restoring data directory..." --weight=2 +ynh_script_progression --message="Restoring data directory if required..." --weight=2 # The data directory will be restored only if it exists in the backup archive # So only if it was backup previously. - -if [ -d "$YNH_BACKUP_DIR/apps/$app/backup/$calibre_dir" ] -then +#if [ -d "$YNH_BACKUP_DIR/apps/$app/backup/$calibre_dir" ] && [ ! tail "$calibre_dir" | grep "yunohost.multimedia" ]; then ynh_restore_file --origin_path="$calibre_dir" --not_mandatory -else - if [ ! -e "$calibre_dir" ]; then - ynh_print_info "Create calibre library folder $calibre_dir" - mkdir -p $calibre_dir - chown -R $app:$app $calibre_dir - fi -#Check if metadata.db file exists. If not create it (empty library) - if [ ! -e "$calibre_dir"/metadata.db ]; then - cp -a ../settings/conf/metadata.db.empty $calibre_dir/metadata.db - chown $app:$app $calibre_dir/* - fi +#fi + +#================================================= +# RESTORE THE MULTIMEDIA DIR IF NOT EXISTING +#================================================= +ynh_script_progression --message="Restoring the multimedia directory..." --weight=5 +ynh_multimedia_build_main_dir +ynh_multimedia_addaccess $app + +#================================================= +# INITIALIZE DATA IF NOT EXISTING +#================================================= + +if [ ! -e "$calibre_dir" ]; then + ynh_print_info "Create calibre library folder $calibre_dir" + mkdir -p $calibre_dir + chown -R $app:$app $calibre_dir fi +#Check if metadata.db file exists. If not create it (empty library) +if [ ! -e "$calibre_dir"/metadata.db ]; then + cp -a ../settings/conf/metadata.db.empty $calibre_dir/metadata.db + chown $app:$app $calibre_dir/* +fi + + + #Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files ynh_replace_string --match_string="" \ From 7fe8862e809694c2f9a60ff1fc32ed003da1c36d Mon Sep 17 00:00:00 2001 From: Krakinou Date: Mon, 5 Apr 2021 19:45:01 +0200 Subject: [PATCH 25/36] Aesthetic changes --- scripts/restore | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/restore b/scripts/restore index 673c081..f07958c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -66,23 +66,18 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei # Create the dedicated user (if not existing) ynh_system_user_create --username=$app - #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=1 - ynh_restore_file --origin_path="$final_path" #================================================= # RESTORE USER RIGHTS #================================================= - -# Restore permissions on app files chown -R $app: $final_path #================================================= - # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES @@ -158,9 +153,9 @@ if [ ! -e "$calibre_dir"/metadata.db ]; then chown $app:$app $calibre_dir/* fi - - - +#=================================================== +# SPECIFIC SETUP +#=================================================== #Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files ynh_replace_string --match_string="" \ --replace_string="" \ From 45eedf0b88fcea3becbe7e9239a692d10a9c9ac2 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Tue, 6 Apr 2021 20:19:52 +0200 Subject: [PATCH 26/36] Correct package_check warning --- manifest.json | 16 ---------------- scripts/install | 1 + scripts/restore | 1 + 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/manifest.json b/manifest.json index 4af987d..0c470d6 100644 --- a/manifest.json +++ b/manifest.json @@ -25,38 +25,22 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Calibre-web", - "fr": "Choisissez un nom de domaine pour Calibre-web" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Calibre-web", - "fr": "Choisissez un chemin pour Calibre-web" - }, "example": "/calibre", "default": "/calibre" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l’administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "help":{ "en":"No will set the library in /home/yunohost.multimedia/admin/eBook, except if you set the library as public", "fr":"Non parametrera la bibliothèque pour /home/yunohost.multimedia/admin/eBook sauf si la bibliothèque est également publique" diff --git a/scripts/install b/scripts/install index 133e47a..e059794 100755 --- a/scripts/install +++ b/scripts/install @@ -121,6 +121,7 @@ ynh_add_nginx_config ynh_system_user_create $app chown -R $app: $final_path +chmod 740 $final_path #================================================= # SETUP SYSTEMD diff --git a/scripts/restore b/scripts/restore index f07958c..2e14305 100755 --- a/scripts/restore +++ b/scripts/restore @@ -76,6 +76,7 @@ ynh_restore_file --origin_path="$final_path" # RESTORE USER RIGHTS #================================================= chown -R $app: $final_path +chmod 740 $final_path #================================================= # SPECIFIC RESTORATION From b282dd5c4d2186d14b1605edacdd6a64717bf35a Mon Sep 17 00:00:00 2001 From: Krakinou Date: Tue, 6 Apr 2021 22:51:01 +0200 Subject: [PATCH 27/36] Version 0.9.6.11 --- README.md | 4 ++-- conf/app.src | 4 ++-- manifest.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a429963..9b54f76 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d Alternatively, you may use [COPS](https://github.com/YunoHost-Apps/cops_ynh) which also allows access to your Calibre Library, but in read-only mode. -**Shipped version:** The shipped version is 0.6.10 - Florence, but as the numbering changed in the calibre-web app, it is numbered as 0.96.10 in yunohost. +**Shipped version:** The shipped version is 0.6.11 - Jasmin, but as the numbering changed in the calibre-web app, it is numbered as 0.96.11 in yunohost. Users will be synchronized with authorized Yunohost users (having the calibreweb.main authorization group) automatically. In case of issue you may force the sync in the app itself. @@ -49,7 +49,7 @@ By default, removing the app will **never** delete the library. ## Known Limitations -* Authorization access to library to be done manually after install if Calibre library was already existing, for example : +* Authorization access to library to be done manually after install if Calibre library was already existing (except in yunohost.multimedia directory), for example : ``` chown -R calibreweb: path/to/library or diff --git a/conf/app.src b/conf/app.src index 1b2b20a..ba13370 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.10/calibre-web-0.6.10.zip -SOURCE_SUM=ae19c1161c10e874be292e37412f367a62cbbba2d2806a35768bcc773152c788 +SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.11/calibre-web-0.6.11.zip +SOURCE_SUM=15ca2be701b843181df376a0f958ea20458ef0d5726dc089cee8e8005e450ab5 SOURCE_FORMAT=zip \ No newline at end of file diff --git a/manifest.json b/manifest.json index 0c470d6..8485bee 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Browsing, reading and downloading eBooks using a Calibre database", "fr": "Explorer, lire et télécharger des eBooks à partir d'une base de données Calibre" }, - "version": "0.96.10~ynh1", + "version": "0.96.11~ynh1", "url": "https://github.com/janeczku/calibre-web", "license": "GPL-3.0-only", "maintainer": { @@ -14,7 +14,7 @@ "email": "misterl56@hotmail.com" }, "requirements": { - "yunohost": ">= 4.0.0" + "yunohost": ">= 4.1.3" }, "multi_instance": true, "services": [ From f697ca31df5c8ee0380f56a03417b95e8a7f304d Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 29 May 2021 13:49:49 +0200 Subject: [PATCH 28/36] version 0.6.12 --- README.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9b54f76..98508f3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d Alternatively, you may use [COPS](https://github.com/YunoHost-Apps/cops_ynh) which also allows access to your Calibre Library, but in read-only mode. -**Shipped version:** The shipped version is 0.6.11 - Jasmin, but as the numbering changed in the calibre-web app, it is numbered as 0.96.11 in yunohost. +**Shipped version:** The shipped version is 0.6.12 - Pilar, but as the numbering changed in the calibre-web app, it is numbered as 0.96.12 in yunohost. Users will be synchronized with authorized Yunohost users (having the calibreweb.main authorization group) automatically. In case of issue you may force the sync in the app itself. diff --git a/conf/app.src b/conf/app.src index ba13370..60c3d04 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.11/calibre-web-0.6.11.zip -SOURCE_SUM=15ca2be701b843181df376a0f958ea20458ef0d5726dc089cee8e8005e450ab5 +SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.12/calibre-web-0.6.12.zip +SOURCE_SUM=c9caeacb5e1ec0ca8e8b6f042193f7b41a403e3e84eaf6b7f238f93041b94a6a SOURCE_FORMAT=zip \ No newline at end of file diff --git a/manifest.json b/manifest.json index 8485bee..8438559 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Browsing, reading and downloading eBooks using a Calibre database", "fr": "Explorer, lire et télécharger des eBooks à partir d'une base de données Calibre" }, - "version": "0.96.11~ynh1", + "version": "0.96.12~ynh1", "url": "https://github.com/janeczku/calibre-web", "license": "GPL-3.0-only", "maintainer": { From 4afe5c3d1f7264ac02d21b10d51ee79c523bed5d Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 29 May 2021 13:50:07 +0200 Subject: [PATCH 29/36] client max body size = 500M --- conf/nginx.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 7981d6a..e0329b4 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,6 +3,10 @@ location __PATH__ { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + #Client max body size to allow upload of ebook. + #big number as audiobook may be quite big + client_max_body_size 500M; + #Proxy buffering is required for Kobo sync on large library proxy_busy_buffers_size 512k; proxy_buffers 4 512k; From a81ed6678258efd735e126b56f340181b003aaf3 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 29 May 2021 13:55:10 +0200 Subject: [PATCH 30/36] Remove ynh_multimedia --- manifest.json | 2 +- scripts/_common.sh | 88 ---------------------------------------------- 2 files changed, 1 insertion(+), 89 deletions(-) diff --git a/manifest.json b/manifest.json index 8438559..b857e17 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "misterl56@hotmail.com" }, "requirements": { - "yunohost": ">= 4.1.3" + "yunohost": ">= 4.2.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index d717f42..03f39a0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,92 +6,4 @@ DOSSIER_MEDIA=/home/yunohost.multimedia #These var are used in init_calibre_db_settings conf file LOG_FILE=/var/log/$app/$app.log ACCESS_LOG_FILE=/var/log/$app/$app-access.log -#================================================= -# EXPERIMENTAL HELPERS -# TO BE DELETED WHEN RELEASED -#================================================= - -#================================================= -#YNH_MULTIMEDIA -#================================================= - - -# Need also the helper https://github.com/YunoHost-Apps/Experimental_helpers/blob/master/ynh_handle_getopts_args/ynh_handle_getopts_args - -# Install or update the main directory yunohost.multimedia -# -# usage: ynh_multimedia_build_main_dir -ynh_multimedia_build_main_dir () { - local ynh_media_release="v1.2" - local checksum="806a827ba1902d6911095602a9221181" - - # Download yunohost.multimedia scripts - wget -nv https://github.com/Yunohost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1 - - # Check the control sum - echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ - || ynh_die "Corrupt source" - - # Check if the package acl is installed. Or install it. - ynh_package_is_installed 'acl' \ - || ynh_package_install acl - - # Extract - mkdir yunohost.multimedia-master - tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1 - ./yunohost.multimedia-master/script/ynh_media_build.sh -} - -# Add a directory in yunohost.multimedia -# This "directory" will be a symbolic link to a existing directory. -# -# usage: ynh_multimedia_addfolder "Source directory" "Destination directory" -# -# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias. -# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia" -ynh_multimedia_addfolder () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= ) - local source_dir - local dest_dir - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - ./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir" -} - -# Move a directory in yunohost.multimedia, and replace by a symbolic link -# -# usage: ynh_multimedia_movefolder "Source directory" "Destination directory" -# -# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias. -# It will be moved to "Destination directory" -# A symbolic link will replace it. -# | arg: -d, --dest_dir= - Destination directory - The new name and place of the directory, relative to "/home/yunohost.multimedia" -ynh_multimedia_movefolder () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= ) - local source_dir - local dest_dir - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - ./yunohost.multimedia-master/script/ynh_media_addfolder.sh --inv --source="$source_dir" --dest="$dest_dir" -} - -# Allow an user to have an write authorisation in multimedia directories -# -# usage: ynh_multimedia_addaccess user_name -# -# | arg: -u, --user_name= - The name of the user which gain this access. -ynh_multimedia_addaccess () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [u]=user_name=) - local user_name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - groupadd -f multimedia - usermod -a -G multimedia $user_name -} From 437ddb2a470769a45f6150228fd842f1f306308a Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 6 Jun 2021 13:18:20 +0200 Subject: [PATCH 31/36] Patch to source 0.6.12 --- ...-admin.html.patch => app-admin.hmtl.patch} | 12 ++-- sources/patches/app-config_sql.py.patch.src | 56 +++++++++++++++++++ sources/patches/app-constants.py.patch.src | 26 +++++++++ .../app-optional-requirements.txt.patch | 40 +++++++------ sources/patches/app-ub.py.patch.src | 20 +++++++ sources/patches/app-web.py.patch | 18 ------ 6 files changed, 133 insertions(+), 39 deletions(-) rename sources/patches/{app-admin.html.patch => app-admin.hmtl.patch} (50%) create mode 100644 sources/patches/app-config_sql.py.patch.src create mode 100644 sources/patches/app-constants.py.patch.src create mode 100644 sources/patches/app-ub.py.patch.src delete mode 100644 sources/patches/app-web.py.patch diff --git a/sources/patches/app-admin.html.patch b/sources/patches/app-admin.hmtl.patch similarity index 50% rename from sources/patches/app-admin.html.patch rename to sources/patches/app-admin.hmtl.patch index 4a82736..dd2411d 100644 --- a/sources/patches/app-admin.html.patch +++ b/sources/patches/app-admin.hmtl.patch @@ -1,11 +1,15 @@ ---- a/cps/templates/admin.html 2021-01-18 22:29:30.797813487 +0100 -+++ b/cps/templates/admin.html 2021-01-18 22:30:02.369665368 +0100 -@@ -169,8 +169,6 @@ +--- a/cps/templates/admin.html 2021-05-22 14:08:46.000000000 +0200 ++++ b/cps/templates/admin.html 2021-06-06 12:43:44.886680839 +0200 +@@ -184,11 +184,7 @@ + - +- {% if feature_support['updater'] %} +- -
{{_('Check for Update')}}
- +- {% endif %} ++ diff --git a/sources/patches/app-config_sql.py.patch.src b/sources/patches/app-config_sql.py.patch.src new file mode 100644 index 0000000..43019d4 --- /dev/null +++ b/sources/patches/app-config_sql.py.patch.src @@ -0,0 +1,56 @@ +--- a/cps/config_sql.py 2021-06-06 11:06:52.499532119 +0200 ++++ b/cps/config_sql.py 2021-06-06 12:18:29.420244329 +0200 +@@ -63,7 +63,7 @@ + mail_server_type = Column(SmallInteger, default=0) + mail_gmail_token = Column(JSON, default={}) + +- config_calibre_dir = Column(String) ++ config_calibre_dir = Column(String, default='__CALIBRE_DIR__') + config_port = Column(Integer, default=constants.DEFAULT_PORT) + config_external_port = Column(Integer, default=constants.DEFAULT_PORT) + config_certfile = Column(String) +@@ -79,11 +79,11 @@ + config_theme = Column(Integer, default=0) + + config_log_level = Column(SmallInteger, default=logger.DEFAULT_LOG_LEVEL) +- config_logfile = Column(String) +- config_access_log = Column(SmallInteger, default=0) +- config_access_logfile = Column(String) ++ config_logfile = Column(String, default='__LOG_FILE__') ++ config_access_log = Column(SmallInteger, default=1) ++ config_access_logfile = Column(String, default='__ACCESS_LOG_FILE__') + +- config_uploading = Column(SmallInteger, default=0) ++ config_uploading = Column(SmallInteger, default=__UPLOAD__) + config_anonbrowse = Column(SmallInteger, default=0) + config_public_reg = Column(SmallInteger, default=0) + config_remote_login = Column(Boolean, default=False) +@@ -107,11 +107,11 @@ + config_goodreads_api_key = Column(String) + config_goodreads_api_secret = Column(String) + config_register_email = Column(Boolean, default=False) +- config_login_type = Column(Integer, default=0) ++ config_login_type = Column(Integer, default=1) + + config_kobo_proxy = Column(Boolean, default=False) + +- config_ldap_provider_url = Column(String, default='example.org') ++ config_ldap_provider_url = Column(String, default='localhost') + config_ldap_port = Column(SmallInteger, default=389) + config_ldap_authentication = Column(SmallInteger, default=constants.LDAP_AUTH_SIMPLE) + config_ldap_serv_username = Column(String, default='cn=admin,dc=example,dc=org') +@@ -120,11 +120,11 @@ + config_ldap_cacert_path = Column(String, default="") + config_ldap_cert_path = Column(String, default="") + config_ldap_key_path = Column(String, default="") +- config_ldap_dn = Column(String, default='dc=example,dc=org') +- config_ldap_user_object = Column(String, default='uid=%s') ++ config_ldap_dn = Column(String, default='dc=yunohost,dc=org') ++ config_ldap_user_object = Column(String, default='(&(objectClass=posixAccount)(permission=cn=calibreweb.main,ou=permission,dc=yunohost,dc=org)(uid=%s))') + config_ldap_member_user_object = Column(String, default='') # + config_ldap_openldap = Column(Boolean, default=True) +- config_ldap_group_object_filter = Column(String, default='(&(objectclass=posixGroup)(cn=%s))') ++ config_ldap_group_object_filter = Column(String, default='(&(objectClass=posixGroup)(permission=cn=%s.main,ou=permission,dc=yunohost,dc=org))') + config_ldap_group_members_field = Column(String, default='memberUid') + config_ldap_group_name = Column(String, default='calibreweb') + diff --git a/sources/patches/app-constants.py.patch.src b/sources/patches/app-constants.py.patch.src new file mode 100644 index 0000000..103b635 --- /dev/null +++ b/sources/patches/app-constants.py.patch.src @@ -0,0 +1,26 @@ +--- ./ori/constants.py 2021-05-22 14:08:46.000000000 +0200 ++++ ./new/constants.py 2021-06-06 11:02:36.060353942 +0200 +@@ -25,7 +25,7 @@ + HOME_CONFIG = os.path.isfile(os.path.join(os.path.dirname(os.path.abspath(__file__)), '.HOMEDIR')) + + #In executables updater is not available, so variable is set to False there +-UPDATER_AVAILABLE = True ++UPDATER_AVAILABLE = False + + # Base dir is parent of current file, necessary if called from different folder + if sys.version_info < (3, 0): +@@ -127,12 +127,12 @@ + DEFAULT_MAIL_SERVER = "mail.example.org" + + DEFAULT_PASSWORD = "admin123" # nosec +-DEFAULT_PORT = 8083 ++DEFAULT_PORT = __PORT__ + env_CALIBRE_PORT = os.environ.get("CALIBRE_PORT", DEFAULT_PORT) + try: + DEFAULT_PORT = int(env_CALIBRE_PORT) + except ValueError: +- print('Environment variable CALIBRE_PORT has invalid value (%s), faling back to default (8083)' % env_CALIBRE_PORT) ++ print('Environment variable CALIBRE_PORT has invalid value (%s), faling back to default (__PORT__)' % env_CALIBRE_PORT) + del env_CALIBRE_PORT + + diff --git a/sources/patches/app-optional-requirements.txt.patch b/sources/patches/app-optional-requirements.txt.patch index 980e5a4..6be1da6 100644 --- a/sources/patches/app-optional-requirements.txt.patch +++ b/sources/patches/app-optional-requirements.txt.patch @@ -1,30 +1,36 @@ ---- a/optional-requirements.txt 2021-01-18 22:32:21.629010296 +0100 -+++ b/optional-requirements.txt 2021-01-18 23:43:53.721141321 +0100 -@@ -1,16 +1,6 @@ - # GDrive Integration --google-api-python-client>=1.7.11,<1.8.0 - gevent>=1.2.1,<20.6.0 - greenlet>=0.4.12,<0.4.17 --httplib2>=0.9.2,<0.18.0 +--- a/optional-requirements.txt 2021-05-22 14:08:46.000000000 +0200 ++++ b/optional-requirements.txt 2021-06-06 10:47:53.012009447 +0200 +@@ -1,22 +1,3 @@ +-# GDrive Integration +-gevent>20.6.0,<21.2.0 +-greenlet>=0.4.17,<1.2.0 +-httplib2>=0.9.2,<0.20.0 -oauth2client>=4.0.0,<4.1.4 -uritemplate>=3.0.0,<3.1.0 -pyasn1-modules>=0.0.8,<0.3.0 -pyasn1>=0.1.9,<0.5.0 --PyDrive2>=1.3.1,<1.8.0 +-PyDrive2>=1.3.1,<1.9.0 -PyYAML>=3.12 --rsa>=3.4.2,<4.1.0 --six>=1.10.0,<1.15.0 - +-rsa>=3.4.2,<4.8.0 +-six>=1.10.0,<1.17.0 +- +-# Gdrive and Gmail integration +-google-api-python-client>=1.7.11,<2.1.0 +- +-# Gmail +-google-auth-oauthlib>=0.4.3,<0.5.0 +- # goodreads goodreads>=0.3.2,<0.4.0 -@@ -20,10 +10,6 @@ - python-ldap>=3.0.0,<3.3.0 + python-Levenshtein>=0.12.0,<0.13.0 +@@ -25,10 +6,6 @@ + python-ldap>=3.0.0,<3.4.0 Flask-SimpleLDAP>=1.4.0,<1.5.0 -#oauth --Flask-Dance>=1.4.0,<3.1.0 --SQLAlchemy-Utils>=0.33.5,<0.37.0 +-Flask-Dance>=2.0.0,<5.1.0 +-SQLAlchemy-Utils>=0.33.5,<0.38.0 - # extracting metadata - lxml>=3.8.0,<4.6.0 + lxml>=3.8.0,<4.7.0 rarfile>=2.7 diff --git a/sources/patches/app-ub.py.patch.src b/sources/patches/app-ub.py.patch.src new file mode 100644 index 0000000..680611c --- /dev/null +++ b/sources/patches/app-ub.py.patch.src @@ -0,0 +1,20 @@ +--- a/cps/ub.py 2021-06-06 10:55:46.704487817 +0200 ++++ b/cps/ub.py 2021-06-06 12:32:23.867151407 +0200 +@@ -179,7 +179,7 @@ + kindle_mail = Column(String(120), default="") + shelf = relationship('Shelf', backref='user', lazy='dynamic', order_by='Shelf.name') + downloads = relationship('Downloads', backref='user', lazy='dynamic') +- locale = Column(String(2), default="en") ++ locale = Column(String(2), default="__LANGUAGE__") + sidebar_view = Column(Integer, default=1) + default_language = Column(String(3), default="all") + denied_tags = Column(String, default="") +@@ -678,7 +678,7 @@ + # Generate User admin with admin123 password, and access to everything + def create_admin_user(session): + user = User() +- user.name = "admin" ++ user.name = "__ADMIN__" + user.role = constants.ADMIN_USER_ROLES + user.sidebar_view = constants.ADMIN_USER_SIDEBAR + diff --git a/sources/patches/app-web.py.patch b/sources/patches/app-web.py.patch deleted file mode 100644 index 63ce2ba..0000000 --- a/sources/patches/app-web.py.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/cps/web.py 2021-01-17 16:28:28.000000000 +0100 -+++ b/cps/web.py 2021-01-18 22:43:37.597311098 +0100 -@@ -1394,7 +1394,14 @@ - if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3): - logout_oauth_user() - log.debug(u"User logged out") -- return redirect(url_for('web.login')) -+#Début Modif Yunohost 1/1 - Redirect to Yunohost at exit -+# return redirect(url_for('web.login')) -+ if config.config_login_type == constants.LOGIN_LDAP and services.ldap: -+ return redirect(request.host_url) -+ else: -+ return redirect(url_for('web.login')) -+#Fin Modif Yunohost 1/1 -+ - - - From 71e93da3a08c905ddfaa78c743c89509486850be Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 6 Jun 2021 13:18:44 +0200 Subject: [PATCH 32/36] 0.6.12 --- check_process | 2 +- conf/init_calibre_db_user | 3 -- scripts/_common.sh | 4 +-- scripts/install | 40 ++++++++++++---------- scripts/upgrade | 70 ++++++++++++++++++--------------------- 5 files changed, 58 insertions(+), 61 deletions(-) delete mode 100644 conf/init_calibre_db_user diff --git a/check_process b/check_process index ce2bb9b..f8bad33 100644 --- a/check_process +++ b/check_process @@ -17,7 +17,7 @@ setup_public=1 upgrade=1 #Last version - upgrade=1 from_commit=69b86b123ddb3b13e25f39df32bc17a872d67e5e + upgrade=1 from_commit=daf9f864b4f4adde4130c9d000ecc87f5d44ca42 #v0.6.6 # upgrade=1 from_commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9 backup_restore=1 diff --git a/conf/init_calibre_db_user b/conf/init_calibre_db_user deleted file mode 100644 index 81e736d..0000000 --- a/conf/init_calibre_db_user +++ /dev/null @@ -1,3 +0,0 @@ -nickname=\'$admin\', -locale=\'$language\', -mature_content=0 \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index 03f39a0..b3f726e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,6 @@ PKG_DEPENDENCIES="sqlite3 libldap2-dev libsasl2-dev python3-dev imagemagick pyth DOSSIER_MEDIA=/home/yunohost.multimedia #These var are used in init_calibre_db_settings conf file -LOG_FILE=/var/log/$app/$app.log -ACCESS_LOG_FILE=/var/log/$app/$app-access.log +log_file=/var/log/$app/$app.log +access_log_file=/var/log/$app/$app-access.log diff --git a/scripts/install b/scripts/install index e059794..791633a 100755 --- a/scripts/install +++ b/scripts/install @@ -27,12 +27,19 @@ public_library=$YNH_APP_ARG_PUBLIC_LIBRARY #when initializing the conf file of the app source _common.sh - #if app is public, we assume library is public if [ $is_public -eq 1 ]; then public_library=1 fi +if [ $is_public -eq 1 ]; then #app is public, library is public + calibre_dir=$DOSSIER_MEDIA/share/eBook +elif [ $is_public -eq 0 ] && [ $public_library -eq 1 ]; then #app is private, library is public + calibre_dir=$DOSSIER_MEDIA/share/eBook +else #app is private, library is private + calibre_dir=$DOSSIER_MEDIA/$admin/eBook +fi + #================================================= # MANAGE SCRIPT FAILURE #================================================= @@ -79,6 +86,12 @@ ynh_app_setting_set $app port $port #================================================= ynh_script_progression --message="Downloading sources to $final_path..." --weight=10 ynh_app_setting_set $app final_path $final_path + +#Set settings constant initializer of the app +ynh_add_config --template="../sources/patches/app-config_sql.py.patch.src" --destination="../sources/patches/app-config_sql.py.patch" +ynh_add_config --template="../sources/patches/app-ub.py.patch.src" --destination="../sources/patches/app-ub.py.patch" +ynh_add_config --template="../sources/patches/app-constants.py.patch.src" --destination="../sources/patches/app-constants.py.patch" + # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" @@ -143,13 +156,6 @@ ynh_script_progression --message="Creating files and directory..." --weight=5 ynh_multimedia_build_main_dir ynh_multimedia_addaccess $app -if [ $is_public -eq 1 ]; then #app is public, library is public - calibre_dir=$DOSSIER_MEDIA/share/eBook -elif [ $is_public -eq 0 ] && [ $public_library -eq 1 ]; then #app is private, library is public - calibre_dir=$DOSSIER_MEDIA/share/eBook -else #app is private, library is private - calibre_dir=$DOSSIER_MEDIA/$admin/eBook -fi #Check if metadata.db file exists. If not create it (empty library) if [ ! -e "$calibre_dir"/metadata.db ]; then @@ -177,20 +183,20 @@ ynh_script_progression --message="Setting up database and settings..." --weight= #we need to start and stop the service so that initial app.db file is created and that we can set default data #If port 8083 is already in use (ex for second instance), then service start will fail, which is expected : so we do not want #to set $port on the line match. "server on" will be displayed in case the port is already in use and should be ok to spot the fact that the database is initialized. -ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" --log_path="$final_path/calibre-web.log" -t 30 +#ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" --log_path="$final_path/calibre-web.log" -t 30 #sleep required on low spec like raspberryPi -sleep 2s +#sleep 2s #remove unwanted calibre-web.log -ynh_secure_remove --file="$final_path/calibre-web.log" -ynh_systemd_action --service_name=$app --action="stop" +#ynh_secure_remove --file="$final_path/calibre-web.log" +#ynh_systemd_action --service_name=$app --action="stop" #set database settings as per conf file -conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\"" -eval sqlite3 $final_path/app.db "$conf" +#conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\"" +#eval sqlite3 $final_path/app.db "$conf" -conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WHERE ID=1\"" -eval sqlite3 $final_path/app.db "$conf" +#conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WHERE ID=1\"" +#eval sqlite3 $final_path/app.db "$conf" #Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files ynh_replace_string --match_string="" \ @@ -204,7 +210,7 @@ ynh_replace_string --match_string="&1 -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -90,12 +82,23 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="stop" #================================================= -# STANDARD UPGRADE STEPS -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE +# ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_script_progression --message="Downward Compatibility checks..." --weight=1 +#Close unwanted open port in firewall +if yunohost firewall list | grep -q "\- $port$" +then + ynh_script_progression --message="Closing port $port as it shouldn't be open..." + yunohost firewall disallow TCP $port 2>&1 +fi + +# If language was set delete it +if [ ! -z "$language" ]; then + ynh_app_setting_delete --app=$app --key=language +#fi #binaries version is 0.6.0, we need to go throught upgrade to 0.6.6 so that app.db is correctly updated, otherwise database is corrupted +#set database settings as per conf file : restart server so that app.db is regenerated, then add new ldap & log settings if version_gt "0.6.6" "$current_upstream_app_version" && [ "$current_upstream_package_version" == "0.6.0" ] && [ "$upgrade_type" == "UPGRADE_APP" ]; then ynh_script_progression --message="Upgrading from $current_upstream_app_version to 0.6.6..." --weight=50 ynh_setup_source --dest_dir="$final_path" --source_id="app066" @@ -106,13 +109,28 @@ if version_gt "0.6.6" "$current_upstream_app_version" && [ "$current_upstream_pa #sleep required on low spec like raspberryPi sleep 2s ynh_systemd_action --service_name=$app --action="stop" + conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\"" + eval sqlite3 $final_path/app.db "$conf" current_upstream_app_version="0.6.6" - #remove unwanted entry in settings db fi +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= + + + if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files from $current_upstream_app_version to $new_upstream_package_version..." --weight=10 + + #Set settings constant initializer of the app + ynh_add_config --template="../sources/patches/app-config_sql.py.patch.src" --destination="../sources/patches/app-config_sql.py.patch" + ynh_add_config --template="../sources/patches/app-ub.py.patch.src" --destination="../sources/patches/app-ub.py.patch" + ynh_add_config --template="../sources/patches/app-constants.py.patch.src" --destination="../sources/patches/app-constants.py.patch" + # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" fi @@ -168,37 +186,13 @@ ynh_script_progression --message="Create Multimedia dir..." --weight=1 ynh_multimedia_build_main_dir ynh_multimedia_addaccess $app -#================================================= -#Update database structure -#================================================= -ynh_script_progression --message="Update database..." --weight=1 -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -ynh_backup_if_checksum_is_different "$final_path/app.db" - -#set database settings as per conf file : restart server so that app.db is regenerated, then add new ldap & log settings -if [ "$current_upstream_app_version" == '0.6.6' ]; then - ynh_systemd_action --service_name=$app --action="start" --line_match="server on " --log_path="$final_path/calibre-web.log" -t 30 -else - ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" -t 30 -fi -#sleep required on low spec like raspberryPi -sleep 2s -#remove unwanted calibre-web.log -ynh_secure_remove --file="$final_path/calibre-web.log" -ynh_systemd_action --service_name=$app --action="stop" - -conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\"" -eval sqlite3 $final_path/app.db "$conf" - #Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files +ynh_script_progression --message="Update Imagick policy..." --weight=1 + ynh_replace_string --match_string="" \ --replace_string="" \ --target_file="/etc/ImageMagick-6/policy.xml" -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/app.db" - #================================================= # SETUP LOGROTATE From ccb00a6ee4fd7c4a7a9a4782e802bfe41a2430f7 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 6 Jun 2021 13:27:20 +0200 Subject: [PATCH 33/36] typo 0.6.12 --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index cdf1537..816f5ee 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -95,7 +95,7 @@ fi # If language was set delete it if [ ! -z "$language" ]; then ynh_app_setting_delete --app=$app --key=language -#fi +fi #binaries version is 0.6.0, we need to go throught upgrade to 0.6.6 so that app.db is correctly updated, otherwise database is corrupted #set database settings as per conf file : restart server so that app.db is regenerated, then add new ldap & log settings @@ -263,4 +263,4 @@ ynh_systemd_action --service_name=$app --action="start" --line_match="Starting G # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last \ No newline at end of file From b6b793194756088de5e97df2cabb02fd562b422c Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 6 Jun 2021 13:31:29 +0200 Subject: [PATCH 34/36] 0.6.12 --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 791633a..473947a 100755 --- a/scripts/install +++ b/scripts/install @@ -99,7 +99,7 @@ ynh_setup_source "$final_path" # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing package dependencies..." --weight=15 +ynh_script_progression --message="Installing package dependencies..." --weight=30 ynh_install_app_dependencies $PKG_DEPENDENCIES #use latest version of pip as per documentation in https://github.com/pypa/get-pip From b41b95a3381967eb7c0afcb07b1cad0545f11d57 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sun, 6 Jun 2021 17:09:39 +0200 Subject: [PATCH 35/36] Path typo --- sources/patches/app-constants.py.patch.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/patches/app-constants.py.patch.src b/sources/patches/app-constants.py.patch.src index 103b635..852e911 100644 --- a/sources/patches/app-constants.py.patch.src +++ b/sources/patches/app-constants.py.patch.src @@ -1,5 +1,5 @@ ---- ./ori/constants.py 2021-05-22 14:08:46.000000000 +0200 -+++ ./new/constants.py 2021-06-06 11:02:36.060353942 +0200 +--- a/cps/constants.py 2021-05-22 14:08:46.000000000 +0200 ++++ b/cps/constants.py 2021-06-06 11:02:36.060353942 +0200 @@ -25,7 +25,7 @@ HOME_CONFIG = os.path.isfile(os.path.join(os.path.dirname(os.path.abspath(__file__)), '.HOMEDIR')) From 6e83fd1ddc538b79a7567d57b1c36c155b5ab8ca Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 7 Jun 2021 17:14:31 +0200 Subject: [PATCH 36/36] Add Kobo Sync info in Readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 98508f3..31b251a 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ chmod o+rw path/to/library * Do not use a Nextcloud folder. It's all right if the folder is an external storage in Nextcloud but not if it's an internal one : Changing the data in the library will cause trouble with the sync * "Magic link feature is not yet available * Change to library made outside calibreweb are not automatically updated in calibreweb. It is required to disconnect and reconnect to see the changes : Do not open a database both in calibre & calibreweb! - +* Kobo Sync doesn’t work when Calibre is installed on a subdomain. This issue is caused by nginx. However, it works great when installed on a path e.g. `https://domain.tld/calibreweb` ## Links