.*$"
#=================================================
# START SYSTEMD SERVICE
#=================================================
-ynh_script_progression --message="Starting a systemd service..." --weight=2
+ynh_script_progression "Starting $app's systemd service..."
-ynh_systemd_action --service_name=$app --action="start" --line_match="Starting Gevent server on" -t 30
+ynh_systemctl --service=$app --action="start" --wait_until="Starting Gevent server on" -t 30
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Upgrade of $app completed" --last
\ No newline at end of file
+ynh_script_progression "Upgrade of $app completed"
diff --git a/sources/patches/main-admin.html.patch b/sources/patches/main-admin.html.patch
deleted file mode 100644
index 7b30e00..0000000
--- a/sources/patches/main-admin.html.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/cps/templates/admin.html 2022-03-06 16:10:41.000000000 +0100
-+++ b/cps/templates/admin.html 2022-03-08 20:59:38.344889625 +0100
-@@ -189,11 +189,6 @@
-
-
-
-- {% if feature_support['updater'] %}
-- {{update_error}}
-- {{_('Check for Update')}}
-- {{_('Perform Update')}}
-- {% endif %}
-
-
-
diff --git a/sources/patches/main-config_sql.py.patch.src b/sources/patches/main-config_sql.py.patch.src
deleted file mode 100644
index fb610ea..0000000
--- a/sources/patches/main-config_sql.py.patch.src
+++ /dev/null
@@ -1,61 +0,0 @@
---- a/cps/config_sql.py 2023-10-21 12:40:32.000000000 +0200
-+++ b/cps/config_sql.py 2023-11-09 23:14:23.774051473 +0100
-@@ -67,7 +67,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_calibre_uuid = Column(String)
- config_port = Column(Integer, default=constants.DEFAULT_PORT)
- config_external_port = Column(Integer, default=constants.DEFAULT_PORT)
-@@ -83,11 +83,11 @@
- config_theme = Column(Integer, default=0)
-
- config_log_level = Column(SmallInteger, default=logger.DEFAULT_LOG_LEVEL)
-- config_logfile = Column(String, default=logger.DEFAULT_LOG_FILE)
-- config_access_log = Column(SmallInteger, default=0)
-- config_access_logfile = Column(String, default=logger.DEFAULT_ACCESS_LOG)
-+ 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)
-@@ -114,11 +114,11 @@
- config_goodreads_api_secret_e = 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')
-@@ -128,15 +128,15 @@
- 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)(cn=%s.main))')
- 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/__APP__/kepubify')
- config_converterpath = Column(String, default=None)
- config_calibre = Column(String)
- config_rarfile_location = Column(String, default=None)
diff --git a/sources/patches/main-constants.py.patch.src b/sources/patches/main-constants.py.patch.src
deleted file mode 100644
index f91682c..0000000
--- a/sources/patches/main-constants.py.patch.src
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/cps/constants.py 2022-03-06 16:10:41.000000000 +0100
-+++ b/cps/constants.py 2022-03-08 21:06:19.917000241 +0100
-@@ -27,7 +27,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
- BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
-@@ -124,12 +124,12 @@
- DEFAULT_MAIL_SERVER = "mail.example.org"
-
- DEFAULT_PASSWORD = "admin123" # nosec
--DEFAULT_PORT = 8083
-+DEFAULT_PORT = __PORT__
- env_CALIBRE_PORT = os.environ.get("CALIBRE_PORT", DEFAULT_PORT)
- try:
- DEFAULT_PORT = int(env_CALIBRE_PORT)
- except ValueError:
-- print('Environment variable CALIBRE_PORT has invalid value (%s), faling back to default (8083)' % env_CALIBRE_PORT)
-+ print('Environment variable CALIBRE_PORT has invalid value (%s), faling back to default (__PORT__)' % env_CALIBRE_PORT)
- del env_CALIBRE_PORT
-
-
diff --git a/sources/patches/main-optional-requirements.txt.patch b/sources/patches/main-optional-requirements.txt.patch
deleted file mode 100644
index 47fcef4..0000000
--- a/sources/patches/main-optional-requirements.txt.patch
+++ /dev/null
@@ -1,39 +0,0 @@
---- a/optional-requirements.txt 2024-07-06 04:29:16.000000000 +0200
-+++ b/optional-requirements.txt 2024-07-09 23:27:11.250122853 +0200
-@@ -1,19 +1,5 @@
- # GDrive Integration
--google-api-python-client>=1.7.11,<2.200.0
- gevent>20.6.0,<24.3.0
--greenlet>=0.4.17,<3.1.0
--httplib2>=0.9.2,<0.23.0
--oauth2client>=4.0.0,<4.1.4
--uritemplate>=3.0.0,<4.2.0
--pyasn1-modules>=0.0.8,<0.5.0
--pyasn1>=0.1.9,<0.7.0
--PyDrive2>=1.3.1,<1.20.0
--PyYAML>=3.12,<6.1
--rsa>=3.4.2,<4.10.0
--
--# Gmail
--google-auth-oauthlib>=0.4.3,<1.3.0
--google-api-python-client>=1.7.11,<2.200.0
-
- # goodreads
- goodreads>=0.3.2,<0.4.0
-@@ -23,9 +9,6 @@
- python-ldap>=3.0.0,<3.5.0
- Flask-SimpleLDAP>=1.4.0,<2.1.0
-
--# oauth
--Flask-Dance>=2.0.0,<7.1.0
--SQLAlchemy-Utils>=0.33.5,<0.42.0
-
- # metadata extraction
- rarfile>=3.2,<5.0
-@@ -43,6 +26,3 @@
-
- # Kobo integration
- jsonschema>=3.2.0,<4.23.0
--
--# Hide console Window on Windows
--pywin32>=220,<310 ; sys_platform == 'win32'
diff --git a/sources/patches/main-ub.py.patch.src b/sources/patches/main-ub.py.patch.src
deleted file mode 100644
index 802a808..0000000
--- a/sources/patches/main-ub.py.patch.src
+++ /dev/null
@@ -1,22 +0,0 @@
---- a/cps/ub.py 2023-03-27 19:49:57.000000000 +0200
-+++ b/cps/ub.py 2023-04-08 15:48:09.987725888 +0200
-@@ -235,7 +235,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="")
-@@ -796,8 +796,8 @@
- # Generate User admin with admin123 password, and access to everything
- def create_admin_user(_session):
- user = User()
-- user.name = "admin"
-- user.email = "admin@example.org"
-+ user.name = "__ADMIN__"
-+ user.email = "__ADMIN_MAIL__"
- user.role = constants.ADMIN_USER_ROLES
- user.sidebar_view = constants.ADMIN_USER_SIDEBAR
-
diff --git a/sources/patches/main-web.py.patch b/sources/patches/main-web.py.patch
deleted file mode 100644
index bf0c4ec..0000000
--- a/sources/patches/main-web.py.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/cps/web.py 2023-03-27 19:49:57.000000000 +0200
-+++ b/cps/web.py 2023-08-05 11:58:20.353503437 +0200
-@@ -1411,7 +1411,11 @@
- if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3):
- logout_oauth_user()
- log.debug("User logged out")
-- return redirect(url_for('web.login'))
-+# return redirect(url_for('web.login'))
-+ if config.config_login_type == constants.LOGIN_LDAP:
-+ return redirect(request.host_url + '/yunohost/sso/?action=logout')
-+ else:
-+ return redirect(url_for('web.login'))
-
-
- # ################################### Users own configuration #########################################################