Бот для капчи в чатах
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!doctype html>
<html lang="ru" class="dark">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}Amadeus{% endblock %}</title>
    <script>
        // Применяем сохранённую тему до отрисовки, чтобы не мигало.
        try { if (localStorage.getItem("amd-theme") === "light") document.documentElement.classList.remove("dark"); } catch (e) {}
    </script>
    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = {
            darkMode: "class",
            theme: {
                extend: {
                    fontFamily: { sans: ["Geist", "ui-sans-serif", "system-ui", "sans-serif"] },
                    colors: {
                        brand: {
                            50: "#eef2ff", 100: "#e0e7ff", 200: "#c7d2fe", 300: "#a5b4fc",
                            400: "#818cf8", 500: "#6366f1", 600: "#4f46e5", 700: "#4338ca",
                            800: "#3730a3", 900: "#312e81"
                        }
                    }
                }
            }
        }
    </script>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="/static/style.css">
</head>
<body class="min-h-screen bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100 font-sans antialiased">
<div class="flex min-h-screen">
    <aside class="hidden md:flex w-64 shrink-0 flex-col border-r border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900">
        <div class="h-16 flex items-center gap-2 px-5 border-b border-gray-200 dark:border-gray-800">
            <span class="inline-flex h-8 w-8 items-center justify-center rounded-lg bg-brand-600 text-white font-bold">A</span>
            <span class="text-lg font-semibold">Amadeus</span>
        </div>
        <nav class="flex-1 p-3 space-y-1 text-sm">
            {% set items = [
                ("dash", "/", "Дашборд"),
                ("chats", "/chats", "Чаты"),
                ("users", "/users", "Пользователи"),
                ("captcha", "/captcha", "Активные капчи"),
                ("log", "/log", "Журнал")
            ] %}
            {% for key, href, label in items %}
            <a href="{{ href }}"
               class="flex items-center rounded-lg px-3 py-2 transition
               {% if active == key %}bg-brand-600 text-white shadow{% else %}text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800{% endif %}">
                {{ label }}
            </a>
            {% endfor %}
        </nav>
        <div class="p-3 border-t border-gray-200 dark:border-gray-800">
            <div class="flex items-center gap-3">
                {% if user and user.photo_url %}
                <img src="{{ user.photo_url }}" class="h-9 w-9 rounded-full object-cover" alt="">
                {% else %}
                <span class="inline-flex h-9 w-9 items-center justify-center rounded-full bg-gray-200 dark:bg-gray-700 text-sm font-medium">
                    {{ (user.first_name or "?")[:1] }}
                </span>
                {% endif %}
                <div class="min-w-0">
                    <div class="truncate text-sm font-medium">{{ user.first_name or "Гость" }}</div>
                    <div class="truncate text-xs text-gray-500">{% if user.username %}@{{ user.username }}{% else %}id {{ user.user_id }}{% endif %}</div>
                </div>
            </div>
            <a href="/logout" class="mt-3 block text-center rounded-lg border border-gray-200 dark:border-gray-700 px-3 py-1.5 text-sm hover:bg-gray-100 dark:hover:bg-gray-800">Выйти</a>
        </div>
    </aside>
 
    <div class="flex-1 flex flex-col min-w-0">
        <header class="h-16 flex items-center justify-between gap-4 px-6 border-b border-gray-200 dark:border-gray-800 bg-white/70 dark:bg-gray-900/70 backdrop-blur">
            <h1 class="text-lg font-semibold truncate">{% block header %}{% endblock %}</h1>
            <div class="flex items-center gap-2">
                <button id="theme-toggle" class="rounded-lg border border-gray-200 dark:border-gray-700 px-3 py-1.5 text-sm hover:bg-gray-100 dark:hover:bg-gray-800">Тема</button>
                <a href="/logout" class="md:hidden rounded-lg border border-gray-200 dark:border-gray-700 px-3 py-1.5 text-sm">Выйти</a>
            </div>
        </header>
        <main class="p-6 space-y-6">
            {% block content %}{% endblock %}
        </main>
    </div>
</div>
 
<script>
    // Переключатель тёмной/светлой темы.
    document.getElementById("theme-toggle").addEventListener("click", function () {
        const root = document.documentElement;
        root.classList.toggle("dark");
        try { localStorage.setItem("amd-theme", root.classList.contains("dark") ? "dark" : "light"); } catch (e) {}
    });
</script>
</body>
</html>