/**
 * base page HTML template for wssshd
 *
 * Copyright (C) 2024 Stefy Lanza <stefy@nexlab.net> and SexHack.me
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef BASE_PAGE_H
#define BASE_PAGE_H

// base page HTML template
static const char *base_page_html =
"<!DOCTYPE html>\n"
"<html lang=\"en\">\n"
"<head>\n"
"    <meta charset=\"UTF-8\">\n"
"    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"
"    <title>{% block title %}WSSSHD control panel{% endblock %}</title>\n"
"    <link rel=\"icon\" href=\"/favicon.ico\" type=\"image/x-icon\">\n"
"    <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css\" rel=\"stylesheet\">\n"
"    <link href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css\" rel=\"stylesheet\">\n"
"    <link rel=\"stylesheet\" href=\"https://unpkg.com/xterm@5.3.0/css/xterm.css\">\n"
"    <script src=\"https://unpkg.com/xterm@5.3.0/lib/xterm.js\"></script>\n"
"    <script src=\"https://unpkg.com/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.js\"></script>\n"
"    <script>\n"
"        // Ensure libraries are loaded\n"
"        function checkLibraries() {\n"
"            if (typeof Terminal === 'undefined') {\n"
"                console.error('Terminal not loaded from CDN');\n"
"                return false;\n"
"            }\n"
"            if (typeof FitAddon === 'undefined') {\n"
"                console.error('FitAddon not loaded from CDN');\n"
"                return false;\n"
"            }\n"
"            console.log('All xterm libraries loaded successfully');\n"
"            return true;\n"
"        }\n"
"\n"
"        // Check immediately and after a delay\n"
"        if (!checkLibraries()) {\n"
"            setTimeout(checkLibraries, 1000);\n"
"        }\n"
"    </script>\n"
"    <style>\n"
"        .navbar-brand {\n"
"            font-weight: bold;\n"
"        }\n"
"        .client-card {\n"
"            transition: transform 0.2s;\n"
"        }\n"
"        .client-card:hover {\n"
"            transform: translateY(-2px);\n"
"            box-shadow: 0 4px 8px rgba(0,0,0,0.1);\n"
"        }\n"
"        .terminal-container {\n"
"            background-color: #1e1e1e;\n"
"            color: #f8f8f2;\n"
"            font-family: 'Courier New', monospace;\n"
"            border-radius: 8px;\n"
"            height: calc(100vh - 200px);\n"
"            min-height: 400px;\n"
"            overflow: hidden;\n"
"            position: relative;\n"
"        }\n"
"        .terminal-input {\n"
"            background: transparent;\n"
"            border: none;\n"
"            color: #f8f8f2;\n"
"            font-family: 'Courier New', monospace;\n"
"            width: 100%;\n"
"            outline: none;\n"
"        }\n"
"        .terminal-input:focus {\n"
"            box-shadow: none;\n"
"        }\n"
"    </style>\n"
"</head>\n"
"<body>\n"
"    <nav class=\"navbar navbar-expand-lg navbar-dark bg-primary\">\n"
"        <div class=\"container\">\n"
"            <a class=\"navbar-brand\" href=\"{{ url_for('index') }}\">\n"
"                <i class=\"fas fa-terminal\"></i> WSSSHD control panel\n"
"            </a>\n"
"            <div class=\"navbar-nav ms-auto\">\n"
"                {% if current_user.is_authenticated %}\n"
"                    <span class=\"navbar-text me-3\">\n"
"                        Welcome, {{ current_user.username }}!\n"
"                    </span>\n"
"                    <button class=\"btn btn-outline-warning btn-sm me-2\" data-bs-toggle=\"modal\" data-bs-target=\"#donationModal\">\n"
"                        <i class=\"fas fa-heart\"></i> Donate\n"
"                    </button>\n"
"                    <a class=\"nav-link\" href=\"{{ url_for('logout') }}\">\n"
"                        <i class=\"fas fa-sign-out-alt\"></i> Logout\n"
"                    </a>\n"
"                {% endif %}\n"
"            </div>\n"
"        </div>\n"
"    </nav>\n"
"\n"
"    <div class=\"container mt-4\">\n"
"        {% with messages = get_flashed_messages(with_categories=true) %}\n"
"            {% if messages %}\n"
"                {% for category, message in messages %}\n"
"                    <div class=\"alert alert-{{ 'danger' if category == 'error' else 'info' }} alert-dismissible fade show\" role=\"alert\">\n"
"                        {{ message }}\n"
"                        <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"alert\"></button>\n"
"                    </div>\n"
"                {% endfor %}\n"
"            {% endif %}\n"
"        {% endwith %}\n"
"\n"
"        {% block content %}{% endblock %}\n"
"    </div>\n"
"\n"
"    <!-- Donation Modal -->\n"
"    <div class=\"modal fade\" id=\"donationModal\" tabindex=\"-1\">\n"
"        <div class=\"modal-dialog\">\n"
"            <div class=\"modal-content\">\n"
"                <div class=\"modal-header\">\n"
"                    <h5 class=\"modal-title\">\n"
"                        <i class=\"fas fa-heart text-danger\"></i> Support WebSocket SSH Development\n"
"                    </h5>\n"
"                    <button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\"></button>\n"
"                </div>\n"
"                <div class=\"modal-body\">\n"
"                    <p class=\"text-muted\">Your support helps us continue developing and maintaining this open-source project!</p>\n"
"\n"
"                    <div class=\"row\">\n"
"                        <div class=\"col-md-4 text-center mb-3\">\n"
"                            <h6><i class=\"fab fa-paypal text-primary\"></i> PayPal</h6>\n"
"                            <a href=\"https://www.paypal.com/paypalme/nexlab\" target=\"_blank\" class=\"btn btn-primary btn-sm\">\n"
"                                <i class=\"fab fa-paypal\"></i> Donate via PayPal\n"
"                            </a>\n"
"                            <small class=\"d-block text-muted mt-1\">info@nexlab.net</small>\n"
"                        </div>\n"
"\n"
"                        <div class=\"col-md-4 text-center mb-3\">\n"
"                            <h6><i class=\"fab fa-bitcoin text-warning\"></i> Bitcoin</h6>\n"
"                            <div class=\"mb-2\">\n"
"                                <img src=\"https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=bitcoin:bc1q3zlkpu95amtcltsk85y0eacyzzk29v68tgc5hx\" alt=\"BTC QR Code\" class=\"img-fluid rounded\">\n"
"                            </div>\n"
"                            <div class=\"input-group input-group-sm\">\n"
"                                <input type=\"text\" class=\"form-control form-control-sm font-monospace\" value=\"bc1q3zlkpu95amtcltsk85y0eacyzzk29v68tgc5hx\" readonly style=\"font-size: 0.75rem;\">\n"
"                                <button class=\"btn btn-outline-secondary btn-sm\" type=\"button\" onclick=\"copyToClipboard('bc1q3zlkpu95amtcltsk85y0eacyzzk29v68tgc5hx')\">\n"
"                                    <i class=\"fas fa-copy\"></i>\n"
"                                </button>\n"
"                            </div>\n"
"                        </div>\n"
"\n"
"                        <div class=\"col-md-4 text-center mb-3\">\n"
"                            <h6><i class=\"fab fa-ethereum text-secondary\"></i> Ethereum</h6>\n"
"                            <div class=\"mb-2\">\n"
"                                <img src=\"https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=ethereum:0xdA6dAb526515b5cb556d20269207D43fcc760E51\" alt=\"ETH QR Code\" class=\"img-fluid rounded\">\n"
"                            </div>\n"
"                            <div class=\"input-group input-group-sm\">\n"
"                                <input type=\"text\" class=\"form-control form-control-sm font-monospace\" value=\"0xdA6dAb526515b5cb556d20269207D43fcc760E51\" readonly style=\"font-size: 0.75rem;\">\n"
"                                <button class=\"btn btn-outline-secondary btn-sm\" type=\"button\" onclick=\"copyToClipboard('0xdA6dAb526515b5cb556d20269207D43fcc760E51')\">\n"
"                                    <i class=\"fas fa-copy\"></i>\n"
"                                </button>\n"
"                            </div>\n"
"                        </div>\n"
"                    </div>\n"
"\n"
"                    <hr>\n"
"                    <p class=\"text-center mb-0\">\n"
"                        <small class=\"text-muted\">\n"
"                            Thank you for your support! ❤️\n"
"                        </small>\n"
"                    </p>\n"
"                </div>\n"
"            </div>\n"
"        </div>\n"
"    </div>\n"
"\n"
"    <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js\"></script>\n"
"    <script src=\"https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.js\"></script>\n"
"    <script>\n"
"        function copyToClipboard(text) {\n"
"            navigator.clipboard.writeText(text).then(function() {\n"
"                // Show a temporary success message\n"
"                const btn = event.target.closest('button');\n"
"                const originalHtml = btn.innerHTML;\n"
"                btn.innerHTML = '<i class=\"fas fa-check\"></i>';\n"
"                btn.classList.remove('btn-outline-secondary');\n"
"                btn.classList.add('btn-success');\n"
"                setTimeout(() => {\n"
"                    btn.innerHTML = originalHtml;\n"
"                    btn.classList.remove('btn-success');\n"
"                    btn.classList.add('btn-outline-secondary');\n"
"                }, 1000);\n"
"            });\n"
"        }\n"
"    </script>\n"
"    {% block scripts %}{% endblock %}\n"
"</body>\n"
"</html>\n";

#endif /* BASE_PAGE_H */
