diff --git a/sources/patches/app-admin.html.patch b/sources/patches/app-admin.hmtl.patch similarity index 50% rename from sources/patches/app-admin.html.patch rename to sources/patches/app-admin.hmtl.patch index 4a82736..dd2411d 100644 --- a/sources/patches/app-admin.html.patch +++ b/sources/patches/app-admin.hmtl.patch @@ -1,11 +1,15 @@ ---- a/cps/templates/admin.html 2021-01-18 22:29:30.797813487 +0100 -+++ b/cps/templates/admin.html 2021-01-18 22:30:02.369665368 +0100 -@@ -169,8 +169,6 @@ +--- a/cps/templates/admin.html 2021-05-22 14:08:46.000000000 +0200 ++++ b/cps/templates/admin.html 2021-06-06 12:43:44.886680839 +0200 +@@ -184,11 +184,7 @@ + - +- {% if feature_support['updater'] %} +- -
{{_('Check for Update')}}
- +- {% endif %} ++ diff --git a/sources/patches/app-config_sql.py.patch.src b/sources/patches/app-config_sql.py.patch.src new file mode 100644 index 0000000..43019d4 --- /dev/null +++ b/sources/patches/app-config_sql.py.patch.src @@ -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') + diff --git a/sources/patches/app-constants.py.patch.src b/sources/patches/app-constants.py.patch.src new file mode 100644 index 0000000..103b635 --- /dev/null +++ b/sources/patches/app-constants.py.patch.src @@ -0,0 +1,26 @@ +--- ./ori/constants.py 2021-05-22 14:08:46.000000000 +0200 ++++ ./new/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 + + diff --git a/sources/patches/app-optional-requirements.txt.patch b/sources/patches/app-optional-requirements.txt.patch index 980e5a4..6be1da6 100644 --- a/sources/patches/app-optional-requirements.txt.patch +++ b/sources/patches/app-optional-requirements.txt.patch @@ -1,30 +1,36 @@ ---- a/optional-requirements.txt 2021-01-18 22:32:21.629010296 +0100 -+++ b/optional-requirements.txt 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 +--- a/optional-requirements.txt 2021-05-22 14:08:46.000000000 +0200 ++++ b/optional-requirements.txt 2021-06-06 10:47:53.012009447 +0200 +@@ -1,22 +1,3 @@ +-# GDrive Integration +-gevent>20.6.0,<21.2.0 +-greenlet>=0.4.17,<1.2.0 +-httplib2>=0.9.2,<0.20.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 +-PyDrive2>=1.3.1,<1.9.0 -PyYAML>=3.12 --rsa>=3.4.2,<4.1.0 --six>=1.10.0,<1.15.0 - +-rsa>=3.4.2,<4.8.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>=0.3.2,<0.4.0 -@@ -20,10 +10,6 @@ - python-ldap>=3.0.0,<3.3.0 + python-Levenshtein>=0.12.0,<0.13.0 +@@ -25,10 +6,6 @@ + python-ldap>=3.0.0,<3.4.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 +-Flask-Dance>=2.0.0,<5.1.0 +-SQLAlchemy-Utils>=0.33.5,<0.38.0 - # extracting metadata - lxml>=3.8.0,<4.6.0 + lxml>=3.8.0,<4.7.0 rarfile>=2.7 diff --git a/sources/patches/app-ub.py.patch.src b/sources/patches/app-ub.py.patch.src new file mode 100644 index 0000000..680611c --- /dev/null +++ b/sources/patches/app-ub.py.patch.src @@ -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 + diff --git a/sources/patches/app-web.py.patch b/sources/patches/app-web.py.patch deleted file mode 100644 index 63ce2ba..0000000 --- a/sources/patches/app-web.py.patch +++ /dev/null @@ -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 -+ - - -