<!DOCTYPE html><!--
Copyright © 2025 David Leadbeater <https://🖐.st>
SPDX-License-Identifier: 0BSD
-->
<meta name="viewport" content="width=device-width">
<title>Verifying connection</title>
<style>
  body { background: #ddd; color: #000; margin: 0; padding: 0; font-family: Arial,Helvetica,sans-serif; }
  #progress { position: absolute; margin: 0; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; font-size: 125%; }
  #progressBar { font-size: 250%; user-select: none; }
  #progressBar.done { transition: font-size 2s linear, opacity 2s linear; font-size: 1000%; opacity: 0.8; }
  #progressLogo { font-weight: bold; margin-bottom: 15px; }
  .animate { animation: spin 2s infinite linear; }
  .animate { --dur: 1.5s; letter-spacing: 20px; color: #f1761b; animation: dotPulse var(--dur) ease-in-out infinite; }
  .animate span { opacity: 0.25; animation: dotPulse var(--dur) ease-in-out infinite; }
  .animate span:nth-child(2) { animation-delay: calc(var(--dur) * 0.15); }
  .animate span:nth-child(3) { animation-delay: calc(var(--dur) * 0.30); }
  @keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.25; }
    40%           { opacity: 1; }
  }
  iframe { display: none; }
  footer { position: fixed; bottom: 4px; width: 100%; text-align: center; }
</style>
<form method="post" target="post" action="/_challenge" name="challenge">
  <input type="hidden" name="ip" value="66.102.9.195">
  <input type="hidden" name="ts" value="1775331162">
  <input type="hidden" name="diff" value="4">
  <input type="hidden" name="tries" value="">
</form>

<div id="progress">
<span id="progressText"></span>
<div id="progressBar"></div>
</div>

<iframe srcdoc="" src="about:blank" name="post"></iframe>
<script>
  "use strict";

  async function challenge(diff, ip, ts) {
    let te = new TextEncoder;
    let tries = 0;
    progressText.innerText = "Verifying your browser before connecting, please wait...";
    progressBar.innerText = '⬤⬤⬤';
    progressBar.className = 'animate';
    for (; tries < 10_000_000; tries++) {
      let hash = await crypto.subtle.digest("SHA-256", te.encode([ip,location.hostname,ts,tries].join(";")));
      let y = new Uint8Array(hash);
      let i = 0;
      while(i < diff/2) {
        if (y[i]>0x0F) break;
        if ((i*2)+1 >= diff) return tries;
        if (y[i++] > 0) break;
        if ((i*2) >= diff) return tries;
      }
    }
  }

  async function startChallenge(form) {
    if (!('subtle' in window.crypto)) {
      if (location.protocol !== 'https:') {
        progress.innerText = 'No WebCrypto support. This must be served over a HTTPS connection.';
      } else {
        progress.innerText = 'No WebCrypto support in your browser. ' +
          'This is required to pass the challenge.';
      }
      return;
    }

    let backoff = 0;
    let tryOnce = _ => {
      if (backoff > 8) {
        progressText.innerText = 'Failed to submit after several tries. Try reloading.';
        return;
      }
      setTimeout(async _ => submitAnswer(form), 1000*(Math.pow(2, backoff++)-1));
    };
    form.addEventListener("error", tryOnce);
    let iframe = document.querySelector("iframe");
    iframe.addEventListener("load", _ => location.hash.length ? location.reload() : location.replace(location));
    tryOnce();
  }

  async function submitAnswer(form) {
    let start = new Date;
    let tries = await challenge(form.diff.value, form.ip.value, form.ts.value);
    if (tries === undefined) {
      progressText.innerText = 'Unable to calculate challenge. Try reloading or a different browser.';
      progressBar.innerText = '🤯';
      progressBar.className = 'error';
      return;
    }
    form.tries.value = tries;
    progressText.innerText = 'Took ' + (new Date - start) + 'ms ' + location;
    console.log(`${tries} tries.\n${progressText.innerText}`);
    progressBar.className = 'done';
    progressBar.innerText = '✅';
    form.submit();
  }

  window.addEventListener("load", _ => startChallenge(document.forms.challenge));
</script>
<noscript>AI scrapers break the web, to use this page you'll need JavaScript enabled.</noscript>
<footer>protected by GreenNet using code from <a href="https://d.cx/haphash" target="_new">haphash</a></footer>
