File size: 3,762 Bytes
fb55937
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6db4c75
 
fb55937
aa03cea
6db4c75
fb55937
6db4c75
 
 
 
 
fb55937
6db4c75
 
 
 
 
 
 
 
 
 
 
 
fb55937
6db4c75
 
 
 
 
 
 
 
 
 
 
 
 
fb55937
 
6db4c75
 
 
 
 
 
 
 
 
fb55937
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width,initial-scale=1" />
  <title>EMMYS Gate</title>
  <script src="https://cdn.tailwindcss.com"></script>
  <script defer src="https://unpkg.com/lucide@latest"></script>
  <style>
    body{
      min-height:100vh;color:#fff;
      background:
        linear-gradient(rgba(0,0,0,.68),rgba(0,0,0,.68)),
        url('https://i.pinimg.com/736x/bd/3a/aa/bd3aaa3a2553c8a645472da61fa2a5cc.jpg') center/cover fixed no-repeat;
    }
  </style>
</head>
<body class="flex items-center justify-center p-6">
  <div class="w-full max-w-xl rounded-2xl border border-yellow-200/20 bg-black/50 p-6 backdrop-blur">
    <div class="flex items-center gap-3 mb-4">
      <div class="w-9 h-9 rounded-xl bg-gradient-to-br from-yellow-300 via-yellow-500 to-amber-600 flex items-center justify-center shadow-md">
        <i data-lucide="sparkles" class="w-5 h-5 text-black"></i>
      </div>
      <div>
        <p class="text-xs uppercase tracking-widest text-yellow-300/80">AI WEEK</p>
        <h1 class="text-2xl font-black text-yellow-200">Emmys Gate</h1>
      </div>
    </div>

    <form id="gate" class="space-y-4">
      <div>
        <label class="text-sm text-yellow-200">Username</label>
        <input id="name" required class="mt-1 w-full rounded-lg border border-yellow-200/20 bg-black/40 p-2 outline-none focus:ring-2 focus:ring-yellow-400" placeholder="e.g., robert_downey" />
      </div>
      <div>
        <label class="text-sm text-yellow-200">Face Image</label>
        <input id="image" type="file" accept="image/*" required class="mt-1 w-full text-yellow-100" />
      </div>
      <button id="go" class="px-4 py-2 rounded-xl bg-yellow-400 text-black font-semibold flex items-center gap-2">
        <i data-lucide="shield-check" class="w-4 h-4"></i> Verify & Enter
      </button>
      <div id="msg" class="text-sm mt-2"></div>
    </form>
  </div>

<script>
  lucide.createIcons();

  const VERIFY_URL = "https://hudaakram-emmys-api.hf.space/verify"; 
  const EMMYS_URL  = "./index.html";

  document.getElementById('gate').addEventListener('submit', async (e)=>{
    e.preventDefault();
    const btn = document.getElementById('go');
    const msg = document.getElementById('msg');
    msg.textContent = ""; btn.disabled = true; btn.style.opacity = .6;

    const name = document.getElementById('name').value.trim();
    const file = document.getElementById('image').files[0];
    if(!name || !file){
      msg.textContent = "Please provide username and image.";
      btn.disabled=false; btn.style.opacity=1; return;
    }

    if (!VERIFY_URL || VERIFY_URL.includes("YOUR-BACKEND") || !VERIFY_URL.includes("hf.space")) {
      const score = 0.951;
      location.href = `${EMMYS_URL}?user=${encodeURIComponent(name)}&score=${score.toFixed(3)}`;
      return;
    }

    const fd = new FormData();
    fd.append('name', name);
    fd.append('image', file, file.name);

    try{
      const r = await fetch(VERIFY_URL, { method:'POST', body: fd, mode:'cors' });
      const out = await r.json();
      if(out.decision === "Access Granted"){
        const score = Number(out.score || 0).toFixed(3);
        const token = out.token ? `&token=${encodeURIComponent(out.token)}` : "";
        window.location.href = `${EMMYS_URL}?user=${encodeURIComponent(name)}&score=${score}${token}`;
      }else{
        msg.textContent = `⛔ ${out.decision || "Denied"} — score=${Number(out.score||0).toFixed(3)}`;
        msg.style.color = "#fca5a5";
      }
    }catch(err){
      msg.textContent = `Error: ${err}`;
      msg.style.color = "#fca5a5";
    }finally{
      btn.disabled = false; btn.style.opacity = 1;
    }
  });
</script>

</body>
</html>