From 1c9edfa8e7617102be8a9ae383f01a6448405ccc Mon Sep 17 00:00:00 2001 From: Krakinou Date: Fri, 11 Nov 2022 15:08:18 +0100 Subject: [PATCH 1/8] Add kepubify by default --- conf/appkepubify.src.default | 4 +++ manifest.json | 2 +- scripts/_common.sh | 32 +++++++++++++++++++++ scripts/install | 6 ++++ scripts/remove | 8 ++++++ scripts/upgrade | 8 ++++++ sources/patches/app-config_sql.py.patch.src | 19 ++++++++++-- 7 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 conf/appkepubify.src.default diff --git a/conf/appkepubify.src.default b/conf/appkepubify.src.default new file mode 100644 index 0000000..e7d020d --- /dev/null +++ b/conf/appkepubify.src.default @@ -0,0 +1,4 @@ +SOURCE_URL=https://github.com/pgaskin/kepubify/releases/download/v4.0.4/kepubify-linux-__MACH__ +SOURCE_SUM=__SHA256__ +SOURCE_EXTRACT=false +SOURCE_FILENAME=kepubify-linux-__MACH__ \ No newline at end of file diff --git a/manifest.json b/manifest.json index 5a70273..c22b7e9 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.19~ynh1", + "version": "0.96.19~ynh2", "url": "https://github.com/janeczku/calibre-web", "upstream": { "version": "0.6.19", diff --git a/scripts/_common.sh b/scripts/_common.sh index a028de8..1b177ab 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,3 +8,35 @@ 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 + + +mach=`uname -m` + +sha256_32bit=3365a848ce06d43fca8f1999eb69c6c8e0e20a56b6b8658a8466b9726adef0f5 +sha256_64bit=37d7628d26c5c906f607f24b36f781f306075e7073a6fe7820a751bb60431fc5 +sha256_arm=07f23275c4e674093443f01a591aa0980b0b87dbb0a10986d5001e9d56b0e1e7 +sha256_arm64=5a15b8f6f6a96216c69330601bca29638cfee50f7bf48712795cff88ae2d03a3 +sha256_armv6=7912901dc7b6f51e119f59cfd1f3f8ac2a5c64c42efba9d69ebf2ea8c3a7a2c9 + + + +case "$mach" in + "armv6l" ) mach="arm" + sha256=$sha256_arm + ;; + "armv7l" ) mach="arm" + sha256=$sha256_arm + ;; + "armv8l" ) mach="arm64" + sha256=$sha256_arm64 + ;; + "aarch64" ) mach="arm64" + sha256=$sha256_arm64 + ;; + "x86_64" ) mach="64bit" + sha256=$sha256_64bit + ;; + * ) mach="32bit" + sha256=$sha256_32bit + ;; +esac diff --git a/scripts/install b/scripts/install index 051c9a2..602ecc8 100755 --- a/scripts/install +++ b/scripts/install @@ -92,6 +92,10 @@ ynh_add_config --template="../sources/patches/app-constants.py.patch.src" --dest # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" +#install kepubify converter +ynh_add_config --template="../conf/appkepubify.src.default" --destination="../conf/appkepubify.src" +ynh_setup_source --dest_dir="/opt/kepubify" --source_id="appkepubify" + #================================================= # CREATE DEDICATED USER #================================================= @@ -216,6 +220,8 @@ yunohost service add $app --description="Browse eBook in the web" --log="/var/lo chown -R $app: $final_path chmod 740 $final_path +chown -R $app: /opt/kepubify +chmod 770 /opt/kepubify/kepubify-linux-$mach #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index addf0d9..b5e55ec 100755 --- a/scripts/remove +++ b/scripts/remove @@ -72,6 +72,14 @@ then ynh_secure_remove --file="$calibre_dir" fi +#================================================= +# REMOVE KEPUBIFY DIR +#================================================= + +# Remove the data directory if --purge option is used +ynh_script_progression --message="Removing kepubify directory..." --weight=1 +ynh_secure_remove --file="/opt/kepubify" + #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 39e10c4..9527924 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -126,6 +126,13 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi +#Adding kepubify converter +if [ -z $(sqlite3 $final_path/app.db "SELECT config_kepubifypath FROM settings") ]; then + ynh_add_config --template="../conf/appkepubify.src.default" --destination="../conf/appkepubify.src" + ynh_setup_source --dest_dir="/opt/kepubify" --source_id="appkepubify" + chmod 770 /opt/kepubify/kepubify-linux-$mach + eval sqlite3 $final_path/app.db "\"UPDATE settings SET config_kepubifypath='/opt/kepubify/kepubify-linux-$mach' WHERE ID=1\"" +fi #================================================= # STANDARD UPGRADE STEPS @@ -247,6 +254,7 @@ ynh_add_systemd_config # Set permissions on app files chown -R $app: $final_path +chown -R $app: /opt/kepubify #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/sources/patches/app-config_sql.py.patch.src b/sources/patches/app-config_sql.py.patch.src index 6678766..73bcd7e 100644 --- a/sources/patches/app-config_sql.py.patch.src +++ b/sources/patches/app-config_sql.py.patch.src @@ -1,5 +1,5 @@ ---- a/cps/config_sql.py 2022-08-12 13:48:46.980029500 +0200 -+++ b/cps/config_sql.py 2022-08-12 13:51:56.223434627 +0200 +--- a/cps/config_sql.py 2022-11-10 20:01:25.834187046 +0100 ++++ b/cps/config_sql.py 2022-11-09 23:48:08.351335088 +0100 @@ -62,7 +62,7 @@ mail_server_type = Column(SmallInteger, default=0) mail_gmail_token = Column(JSON, default={}) @@ -39,7 +39,7 @@ 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') -@@ -122,11 +122,11 @@ +@@ -122,15 +122,15 @@ config_ldap_cacert_path = Column(String, default="") config_ldap_cert_path = Column(String, default="") config_ldap_key_path = Column(String, default="") @@ -54,3 +54,16 @@ config_ldap_group_members_field = Column(String, default='memberUid') config_ldap_group_name = Column(String, default='calibreweb') +- config_kepubifypath = Column(String, default=None) ++ config_kepubifypath = Column(String, default='/opt/kepubify/kepubify-linux-__MACH__') + config_converterpath = Column(String, default=None) + config_calibre = Column(String) + config_rarfile_location = Column(String, default=None) +@@ -269,6 +269,7 @@ + def set_from_dictionary(self, dictionary, field, convertor=None, default=None, encode=None): + """Possibly updates a field of this object. + The new value, if present, is grabbed from the given dictionary, and optionally passed through a convertor. ++ + :returns: `True` if the field has changed value + """ + new_value = dictionary.get(field, default) From bb80e657e4e580e1b68af51c913116205f746c2c Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 11 Nov 2022 14:08:25 +0000 Subject: [PATCH 2/8] Auto-update README --- README.md | 2 -- README_fr.md | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 3a20efe..5deb4e4 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,6 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Browsing, reading and downloading eBooks using a Calibre database **Shipped version:** 0.6.19 - - ## Screenshots ![Screenshot of Calibre-web](./doc/screenshots/screenshot.png) diff --git a/README_fr.md b/README_fr.md index a58f556..20c8ea9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,9 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Explorer, lire et télécharger des eBooks à partir d'une base de données Calibre -**Version incluse :** 0.6.19 - - +**Version incluse :** 0.6.19 ## Captures d'écran ![Capture d'écran de Calibre-web](./doc/screenshots/screenshot.png) From 23d5ff9d347036c5ab1eebb4bbf2be00be3166c9 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Fri, 11 Nov 2022 17:29:29 +0100 Subject: [PATCH 3/8] Add Kobo Sync auth --- scripts/install | 3 +++ scripts/upgrade | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/scripts/install b/scripts/install index 602ecc8..0ebe056 100755 --- a/scripts/install +++ b/scripts/install @@ -238,6 +238,9 @@ if [ $public_library -eq 0 ]; then ynh_permission_update --permission "main" --add $admin fi +#Kobo sync permission +ynh_permission_create --permission="Kobo sync" --url="$domain/kobo" --allowed="visitors" + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9527924..a7143a7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -134,6 +134,13 @@ if [ -z $(sqlite3 $final_path/app.db "SELECT config_kepubifypath FROM settings") eval sqlite3 $final_path/app.db "\"UPDATE settings SET config_kepubifypath='/opt/kepubify/kepubify-linux-$mach' WHERE ID=1\"" fi +# Create the permission "kobo_sync" only if it doesn't exist. +if ! ynh_permission_exists --permission="Kobo sync" +then + # API Authorization with dedicated URL + ynh_permission_create --permission="Kobo sync" --url="$domain/kobo" --allowed="visitors" +fi + #================================================= # STANDARD UPGRADE STEPS #================================================= From 32359b5a9aac46d6d217638e626d20301c555506 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Fri, 11 Nov 2022 17:29:42 +0100 Subject: [PATCH 4/8] Update documentation --- doc/DISCLAIMER.md | 7 +++++++ doc/DISCLAIMER_fr.md | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 5d34773..e657849 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -29,6 +29,13 @@ or chmod o+rw path/to/library ``` +### Kobo Sync + +Calibre-web comes with a [synching feature with a kobo device](https://github.com/janeczku/calibre-web/wiki/Kobo-Integration). You can activate this feature from inside the app in the administration menu. You need to set port 443 as the external server port. +A dedicated permission "Kobo sync" is created by default by the app so that you don't need to expose the whole app for synching. + +[Kepubify](https://pgaskin.net/kepubify/) is also set up as the default kepub converter during installation : This means that your whole library will be converted to kepub when creating the sync token for the first time (this will not affect the existing epubs). This can take a long time : For reference, I have around 10K ebooks on my calibre library and the conversion on a raspberry Pi 4 lasted around 3-4hours. + ### OPDS For **OPDS** to work, most OPDS-readers will require the app must be set in public mode. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index c1a3c39..bf44fce 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -29,6 +29,13 @@ ou chmod o+rw chemin/vers/bibliothèque ``` +### Synchronisation Kobo + +Calibre-web possède [une fonction de synchronisation avec les liseuses Kobo](https://github.com/janeczku/calibre-web/wiki/Kobo-Integration). Vous pouvez activer cette fonctionnalité depuis le menu d'administration de l'application. Il faut paramétrer le port 443 comme port externe du serveur. +Une permission spécifique "Kobo sync" est créée lors de l'installation de l'application afin de ne pas avoir à exposer l'application entière. + +[Kepubify](https://pgaskin.net/kepubify/) est également installé en tant que convertisseur par défaut vers le format kepub : Cela signifie que l'intégralité de votre bibliothèque sera convertie en format kepub lorsque vous créerez le jeton de synchronisation pour la première fois (ceci n'affecte pas les epubs existant). Cela peut prendre un certain temps : Par exemple, j'ai environ 10K livres dans ma bibliothèque calibre, et la conversion sur un Raspberry Pi 4 a durée environ 3-4h. + ### OPDS Pour que l'**OPDS** fonctionne, la plupart des lecteurs OPDS exigent que l'application soit en accès publique. From 69eaa302a07189a4ad2e247b2af9e575517d4f2b Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 11 Nov 2022 16:29:49 +0000 Subject: [PATCH 5/8] Auto-update README --- README.md | 7 +++++++ README_fr.md | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 5deb4e4..e0909ae 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,13 @@ or chmod o+rw path/to/library ``` +### Kobo Sync + +Calibre-web comes with a [synching feature with a kobo device](https://github.com/janeczku/calibre-web/wiki/Kobo-Integration). You can activate this feature from inside the app in the administration menu. You need to set port 443 as the external server port. +A dedicated permission "Kobo sync" is created by default by the app so that you don't need to expose the whole app for synching. + +[Kepubify](https://pgaskin.net/kepubify/) is also set up as the default kepub converter during installation : This means that your whole library will be converted to kepub when creating the sync token for the first time (this will not affect the existing epubs). This can take a long time : For reference, I have around 10K ebooks on my calibre library and the conversion on a raspberry Pi 4 lasted around 3-4hours. + ### OPDS For **OPDS** to work, most OPDS-readers will require the app must be set in public mode. diff --git a/README_fr.md b/README_fr.md index 20c8ea9..c55eeab 100644 --- a/README_fr.md +++ b/README_fr.md @@ -55,6 +55,13 @@ ou chmod o+rw chemin/vers/bibliothèque ``` +### Synchronisation Kobo + +Calibre-web possède [une fonction de synchronisation avec les liseuses Kobo](https://github.com/janeczku/calibre-web/wiki/Kobo-Integration). Vous pouvez activer cette fonctionnalité depuis le menu d'administration de l'application. Il faut paramétrer le port 443 comme port externe du serveur. +Une permission spécifique "Kobo sync" est créée lors de l'installation de l'application afin de ne pas avoir à exposer l'application entière. + +[Kepubify](https://pgaskin.net/kepubify/) est également installé en tant que convertisseur par défaut vers le format kepub : Cela signifie que l'intégralité de votre bibliothèque sera convertie en format kepub lorsque vous créerez le jeton de synchronisation pour la première fois (ceci n'affecte pas les epubs existant). Cela peut prendre un certain temps : Par exemple, j'ai environ 10K livres dans ma bibliothèque calibre, et la conversion sur un Raspberry Pi 4 a durée environ 3-4h. + ### OPDS Pour que l'**OPDS** fonctionne, la plupart des lecteurs OPDS exigent que l'application soit en accès publique. From 66a425dc959471e25a56d8a578e81cf6dc91c096 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Fri, 11 Nov 2022 17:31:18 +0100 Subject: [PATCH 6/8] Update documentation --- doc/DISCLAIMER.md | 2 +- doc/DISCLAIMER_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index e657849..437f69c 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -34,7 +34,7 @@ chmod o+rw path/to/library Calibre-web comes with a [synching feature with a kobo device](https://github.com/janeczku/calibre-web/wiki/Kobo-Integration). You can activate this feature from inside the app in the administration menu. You need to set port 443 as the external server port. A dedicated permission "Kobo sync" is created by default by the app so that you don't need to expose the whole app for synching. -[Kepubify](https://pgaskin.net/kepubify/) is also set up as the default kepub converter during installation : This means that your whole library will be converted to kepub when creating the sync token for the first time (this will not affect the existing epubs). This can take a long time : For reference, I have around 10K ebooks on my calibre library and the conversion on a raspberry Pi 4 lasted around 3-4hours. +[Kepubify](https://pgaskin.net/kepubify/) is also set up as the default kepub converter during installation : This means that your whole library will be converted to kepub when creating the sync token for the first time (this will not affect the existing epubs). This can take a long time : For reference, I have around 10K ebooks on my calibre library and the conversion lasted around 3-4hours on a raspberry Pi 4. ### OPDS diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index bf44fce..b96d501 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -34,7 +34,7 @@ chmod o+rw chemin/vers/bibliothèque Calibre-web possède [une fonction de synchronisation avec les liseuses Kobo](https://github.com/janeczku/calibre-web/wiki/Kobo-Integration). Vous pouvez activer cette fonctionnalité depuis le menu d'administration de l'application. Il faut paramétrer le port 443 comme port externe du serveur. Une permission spécifique "Kobo sync" est créée lors de l'installation de l'application afin de ne pas avoir à exposer l'application entière. -[Kepubify](https://pgaskin.net/kepubify/) est également installé en tant que convertisseur par défaut vers le format kepub : Cela signifie que l'intégralité de votre bibliothèque sera convertie en format kepub lorsque vous créerez le jeton de synchronisation pour la première fois (ceci n'affecte pas les epubs existant). Cela peut prendre un certain temps : Par exemple, j'ai environ 10K livres dans ma bibliothèque calibre, et la conversion sur un Raspberry Pi 4 a durée environ 3-4h. +[Kepubify](https://pgaskin.net/kepubify/) est également installé en tant que convertisseur par défaut vers le format kepub : Cela signifie que l'intégralité de votre bibliothèque sera convertie en format kepub lorsque vous créerez le jeton de synchronisation pour la première fois (ceci n'affecte pas les epubs existant). Cela peut prendre un certain temps : Par exemple, j'ai environ 10K livres dans ma bibliothèque calibre, et la conversion a durée environ 3-4h sur un Raspberry Pi 4 . ### OPDS From 7c57b6a1c9a94f43028dd33b179fd20ed0822f99 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 11 Nov 2022 16:31:24 +0000 Subject: [PATCH 7/8] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e0909ae..13d8279 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ chmod o+rw path/to/library Calibre-web comes with a [synching feature with a kobo device](https://github.com/janeczku/calibre-web/wiki/Kobo-Integration). You can activate this feature from inside the app in the administration menu. You need to set port 443 as the external server port. A dedicated permission "Kobo sync" is created by default by the app so that you don't need to expose the whole app for synching. -[Kepubify](https://pgaskin.net/kepubify/) is also set up as the default kepub converter during installation : This means that your whole library will be converted to kepub when creating the sync token for the first time (this will not affect the existing epubs). This can take a long time : For reference, I have around 10K ebooks on my calibre library and the conversion on a raspberry Pi 4 lasted around 3-4hours. +[Kepubify](https://pgaskin.net/kepubify/) is also set up as the default kepub converter during installation : This means that your whole library will be converted to kepub when creating the sync token for the first time (this will not affect the existing epubs). This can take a long time : For reference, I have around 10K ebooks on my calibre library and the conversion lasted around 3-4hours on a raspberry Pi 4. ### OPDS diff --git a/README_fr.md b/README_fr.md index c55eeab..0a2cea0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -60,7 +60,7 @@ chmod o+rw chemin/vers/bibliothèque Calibre-web possède [une fonction de synchronisation avec les liseuses Kobo](https://github.com/janeczku/calibre-web/wiki/Kobo-Integration). Vous pouvez activer cette fonctionnalité depuis le menu d'administration de l'application. Il faut paramétrer le port 443 comme port externe du serveur. Une permission spécifique "Kobo sync" est créée lors de l'installation de l'application afin de ne pas avoir à exposer l'application entière. -[Kepubify](https://pgaskin.net/kepubify/) est également installé en tant que convertisseur par défaut vers le format kepub : Cela signifie que l'intégralité de votre bibliothèque sera convertie en format kepub lorsque vous créerez le jeton de synchronisation pour la première fois (ceci n'affecte pas les epubs existant). Cela peut prendre un certain temps : Par exemple, j'ai environ 10K livres dans ma bibliothèque calibre, et la conversion sur un Raspberry Pi 4 a durée environ 3-4h. +[Kepubify](https://pgaskin.net/kepubify/) est également installé en tant que convertisseur par défaut vers le format kepub : Cela signifie que l'intégralité de votre bibliothèque sera convertie en format kepub lorsque vous créerez le jeton de synchronisation pour la première fois (ceci n'affecte pas les epubs existant). Cela peut prendre un certain temps : Par exemple, j'ai environ 10K livres dans ma bibliothèque calibre, et la conversion a durée environ 3-4h sur un Raspberry Pi 4 . ### OPDS From 7aa3e4f8e0a6a7956f17d442b9c1e3f588bd447e Mon Sep 17 00:00:00 2001 From: Krakinou Date: Fri, 11 Nov 2022 17:43:07 +0100 Subject: [PATCH 8/8] kepubify & Kobo sync : add info in log --- scripts/install | 1 + scripts/upgrade | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 0ebe056..fb9126f 100755 --- a/scripts/install +++ b/scripts/install @@ -93,6 +93,7 @@ ynh_add_config --template="../sources/patches/app-constants.py.patch.src" --dest ynh_setup_source "$final_path" #install kepubify converter +ynh_script_progression --message="Installing kepubify..." --weight=1 ynh_add_config --template="../conf/appkepubify.src.default" --destination="../conf/appkepubify.src" ynh_setup_source --dest_dir="/opt/kepubify" --source_id="appkepubify" diff --git a/scripts/upgrade b/scripts/upgrade index a7143a7..c604e28 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -138,6 +138,7 @@ fi if ! ynh_permission_exists --permission="Kobo sync" then # API Authorization with dedicated URL + ynh_print_warn --message="This version has now a dedicated Kobo sync authorization, please review group and permission" ynh_permission_create --permission="Kobo sync" --url="$domain/kobo" --allowed="visitors" fi