CoolFace
Apppublic

Deva0718/devi-md-bot

sourceHugging Faceupdated 7mo agoView on Hugging Face
0likes
index.html50 linesDownload Raw Back to public
1<!DOCTYPE html>
2<html>
3<head>
4    <title>Devi MD Dashboard</title>
5    <link rel="stylesheet" href="style.css">
6</head>
7<body>
8<div class="card">
9    <h1>๐Ÿ’– Devi MD โœจ</h1>
10    <div class="info">
11        <p><strong>Status:</strong> <span id="status">Loading...</span></p>
12    </div>
13    <div class="qr-box"><img id="qr" /></div>
14    <textarea id="customMessage" placeholder="Enter custom message..."></textarea>
15    <button id="saveBtn" onclick="save()">Save Settings ๐Ÿ’พ</button>
16</div>
17
18<script>
19async function loadInfo() {
20    const res = await fetch('/info');
21    const data = await res.json();
22    document.getElementById("status").innerText = data.status;
23    document.getElementById("qr").src = data.qrImage;
24    
25    // Only update textarea if user isn't currently typing
26    const msgInput = document.getElementById("customMessage");
27    if (document.activeElement !== msgInput) {
28        msgInput.value = data.settings.customMessage;
29    }
30}
31
32async function save() {
33    const btn = document.getElementById("saveBtn");
34    btn.innerText = "Saving...";
35    await fetch('/save', {
36        method: "POST",
37        headers: {"Content-Type":"application/json"},
38        body: JSON.stringify({
39            customMessage: document.getElementById("customMessage").value
40        })
41    });
42    btn.innerText = "Saved! โœ…";
43    setTimeout(() => { btn.innerText = "Save Settings ๐Ÿ’พ"; }, 2000);
44}
45
46setInterval(loadInfo, 3000);
47loadInfo();
48</script>
49</body>
50</html>