aboutsummaryrefslogtreecommitdiff
path: root/src/web/lib
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-02-26 11:27:31 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-02-26 11:27:31 +0100
commit62b3afeeedfe054345f86093e2d243e956c1e3c9 (patch)
treebbd58f5c8c07f5d87b1c1cca73fa1d5af6178f48 /src/web/lib
parentUpdated Python dependencies. (diff)
downloadnewspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.tar.gz
newspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.tar.bz2
newspipe-62b3afeeedfe054345f86093e2d243e956c1e3c9.zip
The project is now using Poetry.
Diffstat (limited to 'src/web/lib')
-rw-r--r--src/web/lib/__init__.py0
-rw-r--r--src/web/lib/user_utils.py23
-rw-r--r--src/web/lib/view_utils.py26
3 files changed, 0 insertions, 49 deletions
diff --git a/src/web/lib/__init__.py b/src/web/lib/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/src/web/lib/__init__.py
+++ /dev/null
diff --git a/src/web/lib/user_utils.py b/src/web/lib/user_utils.py
deleted file mode 100644
index f78a6ed6..00000000
--- a/src/web/lib/user_utils.py
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-from itsdangerous import URLSafeTimedSerializer
-import conf
-from bootstrap import application
-
-
-def generate_confirmation_token(nickname):
- serializer = URLSafeTimedSerializer(application.config['SECRET_KEY'])
- return serializer.dumps(nickname, salt=application.config['SECURITY_PASSWORD_SALT'])
-
-
-def confirm_token(token):
- serializer = URLSafeTimedSerializer(application.config['SECRET_KEY'])
- try:
- nickname = serializer.loads(
- token,
- salt=application.config['SECURITY_PASSWORD_SALT'],
- max_age=conf.TOKEN_VALIDITY_PERIOD
- )
- except:
- return False
- return nickname
diff --git a/src/web/lib/view_utils.py b/src/web/lib/view_utils.py
deleted file mode 100644
index 1d8c6aed..00000000
--- a/src/web/lib/view_utils.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from functools import wraps
-from flask import request, Response, make_response
-from lib.utils import to_hash
-
-
-def etag_match(func):
- @wraps(func)
- def wrapper(*args, **kwargs):
- response = func(*args, **kwargs)
- if isinstance(response, Response):
- etag = to_hash(response.data)
- headers = response.headers
- elif type(response) is str:
- etag = to_hash(response)
- headers = {}
- else:
- return response
- if request.headers.get('if-none-match') == etag:
- response = Response(status=304)
- response.headers['Cache-Control'] \
- = headers.get('Cache-Control', 'pragma: no-cache')
- elif not isinstance(response, Response):
- response = make_response(response)
- response.headers['etag'] = etag
- return response
- return wrapper
bgstack15