Files
JKTV-online/web/routes/main.py
T
2026-08-08 21:31:56 +08:00

34 lines
1.2 KiB
Python

from flask import Blueprint, render_template, request, jsonify
from web.services.stats_service import StatsService
bp = Blueprint('main', __name__)
@bp.route('/')
def index():
recent_matches = StatsService.get_recent_matches(limit=5)
daily_counts = StatsService.get_daily_match_counts()
live_matches = StatsService.get_live_matches()
# Convert rows to dict for easier JS usage
heatmap_data = {}
if daily_counts:
for row in daily_counts:
heatmap_data[row['day']] = row['count']
return render_template('home/index.html', recent_matches=recent_matches, heatmap_data=heatmap_data, live_matches=live_matches)
@bp.route('/parse_match', methods=['POST'])
def parse_match():
url = request.form.get('url')
if not url or '5eplay.com' not in url:
return jsonify({'success': False, 'message': 'Invalid 5EPlay URL'}), 400
return jsonify({
'success': False,
'message': (
'URL downloader is not included in this repository. '
'Place iframe_network.json under output_arena/<match_id>/ '
'and run the L1/L2/L3 builders from Admin.'
),
}), 501