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 #78 from YunoHost-Apps/0.9.6.12

0.9.6.12
This commit is contained in:
Krakinou 2021-06-06 20:07:36 +02:00 committed by GitHub
commit 33c3a91fd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 202 additions and 195 deletions

View file

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

View file

@ -17,7 +17,7 @@
setup_public=1 setup_public=1
upgrade=1 upgrade=1
#Last version #Last version
upgrade=1 from_commit=69b86b123ddb3b13e25f39df32bc17a872d67e5e upgrade=1 from_commit=daf9f864b4f4adde4130c9d000ecc87f5d44ca42
#v0.6.6 #v0.6.6
# upgrade=1 from_commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9 # upgrade=1 from_commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9
backup_restore=1 backup_restore=1

View file

@ -1,3 +1,3 @@
SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.11/calibre-web-0.6.11.zip SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.12/calibre-web-0.6.12.zip
SOURCE_SUM=15ca2be701b843181df376a0f958ea20458ef0d5726dc089cee8e8005e450ab5 SOURCE_SUM=c9caeacb5e1ec0ca8e8b6f042193f7b41a403e3e84eaf6b7f238f93041b94a6a
SOURCE_FORMAT=zip SOURCE_FORMAT=zip

View file

@ -1,3 +0,0 @@
nickname=\'$admin\',
locale=\'$language\',
mature_content=0

View file

@ -3,6 +3,10 @@ location __PATH__ {
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; 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 buffering is required for Kobo sync on large library
proxy_busy_buffers_size 512k; proxy_busy_buffers_size 512k;
proxy_buffers 4 512k; proxy_buffers 4 512k;

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.11~ynh1", "version": "0.96.12~ynh1",
"url": "https://github.com/janeczku/calibre-web", "url": "https://github.com/janeczku/calibre-web",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"maintainer": { "maintainer": {
@ -14,7 +14,7 @@
"email": "misterl56@hotmail.com" "email": "misterl56@hotmail.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.3" "yunohost": ">= 4.2.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -4,94 +4,6 @@ PKG_DEPENDENCIES="sqlite3 libldap2-dev libsasl2-dev python3-dev imagemagick pyth
DOSSIER_MEDIA=/home/yunohost.multimedia DOSSIER_MEDIA=/home/yunohost.multimedia
#These var are used in init_calibre_db_settings conf file #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
# 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
}

View file

@ -27,12 +27,19 @@ public_library=$YNH_APP_ARG_PUBLIC_LIBRARY
#when initializing the conf file of the app #when initializing the conf file of the app
source _common.sh 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
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 # 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_script_progression --message="Downloading sources to $final_path..." --weight=10
ynh_app_setting_set $app final_path $final_path 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 # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source "$final_path"
@ -86,7 +99,7 @@ ynh_setup_source "$final_path"
# INSTALL DEPENDENCIES # 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 ynh_install_app_dependencies $PKG_DEPENDENCIES
#use latest version of pip as per documentation in https://github.com/pypa/get-pip #use latest version of pip as per documentation in https://github.com/pypa/get-pip
@ -143,13 +156,6 @@ ynh_script_progression --message="Creating files and directory..." --weight=5
ynh_multimedia_build_main_dir ynh_multimedia_build_main_dir
ynh_multimedia_addaccess $app 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) #Check if metadata.db file exists. If not create it (empty library)
if [ ! -e "$calibre_dir"/metadata.db ]; then 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 #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="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 required on low spec like raspberryPi
sleep 2s #sleep 2s
#remove unwanted calibre-web.log #remove unwanted calibre-web.log
ynh_secure_remove --file="$final_path/calibre-web.log" #ynh_secure_remove --file="$final_path/calibre-web.log"
ynh_systemd_action --service_name=$app --action="stop" #ynh_systemd_action --service_name=$app --action="stop"
#set database settings as per conf file #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\"" #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" #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"
#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 #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="<policy domain="coder" rights="none" pattern="PDF" />" \ ynh_replace_string --match_string="<policy domain="coder" rights="none" pattern="PDF" />" \
@ -204,7 +210,7 @@ ynh_replace_string --match_string="<policy domain="coder" rights="none" pattern=
#================================================= #=================================================
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "${final_path}/app.db" #ynh_store_file_checksum "${final_path}/app.db"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST

View file

@ -10,7 +10,6 @@ version_gt() {
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -59,13 +58,6 @@ else #on est encore en 0.6.0
current_upstream_app_version='0.6.0' current_upstream_app_version='0.6.0'
fi fi
#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
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # 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" ynh_systemd_action --service_name=$app --action="stop"
#================================================= #=================================================
# STANDARD UPGRADE STEPS # ENSURE DOWNWARD COMPATIBILITY
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
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 #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 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_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" 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 required on low spec like raspberryPi
sleep 2s sleep 2s
ynh_systemd_action --service_name=$app --action="stop" 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" current_upstream_app_version="0.6.6"
#remove unwanted entry in settings db
fi fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files from $current_upstream_app_version to $new_upstream_package_version..." --weight=10 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 # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
fi fi
@ -168,37 +186,13 @@ ynh_script_progression --message="Create Multimedia dir..." --weight=1
ynh_multimedia_build_main_dir ynh_multimedia_build_main_dir
ynh_multimedia_addaccess $app 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 #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="<policy domain="coder" rights="none" pattern="PDF" />" \ ynh_replace_string --match_string="<policy domain="coder" rights="none" pattern="PDF" />" \
--replace_string="<policy domain="coder" rights="read" pattern="PDF" />" \ --replace_string="<policy domain="coder" rights="read" pattern="PDF" />" \
--target_file="/etc/ImageMagick-6/policy.xml" --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 # SETUP LOGROTATE
@ -269,4 +263,4 @@ ynh_systemd_action --service_name=$app --action="start" --line_match="Starting G
# 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,15 @@
--- a/cps/templates/admin.html 2021-01-18 22:29:30.797813487 +0100 --- a/cps/templates/admin.html 2021-05-22 14:08:46.000000000 +0200
+++ b/cps/templates/admin.html 2021-01-18 22:30:02.369665368 +0100 +++ b/cps/templates/admin.html 2021-06-06 12:43:44.886680839 +0200
@@ -169,8 +169,6 @@ @@ -184,11 +184,7 @@
</tbody>
</table> </table>
<div class="hidden" id="update_error"> <span>{{update_error}}</span></div> - {% if feature_support['updater'] %}
- <div class="hidden" id="update_error"> <span>{{update_error}}</span></div>
- <div class="btn btn-primary" 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-primary 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>
- {% endif %}
+
</div> </div>
</div> </div>
</div> </div>

View file

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

View file

@ -0,0 +1,26 @@
--- 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'))
#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

View file

@ -1,30 +1,36 @@
--- a/optional-requirements.txt 2021-01-18 22:32:21.629010296 +0100 --- a/optional-requirements.txt 2021-05-22 14:08:46.000000000 +0200
+++ b/optional-requirements.txt 2021-01-18 23:43:53.721141321 +0100 +++ b/optional-requirements.txt 2021-06-06 10:47:53.012009447 +0200
@@ -1,16 +1,6 @@ @@ -1,22 +1,3 @@
# GDrive Integration -# GDrive Integration
-google-api-python-client>=1.7.11,<1.8.0 -gevent>20.6.0,<21.2.0
gevent>=1.2.1,<20.6.0 -greenlet>=0.4.17,<1.2.0
greenlet>=0.4.12,<0.4.17 -httplib2>=0.9.2,<0.20.0
-httplib2>=0.9.2,<0.18.0
-oauth2client>=4.0.0,<4.1.4 -oauth2client>=4.0.0,<4.1.4
-uritemplate>=3.0.0,<3.1.0 -uritemplate>=3.0.0,<3.1.0
-pyasn1-modules>=0.0.8,<0.3.0 -pyasn1-modules>=0.0.8,<0.3.0
-pyasn1>=0.1.9,<0.5.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 -PyYAML>=3.12
-rsa>=3.4.2,<4.1.0 -rsa>=3.4.2,<4.8.0
-six>=1.10.0,<1.15.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
goodreads>=0.3.2,<0.4.0 goodreads>=0.3.2,<0.4.0
@@ -20,10 +10,6 @@ python-Levenshtein>=0.12.0,<0.13.0
python-ldap>=3.0.0,<3.3.0 @@ -25,10 +6,6 @@
python-ldap>=3.0.0,<3.4.0
Flask-SimpleLDAP>=1.4.0,<1.5.0 Flask-SimpleLDAP>=1.4.0,<1.5.0
-#oauth -#oauth
-Flask-Dance>=1.4.0,<3.1.0 -Flask-Dance>=2.0.0,<5.1.0
-SQLAlchemy-Utils>=0.33.5,<0.37.0 -SQLAlchemy-Utils>=0.33.5,<0.38.0
- -
# extracting metadata # extracting metadata
lxml>=3.8.0,<4.6.0 lxml>=3.8.0,<4.7.0
rarfile>=2.7 rarfile>=2.7

View file

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

View file

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