Download test_send.html from eg-art/up_fail: direct link, hf CLI and curl.
- Browser
- Download file 3.66 kB
-
https://huggingface.co/spaces/eg-art/up_fail/resolve/main/test_send.html
- Command line
-
hf download hf://spaces/eg-art/up_fail/test_send.html
-
curl -L -o test_send.html https://huggingface.co/spaces/eg-art/up_fail/resolve/main/test_send.html
3.66 kB
| <html lang="ru"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Автоотправка запросов</title> | |
| <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <!-- Подключаем SweetAlert2 --> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| text-align: center; | |
| padding: 20px; | |
| } | |
| input, button { | |
| margin: 10px; | |
| padding: 10px; | |
| font-size: 16px; | |
| } | |
| #counter { | |
| font-size: 20px; | |
| font-weight: bold; | |
| color: green; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h2>Отправка запросов</h2> | |
| <label>URL запроса:</label> | |
| <input type="text" id="requestUrl" placeholder="Введите URL"> | |
| <br> | |
| <label>Задержка (мс):</label> | |
| <input type="number" id="delayTime" value="500" min="100"> | |
| <br> | |
| <button id="startBtn">Старт</button> | |
| <button id="stopBtn">Стоп</button> | |
| <br> | |
| <p>Отправлено запросов: <span id="counter">0</span></p> | |
| <script> | |
| let intervalId = null; // Переменная для хранения ID интервала | |
| let count = 0; // Счётчик запросов | |
| document.getElementById("startBtn").addEventListener("click", function () { | |
| const url = document.getElementById("requestUrl").value.trim(); | |
| let delay = parseInt(document.getElementById("delayTime").value, 10); | |
| if (!url) { | |
| Swal.fire("Ошибка", "Введите URL для отправки запросов!", "error"); | |
| return; | |
| } | |
| if (isNaN(delay) || delay < 100) { | |
| Swal.fire("Ошибка", "Минимальная задержка 100 мс!", "error"); | |
| return; | |
| } | |
| count = 0; // Сбрасываем счётчик | |
| document.getElementById("counter").textContent = count; | |
| Swal.fire({ | |
| title: "Запросы запущены!", | |
| text: `Будут отправляться каждые ${delay} мс.`, | |
| icon: "success", | |
| timer: 2000, | |
| showConfirmButton: false | |
| }); | |
| // Запускаем отправку запросов по таймеру | |
| intervalId = setInterval(() => { | |
| fetch(url, { method: "GET" }) | |
| .then(response => { | |
| if (!response.ok) throw new Error("Ошибка запроса"); | |
| return response.text(); | |
| }) | |
| .then(data => { | |
| console.log("Ответ сервера:", data); | |
| count++; | |
| document.getElementById("counter").textContent = count; | |
| }) | |
| .catch(error => { | |
| console.error("Ошибка:", error); | |
| Swal.fire("Ошибка", "Не удалось отправить запрос!", "error"); | |
| }); | |
| }, delay); | |
| }); | |
| document.getElementById("stopBtn").addEventListener("click", function () { | |
| if (intervalId) { | |
| clearInterval(intervalId); | |
| intervalId = null; | |
| Swal.fire("Остановлено", "Запросы больше не отправляются", "info"); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> | |