Add landing page
This commit is contained in:
@@ -3,6 +3,7 @@ from io import StringIO
|
||||
import io
|
||||
from flask import Blueprint, Response, make_response, render_template, redirect, request, send_file, url_for, flash
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
from werkzeug.http import http_date
|
||||
from app.models import Profile, Reading, db, User
|
||||
from app.forms import DeleteForm, LoginForm, ProfileForm, ReadingForm, SignupForm
|
||||
from flask_login import login_user, login_required, current_user, logout_user
|
||||
@@ -46,8 +47,11 @@ def logout():
|
||||
flash('You have been logged out.', 'success')
|
||||
return redirect(url_for('auth.login')) # Redirect to login page or home page
|
||||
|
||||
@main.route('/', methods=['GET'])
|
||||
def landing():
|
||||
return render_template('landing.html')
|
||||
|
||||
@main.route('/', methods=['GET', 'POST'])
|
||||
@main.route('/dashboard', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def dashboard():
|
||||
# Default values
|
||||
@@ -245,8 +249,10 @@ def profile_image(user_id):
|
||||
image_data = base64.b64decode(profile.profile_pic)
|
||||
response = make_response(image_data)
|
||||
response.headers.set('Content-Type', 'image/jpeg')
|
||||
# Cache for 1 day
|
||||
response.headers.set('Cache-Control', 'public, max-age=86400')
|
||||
response.headers.set('Cache-Control', 'public, max-age=86400') # Cache for 1 day
|
||||
response.headers.set('ETag', str(hash(profile.profile_pic))) # Unique ETag for the image
|
||||
response.headers.set('Last-Modified', http_date(datetime.utcnow().timestamp()))
|
||||
|
||||
return response
|
||||
else:
|
||||
# Serve the default SVG if no profile picture is found
|
||||
|
||||
Reference in New Issue
Block a user