1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/calibreweb_ynh.git synced 2024-09-03 18:16:20 +02:00

Merge pull request #59 from YunoHost-Apps/testing

Testing
This commit is contained in:
Krakinou 2021-02-02 23:41:24 +01:00 committed by GitHub
commit 1587d9ca98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 130 additions and 201 deletions

View file

@ -1,7 +1,7 @@
# Calibre-web for YunoHost # 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)
[![Install calibreweb with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=calibreweb) [![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.svg)](https://install-app.yunohost.org/?app=calibreweb)
> *This package allow you to install calibreweb quickly and simply on a YunoHost server. > *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.* If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
@ -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. 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. 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.
@ -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). Please do your pull request to the [testing branch](https://github.com/Yunohost-Apps/calibreweb_ynh/tree/testing).
@ -92,6 +91,7 @@ sudo yunohost app upgrade calibreweb -u https://github.com/Yunohost-Apps/calibre
- [ ] Add cronjob to reload database (for nextcloud integration) - [ ] Add cronjob to reload database (for nextcloud integration)
- [X] OPDS activation - [X] OPDS activation
- [ ] Add config-panel option to trigger do_not_backup_data - [ ] 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 restart the server
- [ ] Add action to synchronize users - [ ] Add action to synchronize users
- [ ] Add action to deactivate LDAP et retrieve admin password - [ ] Add action to deactivate LDAP et retrieve admin password

View file

@ -16,34 +16,19 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=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 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=1 (8083) port_already_use=1 (8083)
change_url=1 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
;;; Levels
Level 5=auto
;;; Options ;;; Options
Email=nicolas@aubonalbanais.ovh Email=nicolas@aubonalbanais.ovh
Notification=none Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9 ; commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9
name=Version 0.96.0~ynh4 name=Version 0.96.0~ynh4
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1&

View file

@ -1,3 +1,3 @@
SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.9/calibre-web-0.6.9.zip SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.10/calibre-web-0.6.10.zip
SOURCE_SUM=e1e393e6f08f68d7aa11baf7a2f1d19b6e0ea83dadc52391470b7d1e6a3155b4 SOURCE_SUM=ae19c1161c10e874be292e37412f367a62cbbba2d2806a35768bcc773152c788
SOURCE_FORMAT=zip SOURCE_FORMAT=zip

View file

@ -4,6 +4,11 @@ location __PATH__ {
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; 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_pass http://localhost:__PORT__;
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;

View file

@ -6,15 +6,15 @@
"en": "Browsing, reading and downloading eBooks using a Calibre database", "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" "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", "url": "https://github.com/janeczku/calibre-web",
"license": "free", "license": "GPL-3.0-only",
"maintainer": { "maintainer": {
"name": "Krakinou", "name": "Krakinou",
"email": "misterl56@hotmail.com" "email": "misterl56@hotmail.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.7.1" "yunohost": ">= 4.0.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

18
pull_request_template.md Normal file
View file

@ -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)/)

View file

@ -1,12 +1,11 @@
#!/bin/bash #!/bin/bash
PKG_DEPENDENCIES="sqlite3 libldap2-dev libsasl2-dev python3-dev imagemagick python3-lxml libjpeg-dev" 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 DOSSIER_MEDIA=/home/yunohost.multimedia
#These var are used in init_calibre_db_settings conf file
LOG_FILE=/var/log/$app/$app.log LOG_FILE=/var/log/$app/$app.log
ACCESS_LOG_FILE=/var/log/$app/$app-access.log ACCESS_LOG_FILE=/var/log/$app/$app-access.log
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
# TO BE DELETED WHEN RELEASED # TO BE DELETED WHEN RELEASED
@ -27,7 +26,7 @@ ynh_multimedia_build_main_dir () {
local checksum="806a827ba1902d6911095602a9221181" local checksum="806a827ba1902d6911095602a9221181"
# Download yunohost.multimedia scripts # 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 # Check the control sum
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \ echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -19,7 +19,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1 ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path) 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") 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 #Save it in settings so that it can be used back afterward
calibre_dir=${calibre_dir%/} calibre_dir=${calibre_dir%/}
ynh_app_setting_set $app calibre_dir $calibre_dir ynh_app_setting_set $app calibre_dir $calibre_dir
source ../settings/scripts/_common.sh
#================================================= #=================================================
# STANDARD BACKUP STEPS # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
# STOP SYSTEMD SERVICE ynh_print_info --message="Declaring files to be backed up..."
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
#Deactivate as per package linter
#ynh_systemd_action --service_name=$app --action="stop"
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # 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 #This will backup the app.db file at the same time
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
@ -58,44 +49,30 @@ ynh_backup --src_path="$final_path"
# BACKUP THE NGINX CONFIGURATION # 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" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Backing up logrotate configuration..." --weight=1
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # 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 # 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 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -26,6 +26,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
port=$(ynh_app_setting_get $app port) 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 source _common.sh
#================================================= #=================================================
@ -120,7 +123,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2 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 # RELOAD NGINX

View file

@ -6,6 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -22,13 +23,16 @@ language=$YNH_APP_ARG_LANGUAGE
upload=$YNH_APP_ARG_UPLOAD upload=$YNH_APP_ARG_UPLOAD
public_library=$YNH_APP_ARG_PUBLIC_LIBRARY 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 app is public, we assume library is public
if [ $is_public -eq 1 ]; then if [ $is_public -eq 1 ]; then
public_library=1 public_library=1
fi fi
source _common.sh
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
@ -36,7 +40,6 @@ source _common.sh
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -45,9 +48,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" 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 # Check web path availability
ynh_webpath_available $domain $path_url ynh_webpath_available $domain $path_url
# Register (book) web path # Register (book) web path
@ -63,7 +63,6 @@ ynh_app_setting_set $app path $path_url
ynh_app_setting_set $app admin $admin ynh_app_setting_set $app admin $admin
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set $app is_public $is_public
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -177,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 #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 #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. #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 required on low spec like raspberryPi
sleep 2s sleep 2s
#remove unwanted calibre-web.log #remove unwanted calibre-web.log
@ -192,16 +191,6 @@ eval sqlite3 $final_path/app.db "$conf"
conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WHERE ID=1\"" conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WHERE ID=1\""
eval sqlite3 $final_path/app.db "$conf" 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 # STORE THE CHECKSUM OF THE CONFIG FILE
#================================================= #=================================================
@ -210,10 +199,10 @@ eval sqlite3 $final_path/app.db "$conf"
ynh_store_file_checksum "${final_path}/app.db" 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 # SETUP SSOWAT
@ -227,16 +216,15 @@ then
ynh_permission_update --permission "main" --add visitors ynh_permission_update --permission "main" --add visitors
fi fi
if [ $public_library -eq 0 ]; then if [ $public_library -eq 0 ]; then
yunohost app addaccess $app -u $admin ynh_permission_update --permission "main" --add $admin
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reload nginx and start $app..." --weight=5 ynh_script_progression --message="Reload nginx and start $app..." --weight=5
ynh_systemd_action --service_name=nginx --action=reload 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 # END OF SCRIPT

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source _common.sh
source /usr/share/yunohost/helpers 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) final_path=$(ynh_app_setting_get $app final_path)
calibre_dir=$(ynh_app_setting_get $app calibre_dir) calibre_dir=$(ynh_app_setting_get $app calibre_dir)
source _common.sh
#================================================= #=================================================
# REMOVE SERVICE FROM ADMIN PANEL # REMOVE SERVICE FROM ADMIN PANEL

View file

@ -19,6 +19,7 @@ ynh_abort_if_errors
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." --weight=1 ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
@ -27,6 +28,9 @@ final_path=$(ynh_app_setting_get $app final_path)
calibre_dir=$(ynh_app_setting_get $app calibre_dir) calibre_dir=$(ynh_app_setting_get $app calibre_dir)
is_public=$(ynh_app_setting_get $app is_public) is_public=$(ynh_app_setting_get $app is_public)
port=$(ynh_app_setting_get $app port) 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 source ../settings/scripts/_common.sh
#================================================= #=================================================
@ -99,13 +103,13 @@ curl https://bootstrap.pypa.io/get-pip.py | python3
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service systemctl enable $app.service --quiet
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # 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 # RESTORE THE LOGROTATE CONFIGURATION
@ -169,7 +173,7 @@ ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2 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 # END OF SCRIPT

View file

@ -10,6 +10,7 @@ version_gt() {
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -26,6 +27,10 @@ is_public=$(ynh_app_setting_get $app is_public)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
language=$(ynh_app_setting_get $app language) 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 #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=$(sqlite3 $final_path/app.db "SELECT config_calibre_dir FROM settings WHERE ID=1")
calibre_dir=${calibre_dir%/} calibre_dir=${calibre_dir%/}
@ -34,8 +39,6 @@ ynh_app_setting_set $app calibre_dir $calibre_dir
upload=$(sqlite3 $final_path/app.db "SELECT config_uploading FROM settings WHERE ID=1") upload=$(sqlite3 $final_path/app.db "SELECT config_uploading FROM settings WHERE ID=1")
ynh_app_setting_set $app upload $upload ynh_app_setting_set $app upload $upload
source _common.sh
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
@ -86,13 +89,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="stop" 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 # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -184,7 +180,7 @@ ynh_backup_if_checksum_is_different "$final_path/app.db"
if [ "$current_upstream_app_version" == '0.6.6' ]; then 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 ynh_systemd_action --service_name=$app --action="start" --line_match="server on " --log_path="$final_path/calibre-web.log" -t 30
else 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 fi
#sleep required on low spec like raspberryPi #sleep required on low spec like raspberryPi
sleep 2s sleep 2s
@ -224,6 +220,12 @@ ynh_add_systemd_config
# Set permissions on app files # Set permissions on app files
chown -R $app: $final_path 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 # SETUP SSOWAT
#================================================= #=================================================
@ -255,11 +257,10 @@ ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2 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 # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression --message="Upgrade of $app completed" --last

View file

@ -1,11 +1,11 @@
--- a/cps/templates/admin.html 2020-04-18 11:48:34.000000000 +0200 --- a/cps/templates/admin.html 2021-01-18 22:29:30.797813487 +0100
+++ b/cps/templates/admin.html 2020-04-18 18:21:39.272422475 +0200 +++ b/cps/templates/admin.html 2021-01-18 22:30:02.369665368 +0100
@@ -149,8 +149,6 @@ @@ -169,8 +169,6 @@
</table> </table>
<div class="hidden" id="update_error"> <span>{{update_error}}</span></div> <div class="hidden" id="update_error"> <span>{{update_error}}</span></div>
- <div class="btn btn-default" id="check_for_update">{{_('Check for Update')}}</div> - <div class="btn btn-primary" id="check_for_update">{{_('Check for Update')}}</div>
- <div class="btn btn-default hidden" id="perform_update" data-toggle="modal" data-target="#StatusDialog">{{_('Perform Update')}}</div> - <div class="btn btn-primary hidden" id="perform_update" data-toggle="modal" data-target="#StatusDialog">{{_('Perform Update')}}</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -1,52 +1,18 @@
--- a/cps/web.py 2020-05-05 20:28:10.000000000 +0200 --- a/cps/web.py 2021-01-17 16:28:28.000000000 +0100
+++ b/cps/web.py 2020-05-07 08:52:47.151920968 +0200 +++ b/cps/web.py 2021-01-18 22:43:37.597311098 +0100
@@ -294,7 +294,10 @@ @@ -1394,7 +1394,14 @@
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 @@
if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3): if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3):
logout_oauth_user() logout_oauth_user()
log.debug(u"User logged out") log.debug(u"User logged out")
- return redirect(url_for('web.login')) - 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')) +# return redirect(url_for('web.login'))
+ if config.config_login_type == constants.LOGIN_LDAP and services.ldap: + if config.config_login_type == constants.LOGIN_LDAP and services.ldap:
+ return redirect(request.host_url) + return redirect(request.host_url)
+ else: + else:
+ return redirect(url_for('web.login')) + return redirect(url_for('web.login'))
+#Fin Modif Yunohost 4/4 +#Fin Modif Yunohost 1/1
+
@web.route('/remote/login')