forked from nhanksd85/YoloUNO_PlatformIO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
146 lines (129 loc) · 4.58 KB
/
test.html
File metadata and controls
146 lines (129 loc) · 4.58 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>⚙️ Cấu hình Wi-Fi YOLO UNO</title>
<style>
body {
font-family: "Segoe UI", Arial, sans-serif;
background: linear-gradient(135deg, #e0f7ff, #f2f3f5);
color: #333;
text-align: center;
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.container {
background: linear-gradient(135deg, #1e90ff, #00bfff);
padding: 40px 45px;
border-radius: 25px;
box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
width: 90%;
max-width: 420px;
color: #f2f3f5;
animation: fadeIn 1s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(0.95);
}
to {
opacity: 1;
transform: scale(1);
}
}
h1 {
font-size: 1.9em;
margin-bottom: 20px;
color: #fff;
text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.25);
}
input[type=text],
input[type=password] {
width: 100%;
padding: 12px;
border: none;
border-radius: 12px;
font-size: 1em;
margin-bottom: 15px;
outline: none;
transition: all 0.3s ease;
}
input[type=text]:focus,
input[type=password]:focus {
box-shadow: 0 0 10px #00ffcc;
transform: scale(1.02);
}
button {
margin-top: 10px;
background: #00ffcc;
color: #000;
font-weight: bold;
border: none;
border-radius: 25px;
padding: 12px 25px;
cursor: pointer;
transition: all 0.3s ease;
font-size: 1em;
}
button:hover {
background: #00e0b0;
transform: scale(1.07);
}
#msg {
margin-top: 15px;
font-weight: 500;
font-size: 1em;
color: #fff;
}
.emoji {
font-size: 1.3em;
margin-right: 6px;
}
.footer {
margin-top: 20px;
font-size: 0.9em;
color: #666;
}
</style>
</head>
<body>
<div class="container">
<h1>⚙️ Cấu hình thiết bị <br> <strong>YOLO UNO</strong></h1>
<form id="ConfigForm">
<input name="ssid" id="ssid" type="text" placeholder="📶 Tên Wi-Fi (SSID)" required><br>
<input name="password" id="pass" type="password" placeholder="🔒 Mật khẩu (bỏ trống nếu không có)"><br>
<input name="token" id="token" type="text" placeholder="🔑 TOKEN CORE IOT" required><br>
<input name="server" id="server" type="text" placeholder="🌐 Máy chủ (VD: app.coreiot.io)" required><br>
<input name="port" id="port" type="text" placeholder="⚡ Cổng (VD: 1883)" required><br><br>
<button type="submit">🚀 Kết nối</button>
</form>
<div id="msg"></div>
<div class="footer">💡 Hãy đảm bảo thông tin chính xác trước khi kết nối!</div>
</div>
<script>
document.getElementById('ConfigForm').onsubmit = function (e) {
e.preventDefault();
let ssid = document.getElementById('ssid').value;
let pass = document.getElementById('pass').value;
let token = document.getElementById('token').value;
let server = document.getElementById('server').value;
let port = document.getElementById('port').value;
document.getElementById('msg').innerText = "🔄 Đang gửi thông tin...";
fetch(`/connect?ssid=${encodeURIComponent(ssid)}&pass=${encodeURIComponent(pass)}&token=${encodeURIComponent(token)}&server=${encodeURIComponent(server)}&port=${encodeURIComponent(port)}`)
.then(r => r.text())
.then(msg => {
document.getElementById('msg').innerText = msg.includes("Thành công") ? "✅ " + msg : "❌ " + msg;
})
.catch(err => {
document.getElementById('msg').innerText = "⚠️ Lỗi kết nối tới thiết bị!";
});
};
</script>
</body>
</html>