
 <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Redirecting...</title>
    <style>
      body {
        direction: rtl;
        text-align: end;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        margin: 0;
        flex-direction: column;
        font-size: 1.5rem;
      }
      #manualLink {
        display: none;
        font-size: 1.25rem;
        margin-top: 20px;
      }
      #ellipsis {
        display: inline-block;
        width: 1.5em;
        text-align: start;
      }
      #gear-icon {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
        fill: #6c757d;
        animation: spin 2s linear infinite;
      }
      .main-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 30px;
      }
      @keyframes spin {
        0% {
          transform: rotate(0deg);
        }
        100% {
          transform: rotate(360deg);
        }
      }
    </style>
  </head>
  <body class="main-content">
    <svg id="gear-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
      <path
        d="M24 13.616v-3.232c-1.651-.587-2.694-.752-3.219-2.019v-.001c-.527-1.271.1-2.134.847-3.707l-2.285-2.285c-1.561.742-2.433 1.375-3.707.847h-.001c-1.269-.526-1.435-1.576-2.019-3.219h-3.232c-.582 1.635-.749 2.692-2.019 3.219h-.001c-1.271.528-2.132-.098-3.707-.847l-2.285 2.285c.745 1.568 1.375 2.434.847 3.707-.527 1.271-1.584 1.438-3.219 2.02v3.232c1.632.58 2.692.749 3.219 2.019.53 1.282-.114 2.166-.847 3.707l2.285 2.286c1.562-.743 2.434-1.375 3.707-.847h.001c1.27.526 1.436 1.579 2.019 3.219h3.232c.582-1.636.75-2.69 2.027-3.222h.001c1.262-.524 2.12.101 3.698.851l2.285-2.286c-.744-1.563-1.375-2.433-.848-3.706.527-1.271 1.588-1.44 3.221-2.021zm-12 2.384c-2.209 0-4-1.791-4-4s1.791-4 4-4 4 1.791 4 4-1.791 4-4 4z"
      />
    </svg>
    <p><span id="title">انتقال به درگاه</span></p>
    <a id="manualLink" href="#">در صورت منتقل نشدن خودکار اینجا کلیک کنید</a>
    <script>
      const params = new URLSearchParams(window.location.search);
      let redirect_url = params.get("redirect_to") || "https://zabanshenas.com";

      // Decode URL if encoded=true
      if (params.get("encoded") === "true") {
        try {
          redirect_url = decodeURIComponent(redirect_url);
          document.getElementById("title").firstChild.textContent =
            "در حال بازگشت به اپلیکیشن";
        } catch (e) {
          console.error("Failed to decode redirect URL:", e);
        }
      }

      // Security: allow only certain domains
      const allowedDomains = [
        "zabanshenas.com",
        "zabanshenas.ir",
        "zarinpal.com",
        "snapppay.ir",
      ];
      try {
        const urlObj = new URL(redirect_url);
        const isAllowed = allowedDomains.some(
          (domain) =>
            urlObj.hostname === domain || urlObj.hostname.endsWith("." + domain)
        );
        if (!isAllowed) {
          redirect_url = "https://zabanshenas.com";
        }
      } catch (e) {
        redirect_url = "https://zabanshenas.com";
      }
      const manualLink = document.getElementById("manualLink");
      manualLink.href = redirect_url;

      setTimeout(() => {
        manualLink.style.display = "inline";
      }, 2000);

      // Redirect after small delay
  window.location.href = redirect_url;
    </script>
  </body>
</html>

 