Update se_mes_im.html
Browse files- se_mes_im.html +126 -120
se_mes_im.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title
|
| 7 |
<style>
|
| 8 |
body {
|
| 9 |
font-family: Arial, sans-serif;
|
|
@@ -21,37 +21,22 @@
|
|
| 21 |
}
|
| 22 |
.input-row {
|
| 23 |
display: flex;
|
| 24 |
-
|
|
|
|
| 25 |
gap: 10px;
|
| 26 |
margin-top: 20px;
|
| 27 |
}
|
| 28 |
-
.input-row input, .input-row textarea {
|
|
|
|
| 29 |
padding: 10px;
|
| 30 |
font-size: 16px;
|
| 31 |
border: 1px solid #ccc;
|
| 32 |
border-radius: 5px;
|
| 33 |
}
|
| 34 |
-
|
| 35 |
-
width:
|
| 36 |
-
margin-top: 20px;
|
| 37 |
-
}
|
| 38 |
-
#progressBarContainer {
|
| 39 |
-
width: 80%;
|
| 40 |
-
margin: 20px auto;
|
| 41 |
-
}
|
| 42 |
-
#progressBar {
|
| 43 |
-
width: 100%;
|
| 44 |
-
background-color: #ddd;
|
| 45 |
}
|
| 46 |
-
#
|
| 47 |
-
width: 0%;
|
| 48 |
-
height: 30px;
|
| 49 |
-
background-color: #4CAF50;
|
| 50 |
-
text-align: center;
|
| 51 |
-
line-height: 30px;
|
| 52 |
-
color: white;
|
| 53 |
-
}
|
| 54 |
-
#sendButton {
|
| 55 |
color: white;
|
| 56 |
background-color: #4CAF50;
|
| 57 |
border: none;
|
|
@@ -59,123 +44,144 @@
|
|
| 59 |
padding: 10px 20px;
|
| 60 |
font-size: 16px;
|
| 61 |
border-radius: 5px;
|
| 62 |
-
margin-top:
|
| 63 |
}
|
| 64 |
-
#
|
| 65 |
background-color: #388E3C;
|
| 66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
</style>
|
| 68 |
</head>
|
| 69 |
<body>
|
| 70 |
-
<h1
|
|
|
|
| 71 |
<div class="input-row">
|
| 72 |
-
<
|
| 73 |
-
<input type="
|
| 74 |
-
<input type="number" id="maxDelayInput" placeholder="Max Delay (ms)" value="1000">
|
| 75 |
</div>
|
| 76 |
-
|
| 77 |
-
<
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
<div id="progressBar">
|
| 81 |
-
<div id="progress">0%</div>
|
| 82 |
-
</div>
|
| 83 |
</div>
|
| 84 |
-
<input type="file" id="fileInput" accept=".txt">
|
| 85 |
-
<button id="sendButton">Запустить рассылку</button>
|
| 86 |
|
| 87 |
-
<
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
const fileName = document.getElementById('fileNameInput').value;
|
| 92 |
-
const message = document.getElementById('messageInput').value;
|
| 93 |
-
const minDelay = parseInt(document.getElementById('minDelayInput').value) || 500;
|
| 94 |
-
const maxDelay = parseInt(document.getElementById('maxDelayInput').value) || 10000;
|
| 95 |
-
|
| 96 |
-
if (!apiKey) {
|
| 97 |
-
alert('Please enter your API key.');
|
| 98 |
-
return;
|
| 99 |
-
}
|
| 100 |
-
if (!urlFile) {
|
| 101 |
-
alert('Please enter the URL of the file.');
|
| 102 |
-
return;
|
| 103 |
-
}
|
| 104 |
-
if (!fileName) {
|
| 105 |
-
alert('Please enter the file name.');
|
| 106 |
-
return;
|
| 107 |
-
}
|
| 108 |
-
if (!message) {
|
| 109 |
-
alert('Please enter a message.');
|
| 110 |
-
return;
|
| 111 |
-
}
|
| 112 |
-
if (minDelay >= maxDelay) {
|
| 113 |
-
alert('Min delay must be less than max delay.');
|
| 114 |
-
return;
|
| 115 |
-
}
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
|
| 128 |
-
const text = event.target.result;
|
| 129 |
-
const phones = text.split('\n').map(phone => phone.trim()).filter(phone => phone);
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
});
|
| 136 |
|
| 137 |
-
|
| 138 |
-
const
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
chatId: `${phone}@c.us`,
|
| 152 |
-
urlFile: urlFile,
|
| 153 |
-
fileName: fileName,
|
| 154 |
-
caption: message
|
| 155 |
-
})
|
| 156 |
-
});
|
| 157 |
-
|
| 158 |
-
if (!response.ok) {
|
| 159 |
-
throw new Error(`HTTP error! status: ${response.status}`);
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
const data = await response.json();
|
| 163 |
-
console.log(`Message sent to ${phone}:`, data);
|
| 164 |
-
|
| 165 |
-
} catch (error) {
|
| 166 |
-
console.error(`Error sending message to ${phone}:`, error);
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
const progress = ((i + 1) / totalPhones) * 100;
|
| 170 |
-
progressBar.style.width = `${progress}%`;
|
| 171 |
-
progressBar.textContent = `${progress.toFixed(2)}%`;
|
| 172 |
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
|
|
|
| 177 |
}
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
</script>
|
| 180 |
</body>
|
| 181 |
</html>
|
|
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Комменты Бизон 365</title>
|
| 7 |
<style>
|
| 8 |
body {
|
| 9 |
font-family: Arial, sans-serif;
|
|
|
|
| 21 |
}
|
| 22 |
.input-row {
|
| 23 |
display: flex;
|
| 24 |
+
flex-direction: column;
|
| 25 |
+
align-items: center;
|
| 26 |
gap: 10px;
|
| 27 |
margin-top: 20px;
|
| 28 |
}
|
| 29 |
+
.input-row label, .input-row input, .input-row select, .input-row textarea {
|
| 30 |
+
width: 80%;
|
| 31 |
padding: 10px;
|
| 32 |
font-size: 16px;
|
| 33 |
border: 1px solid #ccc;
|
| 34 |
border-radius: 5px;
|
| 35 |
}
|
| 36 |
+
.input-row input[type="number"] {
|
| 37 |
+
max-width: 100px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
}
|
| 39 |
+
#sendRequestButton, #sendGetRequestButton {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
color: white;
|
| 41 |
background-color: #4CAF50;
|
| 42 |
border: none;
|
|
|
|
| 44 |
padding: 10px 20px;
|
| 45 |
font-size: 16px;
|
| 46 |
border-radius: 5px;
|
| 47 |
+
margin-top: 10px;
|
| 48 |
}
|
| 49 |
+
#sendRequestButton:hover, #sendGetRequestButton:hover {
|
| 50 |
background-color: #388E3C;
|
| 51 |
}
|
| 52 |
+
.dropdown-container {
|
| 53 |
+
margin-top: 20px;
|
| 54 |
+
width: 80%;
|
| 55 |
+
display: flex;
|
| 56 |
+
justify-content: center;
|
| 57 |
+
}
|
| 58 |
+
select {
|
| 59 |
+
background-color: #e8f5e9;
|
| 60 |
+
}
|
| 61 |
</style>
|
| 62 |
</head>
|
| 63 |
<body>
|
| 64 |
+
<h1>Комменты Бизон 365</h1>
|
| 65 |
+
|
| 66 |
<div class="input-row">
|
| 67 |
+
<label for="tokenInput">Enter Token:</label>
|
| 68 |
+
<input type="text" id="tokenInput" placeholder="Your Token">
|
|
|
|
| 69 |
</div>
|
| 70 |
+
|
| 71 |
+
<div class="input-row">
|
| 72 |
+
<label for="dateSelect">Select Min Date:</label>
|
| 73 |
+
<input type="datetime-local" id="dateSelect">
|
|
|
|
|
|
|
|
|
|
| 74 |
</div>
|
|
|
|
|
|
|
| 75 |
|
| 76 |
+
<div class="input-row">
|
| 77 |
+
<label for="maxDateSelect">Select Max Date:</label>
|
| 78 |
+
<input type="datetime-local" id="maxDateSelect">
|
| 79 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
+
<div class="input-row">
|
| 82 |
+
<label for="limitInput">Limit:</label>
|
| 83 |
+
<input type="number" id="limitInput" value="20" min="1" max="100">
|
| 84 |
+
</div>
|
| 85 |
|
| 86 |
+
<div class="input-row">
|
| 87 |
+
<label for="typeSelect">Type:</label>
|
| 88 |
+
<select id="typeSelect">
|
| 89 |
+
<option value="LiveWebinars">Live Webinars</option>
|
| 90 |
+
<option value="AutoWebinars">Auto Webinars</option>
|
| 91 |
+
</select>
|
| 92 |
+
</div>
|
| 93 |
|
| 94 |
+
<div class="input-row">
|
| 95 |
+
<button id="sendRequestButton">Send Request</button>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<div class="input-row">
|
| 99 |
+
<textarea id="responseArea" rows="10" cols="50" readonly></textarea>
|
| 100 |
+
</div>
|
| 101 |
|
| 102 |
+
<div class="dropdown-container" id="dropdown-container"></div>
|
|
|
|
|
|
|
| 103 |
|
| 104 |
+
<div class="input-row">
|
| 105 |
+
<button id="sendGetRequestButton">Send GET Request</button>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
<div class="input-row">
|
| 109 |
+
<textarea id="secondResponseArea" rows="10" cols="50" readonly></textarea>
|
| 110 |
+
</div>
|
| 111 |
|
| 112 |
+
<script>
|
| 113 |
+
document.getElementById('sendRequestButton').addEventListener('click', function() {
|
| 114 |
+
const token = document.getElementById('tokenInput').value;
|
| 115 |
+
const minDate = document.getElementById('dateSelect').value;
|
| 116 |
+
const maxDate = document.getElementById('maxDateSelect').value;
|
| 117 |
+
const limit = document.getElementById('limitInput').value;
|
| 118 |
+
const type = document.getElementById('typeSelect').value;
|
| 119 |
+
|
| 120 |
+
const url = '/send_request';
|
| 121 |
+
const params = new URLSearchParams();
|
| 122 |
+
params.append('token', token);
|
| 123 |
+
params.append('minDate', minDate);
|
| 124 |
+
params.append('maxDate', maxDate);
|
| 125 |
+
params.append('limit', limit);
|
| 126 |
+
params.append('type', type);
|
| 127 |
+
|
| 128 |
+
fetch(url, {
|
| 129 |
+
method: 'POST',
|
| 130 |
+
headers: {
|
| 131 |
+
'Content-Type': 'application/x-www-form-urlencoded'
|
| 132 |
+
},
|
| 133 |
+
body: params.toString()
|
| 134 |
+
})
|
| 135 |
+
.then(response => response.json())
|
| 136 |
+
.then(data => {
|
| 137 |
+
console.log('JSON Response:', data);
|
| 138 |
+
document.getElementById('responseArea').value = JSON.stringify(data, null, 2);
|
| 139 |
+
createDropdown(data);
|
| 140 |
+
})
|
| 141 |
+
.catch(error => {
|
| 142 |
+
console.error('Error:', error);
|
| 143 |
+
document.getElementById('responseArea').value = 'Error: ' + error.message;
|
| 144 |
+
});
|
| 145 |
});
|
| 146 |
|
| 147 |
+
function createDropdown(data) {
|
| 148 |
+
const container = document.getElementById('dropdown-container');
|
| 149 |
+
container.innerHTML = ''; // Очистить контейнер перед добавлением нового списка
|
| 150 |
+
const select = document.createElement('select');
|
| 151 |
+
select.id = 'dropdown';
|
| 152 |
+
select.style.backgroundColor = '#e8f5e9'; // Зеленый фон для выпадающего списка
|
| 153 |
+
data.forEach(item => {
|
| 154 |
+
const option = document.createElement('option');
|
| 155 |
+
option.value = item;
|
| 156 |
+
option.text = item;
|
| 157 |
+
select.appendChild(option);
|
| 158 |
+
});
|
| 159 |
+
container.appendChild(select);
|
| 160 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
|
| 162 |
+
document.getElementById('sendGetRequestButton').addEventListener('click', function() {
|
| 163 |
+
const selectedValue = document.getElementById('dropdown')?.value;
|
| 164 |
+
if (!selectedValue) {
|
| 165 |
+
alert('Please select a webinar from the dropdown.');
|
| 166 |
+
return;
|
| 167 |
}
|
| 168 |
+
const token = document.getElementById('tokenInput').value;
|
| 169 |
+
const getUrl = `/send_get_request?token=${encodeURIComponent(token)}&webinarId=${encodeURIComponent(selectedValue)}`;
|
| 170 |
+
|
| 171 |
+
fetch(getUrl, {
|
| 172 |
+
method: 'GET'
|
| 173 |
+
})
|
| 174 |
+
.then(response => response.json())
|
| 175 |
+
.then(data => {
|
| 176 |
+
console.log('GET Response:', data);
|
| 177 |
+
document.getElementById('secondResponseArea').value = JSON.stringify(data, null, 2);
|
| 178 |
+
})
|
| 179 |
+
.catch(error => {
|
| 180 |
+
console.error('Error:', error);
|
| 181 |
+
document.getElementById('secondResponseArea').value = 'Error: ' + error.message;
|
| 182 |
+
});
|
| 183 |
+
});
|
| 184 |
</script>
|
| 185 |
</body>
|
| 186 |
</html>
|
| 187 |
+
|