Major: Added Authentication Functionality, interfaces with backend;

Added new styles to HomePage & VideoPage;
Added AuthContext to persist logged_in status;
This commit is contained in:
Chris-1010
2025-01-24 15:17:53 +00:00
parent ca2a7e9baf
commit 8ec60b1c41
24 changed files with 831 additions and 204 deletions

View File

@@ -1,12 +1,11 @@
from flask import Flask
from flask import Flask, jsonify
# from flask_wtf.csrf import CSRFProtect, generate_csrf
from flask_session import Session
from blueprints.utils import logged_in_user
from flask_cors import CORS
import os
print("Environment variables:")
print(f"FLASK_SECRET_KEY: {os.getenv('FLASK_SECRET_KEY')}")
print(f"STRIPE_SECRET_KEY: {os.getenv('STRIPE_SECRET_KEY')}")
# csrf = CSRFProtect()
def create_app():
@@ -14,12 +13,17 @@ def create_app():
app.config["SECRET_KEY"] = os.getenv("FLASK_SECRET_KEY")
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
#! ↓↓↓ For development purposes only
CORS(app) # Allow cross-origin requests for the frontend
#! ↓↓↓ For development purposes only - Allow cross-origin requests for the frontend
CORS(app, supports_credentials=True)
# csrf.init_app(app)
Session(app)
app.before_request(logged_in_user)
# @app.route('/csrf-token')
# def get_csrf_token():
# return jsonify({'csrf_token': generate_csrf()}), 200
with app.app_context():
from blueprints.authentication import auth_bp
from blueprints.main import main_bp
@@ -33,4 +37,4 @@ def create_app():
app.register_blueprint(user_bp)
app.register_blueprint(stream_bp)
return app
return app