mirror of https://github.com/Aidaho12/haproxy-wi
parent
d7b3229913
commit
60b83c9c8c
|
@ -19,13 +19,23 @@ if form.getvalue('token') is None:
|
||||||
print("What the fuck?! U r hacker Oo?!")
|
print("What the fuck?! U r hacker Oo?!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if form.getvalue('getcert') is not None and serv is not None:
|
if form.getvalue('getcerts') is not None and serv is not None:
|
||||||
|
cert_path = funct.get_config_var('haproxy', 'cert_path')
|
||||||
commands = [ "ls -1t /etc/ssl/certs/ |grep pem" ]
|
commands = [ "ls -1t /etc/ssl/certs/ |grep pem" ]
|
||||||
try:
|
try:
|
||||||
funct.ssh_command(serv, commands, ip="1")
|
funct.ssh_command(serv, commands, ip="1")
|
||||||
except:
|
except:
|
||||||
print('<div class="alert alert-danger" style="margin:0">Can not connect to the server</div>')
|
print('<div class="alert alert-danger" style="margin:0">Can not connect to the server</div>')
|
||||||
|
|
||||||
|
if form.getvalue('getcert') is not None and serv is not None:
|
||||||
|
id = form.getvalue('getcert')
|
||||||
|
cert_path = funct.get_config_var('haproxy', 'cert_path')
|
||||||
|
commands = [ "cat "+cert_path+"/"+id ]
|
||||||
|
try:
|
||||||
|
funct.ssh_command(serv, commands, ip="1")
|
||||||
|
except:
|
||||||
|
print('<div class="alert alert-danger" style="margin:0">Can not connect to the server</div>')
|
||||||
|
|
||||||
if form.getvalue('ssh_cert'):
|
if form.getvalue('ssh_cert'):
|
||||||
fullpath = funct.get_config_var('main', 'fullpath')
|
fullpath = funct.get_config_var('main', 'fullpath')
|
||||||
name = form.getvalue('name')
|
name = form.getvalue('name')
|
||||||
|
|
|
@ -469,6 +469,10 @@
|
||||||
{{ conf_add }}
|
{{ conf_add }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<div id="dialog-confirm" title="View certificate " style="display: none;">
|
||||||
|
<p id="dialog-confirm-body"></span></p>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$( ".force_close" ).selectmenu({
|
$( ".force_close" ).selectmenu({
|
||||||
width: 180
|
width: 180
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="copyright-menu">
|
<div class="copyright-menu">
|
||||||
HAproxy-WI v2.6.2
|
HAproxy-WI v2.6.2.1
|
||||||
<br>
|
<br>
|
||||||
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a>
|
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -905,7 +905,7 @@ $( function() {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
serv: $('#serv5').val(),
|
serv: $('#serv5').val(),
|
||||||
getcert: "viewcert",
|
getcerts: "viewcert",
|
||||||
token: $('#token').val()
|
token: $('#token').val()
|
||||||
},
|
},
|
||||||
type: "GET",
|
type: "GET",
|
||||||
|
@ -914,11 +914,20 @@ $( function() {
|
||||||
$("#ajax-show-ssl").html(data);
|
$("#ajax-show-ssl").html(data);
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
$('.alert-danger').remove();
|
||||||
$( "#ajax-show-ssl").html("<b>"+data+"</b>");
|
var i;
|
||||||
|
var new_data = "";
|
||||||
|
data = data.split("\n");
|
||||||
|
|
||||||
|
for (i = 0; i < data.length; i++) {
|
||||||
|
|
||||||
|
new_data += ' <a onclick="view_ssl(\''+data[i]+'\')" style="cursor: pointer;" title="View this cert">'+data[i]+'</a> '
|
||||||
|
}
|
||||||
|
$("#ajax-show-ssl").html("<b>"+new_data+"</b>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#auth').submit(function() {
|
$('#auth').submit(function() {
|
||||||
$('.alert-danger').remove();
|
$('.alert-danger').remove();
|
||||||
let searchParams = new URLSearchParams(window.location.search)
|
let searchParams = new URLSearchParams(window.location.search)
|
||||||
|
@ -955,3 +964,36 @@ function replace_text(id_textarea, text_var) {
|
||||||
var text_val = str.substring(0, beg) + str.substring(end, len);
|
var text_val = str.substring(0, beg) + str.substring(end, len);
|
||||||
$(id_textarea).text(text_val);
|
$(id_textarea).text(text_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function view_ssl(id) {
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
serv: $('#serv5').val(),
|
||||||
|
getcert: id,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "GET",
|
||||||
|
success: function( data ) {
|
||||||
|
if (data.indexOf('danger') != '-1') {
|
||||||
|
$("#ajax-show-ssl").html(data);
|
||||||
|
} else {
|
||||||
|
$('.alert-danger').remove();
|
||||||
|
$('#dialog-confirm-body').text(data);
|
||||||
|
$( "#dialog-confirm" ).dialog({
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 800,
|
||||||
|
modal: true,
|
||||||
|
title: "Certificate from "+$('#serv5').val()+", name: "+id,
|
||||||
|
buttons: {
|
||||||
|
Ok: function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue