try make the session permanent

This commit is contained in:
Karl Hudgell 2024-11-11 12:37:43 +00:00
parent 554359d7f5
commit 873525d9e0

9
app.py
View File

@ -17,6 +17,15 @@ app.config.from_object(
) )
cache = Cache(app, config={"CACHE_TYPE": "SimpleCache"}) cache = Cache(app, config={"CACHE_TYPE": "SimpleCache"})
app.config['SESSION_COOKIE_SECURE'] = True # Only send cookie over HTTPS
app.config['SESSION_COOKIE_HTTPONLY'] = True # Prevent JavaScript access
app.config['SESSION_COOKIE_SAMESITE'] = 'Lax' # Adjust for cross-site requests
app.config['PERMANENT_SESSION_LIFETIME'] = 60 * 60 * 24 * 365 # 1 year in seconds
@app.before_request
def make_session_permanent():
session.permanent = True
@app.route('/manifest.json') @app.route('/manifest.json')
def serve_manifest(): def serve_manifest():
return send_file('manifest.json', mimetype='application/manifest+json') return send_file('manifest.json', mimetype='application/manifest+json')