final stage of the app

This commit is contained in:
2025-07-15 14:32:57 +03:00
parent 94f006d458
commit b94d2ebbd6
29 changed files with 1498 additions and 1124 deletions

46
app/routes/main.py Normal file
View File

@@ -0,0 +1,46 @@
"""
Main routes for QR Code Manager
"""
from flask import Blueprint, render_template
from app.utils.auth import login_required
from app.utils.link_manager import LinkPageManager
bp = Blueprint('main', __name__)
# Initialize manager
link_manager = LinkPageManager()
@bp.route('/')
@login_required
def index():
"""Serve the main page"""
return render_template('index.html')
@bp.route('/links/<page_id>')
def view_link_page(page_id):
"""Display the public link page"""
if not link_manager.page_exists(page_id):
return "Page not found", 404
link_manager.increment_view_count(page_id)
page_data = link_manager.get_page(page_id)
return render_template('link_page.html', page=page_data)
@bp.route('/edit/<page_id>')
@login_required
def edit_link_page(page_id):
"""Display the edit interface for the link page"""
if not link_manager.page_exists(page_id):
return "Page not found", 404
page_data = link_manager.get_page(page_id)
return render_template('edit_links.html', page=page_data)
@bp.route('/health')
def health_check():
"""Health check endpoint for Docker"""
from datetime import datetime
from flask import jsonify
return jsonify({'status': 'healthy', 'timestamp': datetime.now().isoformat()})