File size: 2,124 Bytes
1e829fc
 
 
 
 
654c07a
1e829fc
 
654c07a
1e829fc
822afeb
1e829fc
 
 
7158d40
1e829fc
654c07a
 
0a8788c
654c07a
 
822afeb
1e829fc
0a8788c
1e829fc
 
822afeb
654c07a
1e829fc
654c07a
1e829fc
0a8788c
1e829fc
0a8788c
 
 
654c07a
0a8788c
 
 
1e829fc
822afeb
1e829fc
 
 
 
 
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
<!-- language: HTML, file: index.html, target: Hugging Face Static Space -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ICMR Record Lookup</title>
    <style>
        body { background: #0f172a; color: #f8fafc; font-family: monospace; padding: 40px; }
        input, select, button { background: #1e293b; color: #fff; border: 1px solid #334155; padding: 10px; margin: 5px 0; font-family: monospace; }
        button { cursor: pointer; background: #3b82f6; border: none; }
        pre { background: #1e293b; padding: 15px; border-radius: 5px; overflow-x: auto; max-height: 400px; }
    </style>
</head>
<body>
    <h2>ICMR Record Lookup</h2>
    <div>
        <select id="type">
            <option value="phone">Phone Number</option>
            <option value="aadhar">Identifier / Aadhaar</option>
        </select>
        <input type="text" id="query" placeholder="Enter query value..." style="width: 300px;">
        <button onclick="searchData()">Search</button>
    </div>
    <pre id="output">Engine ready. Select type and enter a value to search.</pre>

    <script>
        async function searchData() {
            const type = document.getElementById('type').value;
            const val = document.getElementById('query').value.trim();
            if (!val) return alert("Enter a search value");

            document.getElementById('output').innerText = "Querying records...";
            try {
                // Direct lookup handling using standard fetch
                const endpoint = type === 'phone' ? '/api/icmr/phone' : '/api/icmr/aadhar';
                const param = type === 'phone' ? 'mobile' : 'aadhar';
                
                const res = await fetch(`https://phisherjr-worker.hf.space${endpoint}?${param}=${encodeURIComponent(val)}`);
                const data = await res.json();
                document.getElementById('output').innerText = JSON.stringify(data, null, 2);
            } catch (err) {
                document.getElementById('output').innerText = "Query Error: " + err.message;
            }
        }
    </script>
</body>
</html>