<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>EasyCrypter API Documentation</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Подключение Prism.js для подсветки синтаксиса -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
    <style>
        body {
            padding-top: 4rem;
            transition: all 0.3s ease;
        }
        .navbar {
            background-color: #007bff;
        }
        .navbar-brand, .nav-link {
            color: white !important;
        }
        .endpoint {
            border-left: 4px solid #007bff;
            padding: 1rem;
            margin-bottom: 1rem;
            opacity: 0;
            transition: opacity 0.5s ease;
        }
        pre code {
            background-color: #f8f9fa;
            padding: 1rem;
            display: block;
            border-radius: 5px;
        }

        /* Анимация появления */
        @keyframes fadeIn {
            0% {
                opacity: 0;
                transform: translateY(20px);
            }
            100% {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .fade-in {
            opacity: 0;
            animation: fadeIn 1s ease-out forwards;
        }

        /* Плавные переходы для элементов */
        h1, h2, p, pre, code {
            transition: all 0.3s ease;
        }

        /* Светлая тема */
        body.light-theme {
            background-color: #ffffff;
            color: #333333;
        }

        .navbar.light-theme {
            background-color: #f8f9fa;
        }

        /* Темная тема */
        body.dark-theme {
            background-color: #212529;
            color: #f8f9fa;
        }

        .navbar.dark-theme {
            background-color: #343a40;
        }

        /* Темная тема для полей запросов и ответов */
        body.dark-theme pre code {
            background-color: #343a40;
            color: #f8f9fa;
        }

        .endpoint.dark-theme {
            background-color: #343a40;
            border-left: 4px solid #007bff;
        }

        /* Цвета заголовков и текста в темной теме */
        .dark-theme h1, .dark-theme h2, .dark-theme p {
            color: #f8f9fa;
        }

        /* Темная тема для фона полей запросов и ответов */
        .dark-theme .endpoint pre code {
            background-color: #495057;
            color: #f8f9fa;
        }
    </style>
</head>
<body class="dark-theme">
    <nav class="navbar navbar-expand-lg navbar-dark fixed-top">
        <div class="container-fluid">
            <a class="navbar-brand" href="#" id="navbarBrand">EasyCrypter API 🎄</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="#overview" id="overviewLink">Overview</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#endpoints" id="endpointsLink">Endpoints</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#examples" id="examplesLink">Examples</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="License.html" id="licenseLink">License Agreement</a>
                    </li>
                </ul>
                <ul class="navbar-nav ms-auto">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="languageSwitcher" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                            Language
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="languageSwitcher">
                            <li><a class="dropdown-item" href="#" onclick="switchLanguage('ru')">Русский</a></li>
                            <li><a class="dropdown-item" href="#" onclick="switchLanguage('en')">English</a></li>
                            <li><a class="dropdown-item" href="#" onclick="switchLanguage('zh')">中文</a></li>
                        </ul>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#" onclick="toggleTheme()">Switch Theme</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container mt-5">
        <section id="overview" class="fade-in">
            <h1 id="overviewTitle">Overview ☃️</h1>
            <p id="overviewText">Welcome to the EasyCrypter API documentation! This API allows you to interact with our service for automatic encryption and signing of files. Below you will find details on endpoints and example requests.</p>
        </section>

        <hr>

        <section id="endpoints" class="fade-in">
            <h2 id="endpointsTitle">Endpoints ❄️</h2>

            <div class="endpoint fade-in">
                <h4>GET /</h4>
                <p id="getDescription">Shows your current IP address.</p>
                <h6 id="requestLabel">Request:</h6>
                <pre><code>GET / HTTP/1.1
Host: 37.220.87.10:8080
X-Forwarded-For: <your IP></code></pre>
                <h6 id="responseLabel">Response:</h6>
                <pre><code>HTTP/1.1 200 OK
Content-Type: text/plain

Your ip address: <IP></code></pre>
            </div>

            <div class="endpoint fade-in">
                <h4>GET /getstatus</h4>
                <p id="getStatusDescription">Shows the current status of the crypter.</p>
                <h6 id="requestStatusLabel">Request:</h6>
                <pre><code>GET /getstatus HTTP/1.1
Host: 37.220.87.10:8080</code></pre>
                <h6 id="responseStatusLabel">Response:</h6>
                <pre><code>HTTP/1.1 200 OK
Content-Type: text/plain

ok</code></pre>
                <p id="responseStatusDescription">Possible responses:</p>
                <ul>
                    <li><code>ok</code> - Crypter is working</li>
                    <li><code>tech</code> - Crypter is under maintenance</li>
                </ul>
            </div>

            <div class="endpoint fade-in">
                <h4>POST /crypt</h4>
                <p id="cryptDescription">Encrypts the provided executable file.</p>
                <h6 id="headersLabel">Headers:</h6>
                <ul>
                    <li><code>Api-Key</code>: Your API key (required)</li>
                    <li><code>Telegram-ID</code>: Your Telegram ID associated with the API key (required)</li>
                </ul>
                <h6 id="requestBodyLabel">Request Body:</h6>
                <p>The file to be encrypted is sent in <code>multipart/form-data</code> format.</p>
                <h6 id="responseCryptLabel">Response:</h6>
                <pre><code>HTTP/1.1 200 OK
Content-Type: application/octet-stream

(encrypted file)</code></pre>
                <p id="responseCryptDescription">Possible response codes:</p>
                <ul>
                    <li><code>200 OK</code> - Returns the encrypted file</li>
                    <li><code>401 Unauthorized</code> - Missing or invalid API key, Telegram ID, or IP address</li>
                    <li><code>403 Forbidden</code> - Subscription not found (Crypt or EasyCrypterer Plus)</li>
                    <li><code>400 Bad Request</code> - File not specified</li>
                    <li><code>413 Payload Too Large</code> - File is too large (max 10 MB)</li>
                    <li><code>500 Internal Server Error</code> - Unknown error</li>
                </ul>
            </div>

            <div class="endpoint fade-in">
                <h4>POST /crypt_second</h4>
                <p id="cryptSecondDescription">Encrypts the file using an alternative method.</p>
                <h6 id="headersSecondLabel">Headers:</h6>
                <ul>
                    <li><code>Api-Key</code>: Your API key (required)</li>
                    <li><code>Telegram-ID</code>: Your Telegram ID associated with the API key (required)</li>
                </ul>
                <h6 id="requestBodySecondLabel">Request Body:</h6>
                <p>The file to be encrypted is sent in <code>multipart/form-data</code> format.</p>
                <h6 id="responseSecondCryptLabel">Response:</h6>
                <pre><code>HTTP/1.1 200 OK
Content-Type: application/octet-stream

(encrypted file)</code></pre>
                <p id="responseSecondCryptDescription">Possible response codes:</p>
                <ul>
                    <li><code>200 OK</code> - Returns the encrypted file</li>
                    <li><code>401 Unauthorized</code> - Invalid API key or Telegram ID</li>
                    <li><code>400 Bad Request</code> - File not specified</li>
                    <li><code>500 Internal Server Error</code> - Unknown error</li>
                </ul>
            </div>
        </section>

        <hr>

        <section id="examples" class="fade-in">
            <h2 id="examplesTitle">Examples 🥶</h2>

            <div>
                <h4>GET /</h4>
                <pre><code class="language-python">import requests

response = requests.get("http://37.220.87.10:8080/") 
print(response.text)</code></pre>
            </div>

            <div>
                <h4>GET /getstatus</h4>
                <pre><code class="language-python">import requests

response = requests.get("http://37.220.87.10:8080/getstatus")
print(response.text)</code></pre>
            </div>

            <div>
                <h4>POST /crypt</h4>
                <pre><code class="language-python">import requests

url = "http://37.220.87.10:8080/crypt"
headers = {
    "Api-Key": "your API key",
    "Telegram-ID": "your Telegram ID"
}
files = {"file": open("example.exe", "rb")}
response = requests.post(url, headers=headers, files=files)

with open("encrypted_file.exe", "wb") as f:
    f.write(response.content)</code></pre>
            </div>

            <div>
                <h4>POST /crypt_second</h4>
                <pre><code class="language-python">import requests

url = "http://37.220.87.10:8080/crypt_second"
headers = {
    "Api-Key": "your API key",
    "Telegram-ID": "your Telegram ID"
}
files = {"file": open("example.exe", "rb")}
response = requests.post(url, headers=headers, files=files)

with open("encrypted_file_second.exe", "wb") as f:
    f.write(response.content)</code></pre>
            </div>
        </section>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Переключение темы
        function toggleTheme() {
            var body = document.body;
            body.classList.toggle("dark-theme");
            body.classList.toggle("light-theme");
        }

        // Переключение языка
        function switchLanguage(lang) {
            const texts = {
                ru: {
                    overviewTitle: "Обзор ☃️",
                    overviewText: "Добро пожаловать в документацию API EasyCrypter! Это API позволяет вам взаимодействовать с нашим сервисом для автоматического шифрования и подписания файлов. Ниже вы найдете подробности о конечных точках и примеры запросов.",
                    endpointsTitle: "Конечные точки ❄️",
                    getDescription: "Показывает ваш текущий IP-адрес.",
                    getStatusDescription: "Показывает текущий статус криптера.",
                    cryptDescription: "Шифрует предоставленный исполнимый файл.",
                    cryptSecondDescription: "Шифрует файл с использованием альтернативного метода.",
                    examplesTitle: "Примеры 🥶",
                    licenseLink: "Лицензионное соглашение",
                    overviewLink: "Обзор",
                    endpointsLink: "Конечные точки",
                    examplesLink: "Примеры",
                    licenseAgreement: "Лицензионное соглашение",
                    language: "Язык"
                },
                en: {
                    overviewTitle: "Overview ☃️",
                    overviewText: "Welcome to the EasyCrypter API documentation! This API allows you to interact with our service for automatic encryption and signing of files. Below you will find details on endpoints and example requests.",
                    endpointsTitle: "Endpoints ❄️",
                    getDescription: "Shows your current IP address.",
                    getStatusDescription: "Shows the current status of the crypter.",
                    cryptDescription: "Encrypts the provided executable file.",
                    cryptSecondDescription: "Encrypts the file using an alternative method.",
                    examplesTitle: "Examples 🥶",
                    licenseLink: "License Agreement",
                    overviewLink: "Overview",
                    endpointsLink: "Endpoints",
                    examplesLink: "Examples",
                    licenseAgreement: "License Agreement",
                    language: "Language"
                },
                zh: {
                    overviewTitle: "概述 ☃️",
                    overviewText: "欢迎访问EasyCrypter API文档！此API允许您与我们的服务进行交互，自动加密和签名文件。以下是有关端点和示例请求的详细信息。",
                    endpointsTitle: "端点 ❄️",
                    getDescription: "显示您的当前IP地址。",
                    getStatusDescription: "显示加密工具的当前状态。",
                    cryptDescription: "加密提供的可执行文件。",
                    cryptSecondDescription: "使用备用方法加密文件。",
                    examplesTitle: "示例 🥶",
                    licenseLink: "许可协议",
                    overviewLink: "概述",
                    endpointsLink: "端点",
                    examplesLink: "示例",
                    licenseAgreement: "许可协议",
                    language: "语言"
                }
            };

            const translations = texts[lang];

            document.getElementById('overviewTitle').innerText = translations.overviewTitle;
            document.getElementById('overviewText').innerText = translations.overviewText;
            document.getElementById('endpointsTitle').innerText = translations.endpointsTitle;
            document.getElementById('getDescription').innerText = translations.getDescription;
            document.getElementById('getStatusDescription').innerText = translations.getStatusDescription;
            document.getElementById('cryptDescription').innerText = translations.cryptDescription;
            document.getElementById('cryptSecondDescription').innerText = translations.cryptSecondDescription;
            document.getElementById('examplesTitle').innerText = translations.examplesTitle;
            document.getElementById('licenseLink').innerText = translations.licenseLink;
            document.getElementById('overviewLink').innerText = translations.overviewLink;
            document.getElementById('endpointsLink').innerText = translations.endpointsLink;
            document.getElementById('examplesLink').innerText = translations.examplesLink;
            document.getElementById('licenseAgreement').innerText = translations.licenseAgreement;
            document.getElementById('languageSwitcher').innerText = translations.language;
        }
    </script>
</body>
</html>
