starting public section
This commit is contained in:
@@ -8,6 +8,7 @@ def init_app(app: Flask):
|
||||
main_bp = Blueprint('main', __name__)
|
||||
auth_bp = Blueprint('auth', __name__, url_prefix='/auth')
|
||||
rooms_bp = Blueprint('rooms', __name__)
|
||||
public_bp = Blueprint('public', __name__)
|
||||
|
||||
# Import and initialize routes
|
||||
from .main import init_routes as init_main_routes
|
||||
@@ -18,10 +19,12 @@ def init_app(app: Flask):
|
||||
from .admin import admin as admin_routes
|
||||
from .email_templates import email_templates as email_templates_routes
|
||||
from .user import user_bp as user_routes
|
||||
from .public import init_public_routes
|
||||
|
||||
# Initialize routes
|
||||
init_main_routes(main_bp)
|
||||
init_auth_routes(auth_bp)
|
||||
init_public_routes(public_bp)
|
||||
|
||||
# Add site_settings context processor to all blueprints
|
||||
@app.context_processor
|
||||
@@ -37,6 +40,7 @@ def init_app(app: Flask):
|
||||
# Register blueprints
|
||||
app.register_blueprint(main_bp)
|
||||
app.register_blueprint(auth_bp)
|
||||
app.register_blueprint(public_bp)
|
||||
app.register_blueprint(rooms_routes)
|
||||
app.register_blueprint(contacts_routes)
|
||||
app.register_blueprint(conversations_routes)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -44,10 +44,20 @@ def init_routes(main_bp):
|
||||
return {'unread_notifications': 0}
|
||||
|
||||
@main_bp.route('/')
|
||||
@login_required
|
||||
@require_password_change
|
||||
def home():
|
||||
return redirect(url_for('main.dashboard'))
|
||||
def public_home():
|
||||
"""Public homepage for the master instance - client-facing website"""
|
||||
# Check if this is a master instance
|
||||
is_master = os.environ.get('MASTER', 'false').lower() == 'true'
|
||||
|
||||
if is_master:
|
||||
# For master instance, show the public homepage
|
||||
return render_template('home.html')
|
||||
else:
|
||||
# For child instances, redirect to login if not authenticated, otherwise dashboard
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('main.dashboard'))
|
||||
else:
|
||||
return redirect(url_for('auth.login'))
|
||||
|
||||
@main_bp.route('/dashboard')
|
||||
@login_required
|
||||
|
||||
79
routes/public.py
Normal file
79
routes/public.py
Normal file
@@ -0,0 +1,79 @@
|
||||
from flask import Blueprint, render_template, redirect, url_for
|
||||
from models import SiteSettings
|
||||
import os
|
||||
|
||||
def init_public_routes(public_bp):
|
||||
@public_bp.context_processor
|
||||
def inject_site_settings():
|
||||
site_settings = SiteSettings.query.first()
|
||||
return dict(site_settings=site_settings)
|
||||
|
||||
@public_bp.route('/features')
|
||||
def features():
|
||||
"""Features page"""
|
||||
return render_template('public/features.html')
|
||||
|
||||
@public_bp.route('/pricing')
|
||||
def pricing():
|
||||
"""Pricing page"""
|
||||
return render_template('public/pricing.html')
|
||||
|
||||
@public_bp.route('/about')
|
||||
def about():
|
||||
"""About page"""
|
||||
return render_template('public/about.html')
|
||||
|
||||
@public_bp.route('/blog')
|
||||
def blog():
|
||||
"""Blog page"""
|
||||
return render_template('public/blog.html')
|
||||
|
||||
@public_bp.route('/careers')
|
||||
def careers():
|
||||
"""Careers page"""
|
||||
return render_template('public/careers.html')
|
||||
|
||||
@public_bp.route('/press')
|
||||
def press():
|
||||
"""Press page"""
|
||||
return render_template('public/press.html')
|
||||
|
||||
@public_bp.route('/help')
|
||||
def help_center():
|
||||
"""Help Center page"""
|
||||
return render_template('public/help.html')
|
||||
|
||||
@public_bp.route('/contact')
|
||||
def contact():
|
||||
"""Contact page"""
|
||||
return render_template('public/contact.html')
|
||||
|
||||
@public_bp.route('/status')
|
||||
def status():
|
||||
"""Status page"""
|
||||
return render_template('public/status.html')
|
||||
|
||||
@public_bp.route('/security')
|
||||
def security():
|
||||
"""Security page"""
|
||||
return render_template('public/security.html')
|
||||
|
||||
@public_bp.route('/privacy')
|
||||
def privacy():
|
||||
"""Privacy Policy page"""
|
||||
return render_template('public/privacy.html')
|
||||
|
||||
@public_bp.route('/terms')
|
||||
def terms():
|
||||
"""Terms of Service page"""
|
||||
return render_template('public/terms.html')
|
||||
|
||||
@public_bp.route('/gdpr')
|
||||
def gdpr():
|
||||
"""GDPR page"""
|
||||
return render_template('public/gdpr.html')
|
||||
|
||||
@public_bp.route('/compliance')
|
||||
def compliance():
|
||||
"""Compliance page"""
|
||||
return render_template('public/compliance.html')
|
||||
Reference in New Issue
Block a user