From 62bd21ad84ab8172d19a7f72777ade6a4e3108f4 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch <p.jentsch@uni-bielefeld.de>
Date: Fri, 20 Jan 2023 08:58:41 +0100
Subject: [PATCH] Update Flask Hashids

---
 .env.tpl         | 12 ++++++++++++
 config.py        |  1 +
 requirements.txt |  2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/.env.tpl b/.env.tpl
index 30a89416..b63e2920 100644
--- a/.env.tpl
+++ b/.env.tpl
@@ -57,6 +57,18 @@ HOST_DOCKER_GID=
 # ASSETS_DEBUG=
 
 
+################################################################################
+# Flask-Hashids                                                                #
+# https://github.com/Pevtrick/Flask-Hashids                                    #
+################################################################################
+# DEFAULT: 16
+# HASHIDS_MIN_LENGTH=
+
+# NOTE: Use this bash command `python -c "import uuid; print(uuid.uuid4().hex)"`
+#       It is strongly recommended that this is NEVER the same as the SECRET_KEY
+HASHIDS_SALT=
+
+
 ################################################################################
 # Flask-Login                                                                  #
 # https://flask-login.readthedocs.io/en/latest/                                #
diff --git a/config.py b/config.py
index 97e810ee..fa1e8a40 100644
--- a/config.py
+++ b/config.py
@@ -36,6 +36,7 @@ class Config:
 
     ''' # Flask-Hashids '''
     HASHIDS_MIN_LENGTH = 16
+    HASHIDS_SALT=os.environ.get('HASHIDS_SALT')
 
     ''' # Flask-Login # '''
     REMEMBER_COOKIE_SECURE = \
diff --git a/requirements.txt b/requirements.txt
index 7855eee5..8ba3d91a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,7 +6,7 @@ eventlet
 Flask==2.1.3
 Flask-APScheduler
 Flask-Assets
-Flask-Hashids<=0.2.2
+Flask-Hashids==1.0.0
 Flask-HTTPAuth
 Flask-Login
 Flask-Mail
-- 
GitLab