<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Weloveschool Proxy Nexus</title>
    <link href="/style.css" rel="stylesheet" type="text/css" media="all">
    <style>
      body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100vh;
        background-color: #f4f4f9;
        color: #333;
      }

      h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
      }

      p {
        margin-bottom: 1rem;
        text-align: center;
      }

      form {
        display: flex;
        flex-direction: column;
        align-items: center;
      }

      input {
        padding: 0.5rem;
        font-size: 1rem;
        margin-bottom: 0.5rem;
        border: 1px solid #ccc;
        border-radius: 0.25rem;
        width: 300px;
      }

      button {
        padding: 0.5rem 1rem;
        font-size: 1rem;
        border: none;
        border-radius: 0.25rem;
        cursor: pointer;
        margin: 0.25rem;
      }

      button#togglePassword {
        background-color: #007bff;
        color: white;
      }

      button#togglePassword:hover {
        background-color: #0056b3;
      }

      button[type="submit"] {
        background-color: #28a745;
        color: white;
      }

      button[type="submit"]:hover {
        background-color: #218838;
      }

      noscript {
        color: red;
        font-weight: bold;
        margin-bottom: 1rem;
      }
    </style>
  </head>
  <body>
    <noscript>
      <p style="color: red; font-weight: bold;">JavaScript is required to run this emulator. Please enable JavaScript in your browser.</p>
    </noscript>

    <h1>weloveschool emulator</h1>
    <p>Emulator that allows running proxies from your local system / browser. Specs below.</p>
    <p>The emulator runs locally on the user's client and uses WebAssembly and iframes to bypass security systems.</p>
    <p>To continue, enter the password as <strong>weloveschool emulators are in early access</strong></p>

    <form id="passwordForm">
      <input type="password" id="passwordInput" placeholder="Enter password" required>
      <button type="button" id="togglePassword">Show</button>
      <button type="submit">Submit</button>
    </form>

    <script>
      const encodedPassword = 'cnVja2Vyc3Rld2FydDEyMzQ=';
      function decodePassword(encoded) {
        return atob(encoded);
      }

      document.getElementById('passwordForm').addEventListener('submit', function(event) {
        event.preventDefault();
        const enteredPassword = document.getElementById('passwordInput').value;
        const correctPassword = decodePassword(encodedPassword);
        if (enteredPassword === correctPassword) {
          alert('Access granted!');
          window.location.href = 'emulator/index.html';
        } else {
          alert('Incorrect password. Please try again.');
        }
      });

      const passwordInput = document.getElementById('passwordInput');
      const togglePassword = document.getElementById('togglePassword');

      togglePassword.addEventListener('click', function() {
        const type = passwordInput.type === 'password' ? 'text' : 'password';
        passwordInput.type = type;
        togglePassword.textContent = type === 'password' ? 'Show' : 'Hide';
      });
    </script>
  </body>
</html>