Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
a222113
1
Parent(s):
6723e97
Update settings.html
Browse files- settings.html +127 -402
settings.html
CHANGED
@@ -1,415 +1,140 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
-
<head>
|
4 |
-
<meta charset="utf-8" />
|
5 |
-
<meta name="viewport" content="width=device-width" />
|
6 |
-
<link rel="icon" type="image/ico" href="https://huggingface.co/spaces/igs-img/stor/resolve/main/list.ico">
|
7 |
-
<title>My static Space</title>
|
8 |
-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
}
|
17 |
-
|
18 |
-
input[type="number"] {
|
19 |
-
-moz-appearance: textfield;
|
20 |
-
}
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
</head>
|
26 |
<body>
|
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 |
-
<div class="card-body">
|
108 |
-
<h4>EC доз. A_ON sec.</h4>
|
109 |
-
<p>EEPROM : <span id="ec_A_eep"></span></p>
|
110 |
-
|
111 |
-
<form>
|
112 |
-
<label for="ec_A_set">Новое : </label>
|
113 |
-
<input type="number" id="ec_A_set" value="1.5" min="0.1" max="20" step="0.01">
|
114 |
-
</form>
|
115 |
-
</div>
|
116 |
-
<div class="card-footer">
|
117 |
-
<button id="ec_A_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
|
118 |
-
</div>
|
119 |
-
</div>
|
120 |
-
<div class="card">
|
121 |
-
|
122 |
-
<div class="card-body">
|
123 |
-
<h4>EC доз. B_ON sec.</h4>
|
124 |
-
<p>EEPROM : <span id="ec_B_eep"></span></p>
|
125 |
-
|
126 |
-
<form>
|
127 |
-
<label for="ec_B_set">Новое : </label>
|
128 |
-
<input type="number" id="ec_B_set" value="1.5" min="0.1" max="20" step="0.01">
|
129 |
-
</form>
|
130 |
-
</div>
|
131 |
-
<div class="card-footer">
|
132 |
-
<button id="ec_B_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
|
133 |
-
</div>
|
134 |
-
</div>
|
135 |
-
<div class="card">
|
136 |
-
|
137 |
-
<div class="card-body">
|
138 |
-
<h4>EC доз. C_ON sec.</h4>
|
139 |
-
<p>EEPROM : <span id="ec_C_eep"></span></p>
|
140 |
-
|
141 |
-
<form>
|
142 |
-
<label for="ec_C_set">Новое : </label>
|
143 |
-
<input type="number" id="ec_C_set" value="1.5" min="0.1" max="20" step="0.01">
|
144 |
-
</form>
|
145 |
-
</div>
|
146 |
-
<div class="card-footer">
|
147 |
-
<button id="ec_C_set_but" type="button" class="btn btn-success btn-lg">Записать</button>
|
148 |
-
</div>
|
149 |
-
</div>
|
150 |
-
</div>
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
<br>
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
<div class="card-deck">
|
159 |
-
<div class="card">
|
160 |
-
|
161 |
-
<div class="card-body">
|
162 |
-
<h4>Свет ON </h4>
|
163 |
-
<p>EEPROM: <span id="l_ON_h_eep"></span> : <span id="l_ON_m_eep"></span></p>
|
164 |
-
<form>
|
165 |
-
<label for="l_ON_h_set">Новое h : </label>
|
166 |
-
<input type="number" id="l_ON_h_set" value="12" min="0" max="23" step="1">
|
167 |
-
</form>
|
168 |
-
<form>
|
169 |
-
<label for="l_ON_m_set">Новое m : </label>
|
170 |
-
<input type="number" id="l_ON_m_set" value="30" min="0" max="59" step="1">
|
171 |
-
</form>
|
172 |
-
</div>
|
173 |
-
<div class="card-footer">
|
174 |
-
<button id="l_ON_set" type="button" class="btn btn-success btn-lg">Записать</button>
|
175 |
-
</div>
|
176 |
-
</div>
|
177 |
-
<div class="card">
|
178 |
-
|
179 |
-
<div class="card-body">
|
180 |
-
<h4>Свет OFF </h4>
|
181 |
-
<p>EEPROM: <span id="l_OFF_h_eep"></span> : <span id="l_OFF_m_eep"></span></p>
|
182 |
-
<form>
|
183 |
-
<label for="l_OFF_h_set">Новое h : </label>
|
184 |
-
<input type="number" id="l_OFF_h_set" value="12" min="0" max="23" step="1">
|
185 |
-
</form>
|
186 |
-
<form>
|
187 |
-
<label for="l_OFF_m_set">Новое m : </label>
|
188 |
-
<input type="number" id="l_OFF_m_set" value="30" min="0" max="59" step="1">
|
189 |
-
</form>
|
190 |
-
</div>
|
191 |
-
<div class="card-footer">
|
192 |
-
<button id="l_OFF_set" type="button" class="btn btn-success btn-lg">Записать</button>
|
193 |
-
</div>
|
194 |
-
</div>
|
195 |
-
<div class="card">
|
196 |
-
|
197 |
-
<div class="card-body">
|
198 |
-
<h4>Тем. воздуха</h4>
|
199 |
-
<p>EEPROM : <span id="t_Voz_eep"></span></p>
|
200 |
-
|
201 |
-
<form>
|
202 |
-
<label for="t_Voz_eep_set">Новое : </label>
|
203 |
-
<input type="number" id="t_Voz_eep_set" value="25" min="10" max="40" step="1">
|
204 |
-
</form>
|
205 |
-
</div>
|
206 |
-
<div class="card-footer">
|
207 |
-
<button id="t_Voz_set" type="button" class="btn btn-success btn-lg">Записать</button>
|
208 |
-
</div>
|
209 |
-
</div>
|
210 |
-
</div>
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
<br><br><br><br>
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
</div>
|
219 |
-
|
220 |
-
|
221 |
-
<script>
|
222 |
-
document.getElementById("st_onl").addEventListener("click", function() {
|
223 |
-
// Получаем основной URL без пути и параметров
|
224 |
-
var baseUrl = window.location.origin;
|
225 |
-
// Добавляем необходимый путь к основному URL
|
226 |
-
var targetUrl = baseUrl + "/online";
|
227 |
-
// Переходим по сформированному URL
|
228 |
-
window.location.href = targetUrl;
|
229 |
-
});
|
230 |
-
</script>
|
231 |
-
<script>
|
232 |
-
document.getElementById("st_set").addEventListener("click", function() {
|
233 |
-
// Получаем основной URL без пути и параметров
|
234 |
-
var baseUrl = window.location.origin;
|
235 |
-
// Добавляем необходимый путь к основному URL
|
236 |
-
var targetUrl = baseUrl + "/settings";
|
237 |
-
// Переходим по сформированному URL
|
238 |
-
window.location.href = targetUrl;
|
239 |
-
});
|
240 |
-
</script>
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
<script>
|
253 |
-
// Функция, которая будет выполняться при загрузке страницы
|
254 |
-
window.onload = function() {
|
255 |
-
// Создаем запрос
|
256 |
-
var xhr = new XMLHttpRequest();
|
257 |
-
xhr.open("GET", "/set_res", true);
|
258 |
-
// Отправляем запрос
|
259 |
-
xhr.send();
|
260 |
-
};
|
261 |
-
</script>
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
<script>
|
274 |
-
|
275 |
-
|
276 |
-
function updateValues(data) {
|
277 |
-
document.getElementById("pH_eep").textContent = data.ph_eep;
|
278 |
-
document.getElementById("ph_on_eep").textContent = data.ph_on_eep;
|
279 |
-
document.getElementById("ec_eep").textContent = data.ec_eep;
|
280 |
-
document.getElementById("ec_A_eep").textContent = data.ec_A_eep;
|
281 |
-
document.getElementById("ec_B_eep").textContent = data.ec_B_eep;
|
282 |
-
document.getElementById("ec_C_eep").textContent = data.ec_C_eep;
|
283 |
-
document.getElementById("l_ON_h_eep").textContent = data.l_ON_h_eep;
|
284 |
-
document.getElementById("l_ON_m_eep").textContent = data.l_ON_m_eep;
|
285 |
-
document.getElementById("l_OFF_h_eep").textContent = data.l_OFF_h_eep;
|
286 |
-
document.getElementById("l_OFF_m_eep").textContent = data.l_OFF_m_eep;
|
287 |
-
document.getElementById("t_Voz_eep").textContent = data.t_Voz_eep;
|
288 |
-
|
289 |
-
}
|
290 |
-
|
291 |
-
function fetchValues() {
|
292 |
-
var xhr = new XMLHttpRequest();
|
293 |
-
xhr.open("GET", "/settings_api", true);
|
294 |
-
xhr.setRequestHeader("Content-Type", "application/json");
|
295 |
-
xhr.onreadystatechange = function () {
|
296 |
-
if (xhr.readyState === 4 && xhr.status === 200) {
|
297 |
-
var response = JSON.parse(xhr.responseText);
|
298 |
-
updateValues(response);
|
299 |
}
|
300 |
-
};
|
301 |
-
xhr.send();
|
302 |
-
}
|
303 |
-
|
304 |
-
fetchValues();
|
305 |
-
setInterval(fetchValues, 10000);
|
306 |
-
</script>
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
<script>
|
318 |
-
document.getElementById("pH_set_but").addEventListener("click", function() {
|
319 |
-
var pHValue = document.getElementById("pH_set").value;
|
320 |
-
var xhr = new XMLHttpRequest();
|
321 |
-
xhr.open("GET", "/pH_set?value=" + pHValue, true);
|
322 |
-
xhr.send();
|
323 |
-
});
|
324 |
-
</script>
|
325 |
-
|
326 |
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
document.getElementById("ec_A_set_but").addEventListener("click", function() {
|
348 |
-
var ec_A_setValue = document.getElementById("ec_A_set").value;
|
349 |
-
var xhr = new XMLHttpRequest();
|
350 |
-
xhr.open("GET", "/ec_A_set?value=" + ec_A_setValue, true);
|
351 |
-
xhr.send();
|
352 |
-
});
|
353 |
-
</script>
|
354 |
-
|
355 |
-
|
356 |
-
<script>
|
357 |
-
document.getElementById("ec_B_set_but").addEventListener("click", function() {
|
358 |
-
var ec_B_setValue = document.getElementById("ec_B_set").value;
|
359 |
-
var xhr = new XMLHttpRequest();
|
360 |
-
xhr.open("GET", "/ec_B_set?value=" + ec_B_setValue, true);
|
361 |
-
xhr.send();
|
362 |
-
});
|
363 |
-
</script>
|
364 |
-
|
365 |
-
|
366 |
-
<script>
|
367 |
-
document.getElementById("ec_C_set_but").addEventListener("click", function() {
|
368 |
-
var ec_C_setValue = document.getElementById("ec_C_set").value;
|
369 |
-
var xhr = new XMLHttpRequest();
|
370 |
-
xhr.open("GET", "/ec_C_set?value=" + ec_C_setValue, true);
|
371 |
-
xhr.send();
|
372 |
-
});
|
373 |
-
</script>
|
374 |
-
|
375 |
-
<script>
|
376 |
-
document.getElementById("ec_C_set_but").addEventListener("click", function() {
|
377 |
-
var ec_C_setValue = document.getElementById("ec_C_set").value;
|
378 |
-
var xhr = new XMLHttpRequest();
|
379 |
-
xhr.open("GET", "/ec_C_set?value=" + ec_C_setValue, true);
|
380 |
-
xhr.send();
|
381 |
-
});
|
382 |
-
</script>
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
<script>
|
387 |
-
document.getElementById("l_ON_set").addEventListener("click", function() {
|
388 |
-
var l_ON_h_set = document.getElementById("l_ON_h_set").value;
|
389 |
-
var l_ON_m_set = document.getElementById("l_ON_m_set").value;
|
390 |
-
var xhr = new XMLHttpRequest();
|
391 |
-
xhr.open("GET", "/l_ON_set?l_ON_h_set=" + l_ON_h_set + "&l_ON_m_set=" + l_ON_m_set, true);
|
392 |
-
xhr.send();
|
393 |
-
});
|
394 |
-
</script>
|
395 |
|
396 |
-
<script>
|
397 |
-
document.getElementById("l_OFF_set").addEventListener("click", function() {
|
398 |
-
var l_OFF_h_set = document.getElementById("l_OFF_h_set").value;
|
399 |
-
var l_OFF_m_set = document.getElementById("l_OFF_m_set").value;
|
400 |
-
var xhr = new XMLHttpRequest();
|
401 |
-
xhr.open("GET", "/l_OFF_set?l_OFF_h_set=" + l_OFF_h_set + "&l_OFF_m_set=" + l_OFF_m_set, true);
|
402 |
-
xhr.send();
|
403 |
-
});
|
404 |
-
</script>
|
405 |
-
|
406 |
-
<script>
|
407 |
-
document.getElementById("t_Voz_set").addEventListener("click", function() {
|
408 |
-
var t_Voz_eep_set = document.getElementById("t_Voz_eep_set").value;
|
409 |
-
var xhr = new XMLHttpRequest();
|
410 |
-
xhr.open("GET", "/t_Voz_eep_set?value=" + t_Voz_eep_set, true);
|
411 |
-
xhr.send();
|
412 |
-
});
|
413 |
-
</script>
|
414 |
</body>
|
|
|
415 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
<head>
|
5 |
+
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
6 |
+
<meta content="utf-8" http-equiv="encoding">
|
7 |
+
<style>
|
8 |
+
.button {
|
9 |
+
border: none;
|
10 |
+
color: white;
|
11 |
+
padding: 16px 32px;
|
12 |
+
text-align: center;
|
13 |
+
text-decoration: none;
|
14 |
+
display: inline-block;
|
15 |
+
font-size: 16px;
|
16 |
+
margin: 4px 2px;
|
17 |
+
transition-duration: 0.4s;
|
18 |
+
cursor: pointer;
|
19 |
+
}
|
20 |
|
21 |
+
.buttonGreen {
|
22 |
+
background-color: white;
|
23 |
+
color: black;
|
24 |
+
border: 2px solid #4CAF50;
|
25 |
+
}
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
.buttonGreen:hover {
|
28 |
+
background-color: #4CAF50;
|
29 |
+
color: white;
|
30 |
+
}
|
31 |
+
</style>
|
32 |
+
</head>
|
33 |
|
|
|
|
|
34 |
<body>
|
35 |
|
36 |
+
<h1>WhatsApp client browser example</h1>
|
37 |
+
|
38 |
+
<form>
|
39 |
+
<label for="idInstance">Id Instance:</label><br>
|
40 |
+
<input required type="text" id="idInstance" name="idInstance"><br>
|
41 |
+
<label for="apiTokenIsntance">API Token:</label><br>
|
42 |
+
<input required type="text" id="apiTokenIsntance" name="apiTokenIsntance"><br>
|
43 |
+
</form>
|
44 |
+
|
45 |
+
<p style="color:blue" id="statusText"></p>
|
46 |
+
<p style="color:blue" id="resultText"></p>
|
47 |
+
<p>Press button to get qr code</p>
|
48 |
+
<div style="display:grid; width: 20%">
|
49 |
+
<button id="getQrBtn" class="button buttonGreen">Get QR</button>
|
50 |
+
<button style="display: none" hidden id="logoutQrBtn" class="button buttonGreen">Logout</button>
|
51 |
+
<img hidden id="img-qr-code" alt="QR-Code" class="sb-qr-wizard-qr-code" aria-hidden="false" src="data:image/png;base64,%QR_DATA%" style="">
|
52 |
+
</div>
|
53 |
+
<script type="text/javascript" src="https://unpkg.com/@green-api/whatsapp-api-client/lib/whatsapp-api-client.min.js"></script>
|
54 |
+
<script>
|
55 |
+
var intervalId = null
|
56 |
+
const qrCodeElement = document.getElementById("img-qr-code")
|
57 |
+
const qrTempalte = qrCodeElement.getAttribute('src');
|
58 |
+
|
59 |
+
document.getElementById("getQrBtn").addEventListener("click", function () {
|
60 |
+
try {
|
61 |
+
isAuthed();
|
62 |
+
clearInterval(intervalId)
|
63 |
+
updateQRCode()
|
64 |
+
intervalId = setInterval(updateQRCode, 5000);
|
65 |
+
|
66 |
+
} catch (reason) {
|
67 |
+
console.error(reason);
|
68 |
+
document.getElementById("resultText").innerHTML = reason + ". See logs for details";
|
69 |
+
}
|
70 |
+
});
|
71 |
+
|
72 |
+
document.getElementById("logoutQrBtn").addEventListener("click", function () {
|
73 |
+
try {
|
74 |
+
const restAPI = whatsAppClient.restAPI(({
|
75 |
+
idInstance: document.getElementById("idInstance").value,
|
76 |
+
apiTokenInstance: document.getElementById("apiTokenIsntance").value
|
77 |
+
}))
|
78 |
+
|
79 |
+
restAPI.instance.logout()
|
80 |
+
.then((data) => {
|
81 |
+
document.getElementById("resultText").innerHTML = "isLogout=" + data.isLogout
|
82 |
+
isAuthed();
|
83 |
+
}).catch((reason) => {
|
84 |
+
console.error(reason);
|
85 |
+
document.getElementById("resultText").innerHTML = reason + ". See logs for details";
|
86 |
+
});
|
87 |
+
} catch (reason) {
|
88 |
+
console.error(reason);
|
89 |
+
document.getElementById("resultText").innerHTML = reason + ". See logs for details";
|
90 |
+
}
|
91 |
+
});
|
92 |
+
|
93 |
+
function updateQRCode() {
|
94 |
+
const restAPI = whatsAppClient.restAPI(({
|
95 |
+
idInstance: document.getElementById("idInstance").value,
|
96 |
+
apiTokenInstance: document.getElementById("apiTokenIsntance").value
|
97 |
+
}))
|
98 |
+
restAPI.instance.qr()
|
99 |
+
.then((data) => {
|
100 |
+
console.log(data);
|
101 |
+
document.getElementById("resultText").innerHTML = "";
|
102 |
+
if (data.type === 'qrCode') {
|
103 |
+
qrCodeElement.hidden = false;
|
104 |
+
qrCodeElement.setAttribute('src', qrTempalte.replace("%QR_DATA%", data.message))
|
105 |
+
} else {
|
106 |
+
qrCodeElement.hidden = true;
|
107 |
+
clearInterval(intervalId)
|
108 |
+
isAuthed();
|
109 |
+
document.getElementById("resultText").innerHTML = data.message
|
110 |
+
}
|
111 |
+
}).catch((reason) => {
|
112 |
+
console.error(reason);
|
113 |
+
document.getElementById("resultText").innerHTML = reason + ". See logs for details";
|
114 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
+
function isAuthed() {
|
118 |
+
const restAPI = whatsAppClient.restAPI(({
|
119 |
+
idInstance: document.getElementById("idInstance").value,
|
120 |
+
apiTokenInstance: document.getElementById("apiTokenIsntance").value
|
121 |
+
}))
|
122 |
+
restAPI.instance.getStateInstance().then(data => {
|
123 |
+
document.getElementById("statusText").innerHTML = data.stateInstance;
|
124 |
+
|
125 |
+
if (data.stateInstance === 'authorized') {
|
126 |
+
document.getElementById("getQrBtn").style.display = "none"
|
127 |
+
document.getElementById("logoutQrBtn").style.display = "block"
|
128 |
+
} else {
|
129 |
+
document.getElementById("getQrBtn").style.display = "block"
|
130 |
+
document.getElementById("logoutQrBtn").style.display = "none"
|
131 |
+
}
|
132 |
+
|
133 |
+
|
134 |
+
})
|
135 |
+
}
|
136 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
</body>
|
139 |
+
|
140 |
</html>
|