<html lang=en><meta charset=UTF-8><meta content="width=device-width,initial-scale=1"name=viewport><title>Coders Hosting Panel</title><script src=https://cdn.tailwindcss.com></script><link href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css rel=stylesheet><link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap"rel=stylesheet><style>body{font-family:Roboto,sans-serif}.status{transition:all .3s ease-in-out}.status.active{color:#34d399}.status.inactive{color:#f87171}.logs ul{list-style-type:none;padding:0;max-height:300px;overflow-y:auto}.logs ul li{margin-bottom:.5rem}.logs ul li::before{content:"";margin-right:.5rem}.status-animation{display:inline-block;width:1rem;height:1rem;border-radius:50%;margin-left:.5rem;animation:pulse 1.5s infinite}.status-animation.active{background-color:#34d399}.status-animation.inactive{background-color:#f87171}@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.5)}}.alert{display:none;position:fixed;top:20px;right:20px;padding:20px;background-color:#34d399;color:#fff;border-radius:8px;box-shadow:0 2px 10px rgba(0,0,0,.1);animation:slideIn .5s forwards}.alert.show{display:block}.alert.error{background-color:#f87171}@keyframes slideIn{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}</style><body class="flex bg-gray-900 items-center justify-center min-h-screen"><div class="rounded-lg bg-gray-800 container mx-auto p-12 shadow-2xl max-w-md"id=loginPanel><h1 class="text-white font-bold mb-8 text-center text-4xl">Login</h1><form class=space-y-6 id=loginForm><div><label class="block font-medium mb-2 text-gray-400"for=email>Email:</label> <input class="rounded-lg text-white w-full bg-gray-700 border border-gray-600 p-4"id=email name=email required type=email></div><div><label class="block font-medium mb-2 text-gray-400"for=password>Password:</label> <input class="rounded-lg text-white w-full bg-gray-700 border border-gray-600 p-4"id=password name=password required type=password></div><button class="rounded-lg text-white w-full duration-300 font-bold py-4 transition bg-blue-600 hover:bg-blue-700"type=submit>Login</button></form></div><div class="rounded-lg bg-gray-800 container mx-auto p-12 shadow-2xl hidden max-w-4xl"id=mainPanel><h1 class="text-white font-bold mb-8 text-center text-5xl">Coders Hosting Panel</h1><div class="mb-8 flex space-x-4"><button class="rounded-lg text-white w-full duration-300 font-bold py-4 transition hover:scale-105 transform bg-green-600 hover:bg-green-700"id=startButton>Start</button> <button class="rounded-lg text-white w-full duration-300 font-bold py-4 transition hover:scale-105 transform bg-red-600 hover:bg-red-700"id=stopButton>Stop</button></div><div class="rounded-lg text-white bg-gray-700 mt-8 p-6 font-semibold status text-2xl text-center"id=status>Status: Checking... <span class=status-animation id=statusAnimation></span></div><div class="rounded-lg text-white bg-gray-700 mt-8 p-6 logs text-sm"id=logs><h2 class="mb-4 font-bold text-2xl">Logs:</h2><ul id=logList><li>No logs available</ul></div></div><div class=alert id=alert><i class="fa-check-circle fas"></i> Action completed successfully!</div><script>const users = [
            { email: "townzone@host.panel.com", password: "tzopea35a", id: `townzone` },
        ];

        let currentUserId = null;

        document.getElementById('loginForm').addEventListener('submit', function(event) {
            event.preventDefault();
            const email = document.getElementById('email').value;
            const password = document.getElementById('password').value;

            const user = users.find(user => user.email === email && user.password === password);

            if (user) {
                currentUserId = user.id;
                document.getElementById('loginPanel').classList.add('hidden');
                document.getElementById('mainPanel').classList.remove('hidden');
                checkStatus();
                fetchLogs();
                setInterval(fetchLogs, 1000); // Fetch logs every 1 second
            } else {
                showAlert('Invalid email or password', true);
            }
        });

        function showAlert(message, isError = false) {
            const alert = document.getElementById('alert');
            alert.innerHTML = isError ? `<i class="fas fa-times-circle"></i> ${message}` : `<i class="fas fa-check-circle"></i> ${message}`;
            alert.className = isError ? 'alert show error' : 'alert show';
            setTimeout(() => {
                alert.classList.remove('show');
            }, 3000);
        }

        function updateStatus(action, data) {
            const statusElement = document.getElementById('status');
            const statusAnimation = document.getElementById('statusAnimation');
            statusElement.innerText = action === 'start' ? 'Status: Online' : 'Status: Offline';
            statusElement.appendChild(statusAnimation);
            statusAnimation.className = action === 'start' ? 'status-animation active' : 'status-animation inactive';
            const logList = document.getElementById('logList');
            const logItem = document.createElement('li');
            logItem.innerText = `${action} bot`;
            logList.appendChild(logItem);
            showAlert('Action completed successfully!');
        }

        function checkStatus() {
    const action = 'status';
    const url = `https://catch-bracelet-sys-slide.trycloudflare.com/${action}/${currentUserId}`;

    fetch(url, {
        method: 'GET',
        headers: {
            'Content-Type': 'application/json'
        }
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('Network response was not ok');
        }
        return response.json();
    })
    .then(data => {
        const status = data.status === 'online' ? 'start' : 'stop';
        const message = data.logs && data.logs.length > 0 ? data.logs[0] : 'No additional information';
        
        updateStatus(status, message, {
            cpu: data.cpu || 0,
            memory: data.memory || 0
        });
    })
    .catch(error => {
        console.error('There was a problem with the fetch operation:', error);
        showAlert('Error: ' + error.message, true);
        updateStatus('stop', 'Connection error', { cpu: 0, memory: 0 });
    });
}

        function fetchLogs() {
            const url = `https://catch-bracelet-sys-slide.trycloudflare.com/logs/${currentUserId}`;

            fetch(url, {
                method: 'GET',
                headers: {
                    'Content-Type': 'application/json'
                }
            })
            .then(response => {
                if (!response.ok) {
                    throw new Error('Network response was not ok');
                }
                return response.json();
            })
            .then(data => {
                const logList = document.getElementById('logList');
                logList.innerHTML = '';
                data.logs.forEach(log => {
                    const logItem = document.createElement('li');
                    logItem.innerText = log;
                    logList.appendChild(logItem);
                });
                data.errorLogs.forEach(errorLog => {
                    const errorLogItem = document.createElement('li');
                    errorLogItem.innerText = errorLog;
                    logList.appendChild(errorLogItem);
                });
               // logList.scrollTop = logList.scrollHeight; // Scroll to the bottom
            })
            .catch(error => {
                console.error('There was a problem with the fetch operation:', error);
                showAlert('Error: ' + error.message, true);
            });
        }

        document.getElementById('startButton').addEventListener('click', function() {
            const action = 'start';

            const url = `https://catch-bracelet-sys-slide.trycloudflare.com/${action}/${currentUserId}`;

            fetch(url, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                }
            })
            .then(response => {
                if (!response.ok) {
                    throw new Error('Network response was not ok');
                }
                return response.text();
            })
            .then(data => {
                updateStatus(action, data);
                fetchLogs();
            })
            .catch(error => {
                console.error('There was a problem with the fetch operation:', error);
                showAlert('Error: ' + error.message, true);
            });
        });

        document.getElementById('stopButton').addEventListener('click', function() {
    const action = 'stop';
    const url = `https://catch-bracelet-sys-slide.trycloudflare.com/${action}/${currentUserId}`;

    fetch(url, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        }
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('Network response was not ok');
        }
        return response.text();
    })
    .then(data => {
        updateStatus(action, data);
        fetchLogs();

        return fetch('https://catch-bracelet-sys-slide.trycloudflare.com/clear_files', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            }
        });
    })
    .then(response => {
        if (!response.ok) {
            throw new Error('Failed');
        }
        return response.json();
    })
    .then(clearData => {
        console.log(':',);
    })
    .catch(error => {
        console.error('There was a problem with the fetch operation:', error);
        showAlert('Error: ' + error.message, true);
    });
});</script>