import os import json from flask import Flask, render_template_string, request, jsonify app = Flask(__name__) # Load all JSON files from current directory DATA = [] FILES = [f for f in os.listdir('.') if f.endswith('.json')] seen_ids = set() for f in FILES: with open(f, 'r', encoding='utf-8') as file: try: messages = json.load(file) for msg in messages: msg_id = msg.get('id') if msg_id and msg_id not in seen_ids: seen_ids.add(msg_id) msg['source'] = f.replace('.json', '') DATA.append(msg) except Exception: pass # HTML Template with animations HTML = """