-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqr-code.html
More file actions
76 lines (73 loc) · 2.15 KB
/
qr-code.html
File metadata and controls
76 lines (73 loc) · 2.15 KB
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
<!DOCTYPE html>
<html>
<head>
<title>WhatsApp QR Code</title>
<style>
body {
background: #111;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
flex-direction: column;
gap: 20px;
}
h1 {
color: #25D366;
margin: 0;
}
p {
color: #888;
margin: 0;
}
img {
border: 8px solid white;
border-radius: 12px;
}
button {
background: #25D366;
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
}
button:hover {
background: #128C7E;
}
</style>
</head>
<body>
<h1>Scan with WhatsApp</h1>
<p>Open WhatsApp → Linked Devices → Link a Device</p>
<img id="qr" src="" alt="QR Code">
<button onclick="refresh()">Refresh QR Code</button>
<p id="status" style="color: #25D366;"></p>
<script>
async function fetchQR() {
document.getElementById('status').textContent = 'Loading...';
try {
const res = await fetch('http://localhost:8080/instance/connect/lead', {
headers: { 'apikey': 'evo_api_key_secure_2026' }
});
const data = await res.json();
if (data.base64) {
document.getElementById('qr').src = data.base64;
document.getElementById('status').textContent = 'QR Code loaded! Scan now.';
} else {
document.getElementById('status').textContent = 'Error: ' + JSON.stringify(data);
}
} catch (e) {
document.getElementById('status').textContent = 'Error: ' + e.message;
}
}
function refresh() {
fetchQR();
}
fetchQR();
</script>
</body>
</html>