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

Readd SSO

This commit is contained in:
Krakinou 2022-03-13 22:48:26 +01:00
parent 107753e5ee
commit 256c022481
8 changed files with 61 additions and 4 deletions

View file

@ -19,7 +19,7 @@ You may deactivate backup of the library with
yunohost app setting calibreweb do_not_backup_data -v 1 yunohost app setting calibreweb do_not_backup_data -v 1
``` ```
* By default, removing the app will **never** delete the library. * By default, removing the app will **never** delete the library. However, you can use the ```purge``` option from the command line to delete the library along wiht the app.
* Authorization access to library to be done manually after install if Calibre library was already existing (except in yunohost.multimedia directory), 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 :
@ -44,6 +44,7 @@ Version number in Yunohost is different from the upstream Calibre-web app : vers
* "Magic link feature is not yet available * "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! * 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 doesnt work when Calibreweb 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` * Kobo Sync doesnt work when Calibreweb 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`
* For security reasons, the automagic identification of the user already logged in Yunohost can only happen if the app is not made public. If the app is made public, you will have to reauthenticate.
### Todo ### Todo
- [ ] Update mail settings with yunohost settings - [ ] Update mail settings with yunohost settings

View file

@ -19,7 +19,7 @@ Vous pouvez le désactiver avec cette commande:
yunohost app setting calibreweb do_not_backup_data -v 1 yunohost app setting calibreweb do_not_backup_data -v 1
``` ```
* Par défaut, supprimer l'application **ne supprimera jamais** la bibliothèque. * Par défaut, supprimer l'application **ne supprimera jamais** la bibliothèque. Cependant, vous pouvez utilisez l'option ````purge```` depuis la ligne de commande qui supprimera la bibliothèque avec l'application.
* Si la bibliothèque existait avant l'installation de Calibreweb, les accès à celle-ci doivent être géré manuellement (sauf pour celle dans yunohost.multimedia directory). Par exemple : * Si la bibliothèque existait avant l'installation de Calibreweb, les accès à celle-ci doivent être géré manuellement (sauf pour celle dans yunohost.multimedia directory). Par exemple :
@ -44,6 +44,7 @@ La numérotation est modifiée dans yunohost par rapport à Calibre-web: la vers
* La fonction "Magic link" n'est pas disponible * La fonction "Magic link" n'est pas disponible
* Les changements fait à la bibliothèque en dehors de Calibreweb ne sont pas automatiquement vu par Calibreweb : Il est nécessaire de se déconnecter puis reconnecter ou redémarrer le service pour que les modifications soient visibles : N'utilisez donc pas simultanément Calibre et Calibreweb sur la même bibliothèque! * Les changements fait à la bibliothèque en dehors de Calibreweb ne sont pas automatiquement vu par Calibreweb : Il est nécessaire de se déconnecter puis reconnecter ou redémarrer le service pour que les modifications soient visibles : N'utilisez donc pas simultanément Calibre et Calibreweb sur la même bibliothèque!
* La synchronisation Kobo ne fonctionne pas quand Calibreweb est installée dans un sous-domaine. Ce problème est causé par nginx. Par contre, cela fonctionne très bien quand installé dans un répertoire, par exemple `https://domain.tld/calibreweb` * La synchronisation Kobo ne fonctionne pas quand Calibreweb est installée dans un sous-domaine. Ce problème est causé par nginx. Par contre, cela fonctionne très bien quand installé dans un répertoire, par exemple `https://domain.tld/calibreweb`
* L'identification automagique des utilisateurs déjà loggé dans yunohost ne peut se faire, pour des raisons de sécurité, que si l'application n'est pas déclarée en "public". Si l'application est public, vous devrez vous réauthentifier à chaque fois.
## Todo ## Todo
- [ ] Mise à jour des réglages mails - [ ] Mise à jour des réglages mails

15
hooks/post_app_addaccess Normal file
View file

@ -0,0 +1,15 @@
#!/bin/bash
# Source YunoHost helpers
source /usr/share/yunohost/helpers
app=$1
users=$2 # Tous les utilisateurs autorisés sur l'app. Séparés par des virgules.
if [ echo "$users" | grep visitors ]; then
if [ tail /etc/yunohost/apps/$app/conf/nginx.conf | grep "# proxy_set_header X-Remote-User" ]; then
#app is made public
ynh_replace_string "# proxy_set_header X-Remote-User" " proxy_set_header X-Remote-User" /etc/yunohost/apps/$app/conf/nginx.conf
ynh_add_nginx_config
ynh_systemd_action --service_name=nginx --action=reload
fi
fi

View file

@ -0,0 +1,15 @@
#!/bin/bash
# Source YunoHost helpers
source /usr/share/yunohost/helpers
app=$1
users=$2 # Tous les utilisateurs autorisés sur l'app. Séparés par des virgules.
if [ ! echo "$users" | grep visitors ]; then
if [ tail /etc/yunohost/apps/$app/conf/nginx.conf | grep " proxy_set_header X-Remote-User" ]; then
#app is made public
ynh_replace_string " proxy_set_header X-Remote-User" "# proxy_set_header X-Remote-User" /etc/yunohost/apps/$app/conf/nginx.conf
ynh_add_nginx_config
ynh_systemd_action --service_name=nginx --action=reload
fi
fi

View file

@ -6,7 +6,7 @@
"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.17~ynh1", "version": "0.96.17~ynh2",
"url": "https://github.com/janeczku/calibre-web", "url": "https://github.com/janeczku/calibre-web",
"upstream": { "upstream": {
"version": "0.6.17", "version": "0.6.17",

View file

@ -120,6 +120,10 @@ if [ $path_url = "/" ] ; then
ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf
fi fi
if [ $is_public -eq 1 ]; then
ynh_replace_string "# proxy_set_header X-Remote-User" " proxy_set_header X-Remote-User" ../conf/nginx.conf
fi
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config

View file

@ -126,6 +126,12 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public ynh_app_setting_delete --app=$app --key=is_public
fi fi
#Activate reverse proxy authentication
if sqlite3 $final_path/app.db "SELECT config_allow_reverse_proxy_header_login FROM settings" \
| grep -xq "0" ; then
eval sqlite3 $final_path/app.db "\"UPDATE settings SET config_allow_reverse_proxy_header_login='1' WHERE ID=1\""
eval sqlite3 $final_path/app.db "\"UPDATE settings SET config_reverse_proxy_login_header_name='X-Remote-User' WHERE ID=1\""
fi
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
@ -156,6 +162,10 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." -
if [ $path_url = "/" ] ; then if [ $path_url = "/" ] ; then
ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf
fi fi
if [ ynh_permission_has_user --permission="main" --user=visitors ]; then
ynh_replace_string "# proxy_set_header X-Remote-User" " proxy_set_header X-Remote-User" ../conf/nginx.conf
fi
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config

View file

@ -1,5 +1,5 @@
--- a/cps/config_sql.py 2022-03-06 16:10:41.000000000 +0100 --- a/cps/config_sql.py 2022-03-06 16:10:41.000000000 +0100
+++ b/cps/config_sql.py 2022-03-08 21:04:33.966228954 +0100 +++ b/cps/config_sql.py 2022-03-13 22:01:35.831261229 +0100
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
mail_server_type = Column(SmallInteger, default=0) mail_server_type = Column(SmallInteger, default=0)
mail_gmail_token = Column(JSON, default={}) mail_gmail_token = Column(JSON, default={})
@ -54,3 +54,14 @@
config_ldap_group_members_field = Column(String, default='memberUid') config_ldap_group_members_field = Column(String, default='memberUid')
config_ldap_group_name = Column(String, default='calibreweb') config_ldap_group_name = Column(String, default='calibreweb')
@@ -138,8 +138,8 @@
config_updatechannel = Column(Integer, default=constants.UPDATE_STABLE)
- config_reverse_proxy_login_header_name = Column(String)
- config_allow_reverse_proxy_header_login = Column(Boolean, default=False)
+ config_reverse_proxy_login_header_name = Column(String, default='X-Remote-User')
+ config_allow_reverse_proxy_header_login = Column(Boolean, default=True)
def __repr__(self):
return self.__class__.__name__