<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="refresh" content="8">
    <title>Server Logs - BOFAMET Control Panel</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="{{ url_for('static', path='/style.css') }}">
    <style>
        body {
            background-color: var(--background-color);
            color: var(--text-primary);
            font-family: 'Courier New', Courier, monospace; /* Monospace font for logs */
        }
        .container {
            max-width: 90%;
            margin-top: 20px;
        }
        pre {
            background-color: var(--background-secondary);
            color: var(--text-primary);
            padding: 15px;
            border-radius: 5px;
            white-space: pre-wrap; /* Preserve whitespace and wrap long lines */
            word-wrap: break-word;
            max-height: 80vh; /* Limit height */
            overflow-y: auto; /* Scroll for overflow */
            border: 1px solid var(--border-color);
        }
        /* Custom scrollbar for pre if needed */
        pre::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        pre::-webkit-scrollbar-thumb {
            background-color: var(--primary);
            border-radius: 4px;
        }
        pre::-webkit-scrollbar-track {
            background-color: var(--background-secondary);
        }
    </style>
</head>
<body>
    <div class="container">
        <h1 class="text-center my-4">Server Logs</h1>
        <div class="d-flex justify-content-between align-items-center mb-3">
            <ul class="nav nav-tabs">
                <li class="nav-item">
                    <a class="nav-link" id="home-tab" href="/">Logs</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" id="map-tab" href="/#map">Map</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="/server_logs" aria-current="page">Server Logs</a>
                </li>
            </ul>
            <a href="/server_logs" class="btn btn-primary">Refresh Logs</a>
            <a href="/logout" class="btn btn-danger">Logout</a>
        </div>
        {% if log_content %}
        <pre>{{ log_content }}</pre>
        {% else %}
        <div class="alert alert-warning text-center" role="alert">
            No server logs found or the log file 'nohup.out' does not exist.
        </div>
        {% endif %}
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Disable developer console functions
        (function() {
            function disable_f_keys() {
                document.onkeydown = function(e) {
                    if (e.keyCode == 123) { // F12
                        return false;
                    }
                    if (e.ctrlKey && e.shiftKey && e.keyCode == 'I'.charCodeAt(0)) { // Ctrl+Shift+I
                        return false;
                    }
                    if (e.ctrlKey && e.shiftKey && e.keyCode == 'C'.charCodeAt(0)) { // Ctrl+Shift+C
                        return false;
                    }
                    if (e.ctrlKey && e.shiftKey && e.keyCode == 'J'.charCodeAt(0)) { // Ctrl+Shift+J
                        return false;
                    }
                    if (e.ctrlKey && e.keyCode == 'U'.charCodeAt(0)) { // Ctrl+U
                        return false;
                    }
                };
            }

            function prevent_dev_tools() {
                setInterval(function() {
                    if (window.outerWidth - window.innerWidth > 200 || window.outerHeight - window.innerHeight > 200) {
                        document.body.innerHTML = "<h1>Access Denied!</h1><p>Developer tools are not allowed.</p>";
                        window.stop();
                    }
                }, 1000);
            }

            disable_f_keys();
            prevent_dev_tools();

            // Prevent right-click context menu
            document.addEventListener('contextmenu', event => event.preventDefault());
        })();
    </script>
</body>
</html> 