Pavel Loginov 4 years ago
parent 97a54204e8
commit f863aa9e42

@ -3099,3 +3099,8 @@ if form.getvalue('loadopenvpn'):
openvpn_sess=openvpn_sess,
openvpn_configs=openvpn_configs)
print(template)
if form.getvalue('check_telegram'):
telegram_id = form.getvalue('check_telegram')
mess = 'Test message from HAProxy-WI'
funct.telegram_send_mess(mess, telegram_channel_id=telegram_id)

@ -7,10 +7,11 @@
<td class="padding10 first-collumn" style="width: 25%;">
<span title="Token that has given @father_bot">Token</span>
</td>
<td style="width: {% if page == "servers.py" %}100{% else %}20{% endif %}%;">Channel name</td>
<td style="width: 20%;">Channel name</td>
{% if page != "servers.py" %}
<td style="width: 100%;">Group</td>
<td style="width: 25%;">Group</td>
{% endif %}
<td style="width: 100%;"></td>
<td></td>
<td></td>
</tr>
@ -22,7 +23,7 @@
</td>
<td>
{% set id = 'telegram-chanel-' + telegram.0|string() %}
{{ input(id, value=telegram.2) }}
{{ input(id, value=telegram.2, size='30') }}
</td>
{% if page != "servers.py" %}
<td>
@ -38,6 +39,9 @@
</select>
</td>
{% endif %}
<td>
<button title="Send test message" onclick="checkTelegram({{telegram.0}})">Test</button>
</td>
<td>
<a class="add" onclick="cloneTelegram({{telegram.0}})" id="clone-{{telegram.0}}" title="Clone {{telegram.2}}" style="cursor: pointer;"></a>
</td>

@ -2207,6 +2207,7 @@ function loadchecker() {
} else {
$('#checker').html(data);
$( "select" ).selectmenu();
$("button").button();
$.getScript('/inc/users.js');
$.getScript(awesome);
}
@ -2232,4 +2233,22 @@ function loadopenvpn() {
}
} );
}
function checkTelegram(telegram_id) {
$.ajax({
url: "options.py",
data: {
check_telegram: telegram_id,
token: $('#token').val()
},
type: "POST",
success: function (data) {
data = data.replace(/\s+/g, ' ');
if (data.indexOf('error:') != '-1' || data.indexOf('error_code') != '-1') {
toastr.error(data);
} else {
toastr.success('Test message has been sent');
}
}
} );
}

Loading…
Cancel
Save