2022-06-15 11:33:09 +01:00
|
|
|
from flask import Blueprint, redirect, request, render_template
|
2022-06-19 13:22:05 +01:00
|
|
|
from flask import current_app as app
|
2022-06-15 11:33:09 +01:00
|
|
|
|
|
|
|
from datetime import datetime, timedelta
|
2022-06-14 22:55:11 +01:00
|
|
|
|
|
|
|
views = Blueprint(
|
2022-06-16 13:22:06 +01:00
|
|
|
name='views',
|
2022-06-14 22:55:11 +01:00
|
|
|
import_name=__name__,
|
|
|
|
template_folder='templates',
|
2022-06-16 15:19:26 +01:00
|
|
|
static_folder='root',
|
2022-06-14 22:55:11 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
@views.route('/privacy/')
|
|
|
|
def _privacy():
|
2022-06-15 11:33:09 +01:00
|
|
|
return render_template('privacy.html')
|
|
|
|
|
2022-06-16 13:22:06 +01:00
|
|
|
@views.route('/cookies/', methods=['POST'])
|
2022-06-15 11:33:09 +01:00
|
|
|
def _cookie_consent():
|
|
|
|
resp = redirect('/')
|
|
|
|
resp.set_cookie(
|
|
|
|
key='cookie_consent',
|
|
|
|
value='true',
|
|
|
|
max_age = timedelta(days=14) if request.cookies.get('remember') == 'True' else None,
|
|
|
|
path = '/',
|
2022-06-22 01:54:53 +01:00
|
|
|
expires = datetime.now() + timedelta(days=14) if request.cookies.get('remember') else None,
|
2022-06-19 13:22:05 +01:00
|
|
|
domain = f'{app.config.get("SERVER_NAME")}',
|
2022-06-15 11:33:09 +01:00
|
|
|
secure = True
|
|
|
|
)
|
|
|
|
return resp
|