diff --git a/README.md b/README.md index 1eb6263..312ccf2 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,14 @@ A simple web interface(user-frendly web GUI) for managing Haproxy servers. Leave 14. Telegram notification # Install - +The installer will ask you a few questions +``` +$ git clone https://github.com/Aidaho12/haproxy-wi.git /var/www/haproxy-wi +$ chmod +x install +$ cd /var/www/haproxy-wi +$ ./install +``` +## Manual install For install just [dowload](https://github.com/Aidaho12/haproxy-wi/archive/master.zip) archive and untar somewhere: ``` $ cd /var/www/ diff --git a/cgi-bin/add.py b/cgi-bin/add.py index d1f2914..0d33c6e 100644 --- a/cgi-bin/add.py +++ b/cgi-bin/add.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import html import cgi +import cgitb; cgitb.enable() import os import funct import sql @@ -16,9 +17,12 @@ config.read(path_config) funct.page_for_admin(level = 2) hap_configs_dir = config.get('configs', 'haproxy_save_configs_dir') -form = cgi.FieldStorage() +cert_path = config.get('haproxy', 'cert_path') + listhap = sql.get_dick_permit() +form = cgi.FieldStorage() + if form.getvalue('mode') is not None: serv = form.getvalue('serv') port = form.getvalue('port') @@ -46,7 +50,7 @@ if form.getvalue('mode') is not None: backend = "" if form.getvalue('ssl') == "https" and form.getvalue('mode') != "tcp": - ssl = "ssl crt " + form.getvalue('cert') + ssl = "ssl crt " + cert_path + form.getvalue('cert') if form.getvalue('ssl-check') == "ssl-check": ssl_check = " ssl verify none" else: @@ -152,7 +156,7 @@ print('' '
Slave for (?) | ' '' ' | ' diff --git a/inc/script.js b/inc/script.js index 2fc0a4d..0b475f8 100644 --- a/inc/script.js +++ b/inc/script.js @@ -529,12 +529,16 @@ $( function() { serv: $("#serv").val() }, success: function( data ) { - response(data.split("\n")); + data = data.replace(/\s+/g,' '); + response(data.split(" ")); } } ); }, autoFocus: true, - minLength: -1 + minLength: -1, + select: function( event, ui ) { + $('#listen-port').focus(); + } }); $( "#ip1" ).autocomplete({ source: function( request, response ) { @@ -545,10 +549,11 @@ $( function() { url: "options.py", data: { ip: request.term, - serv: $("#serv").val() + serv: $("#serv2").val() }, success: function( data ) { - response(data.split("\n")); + data = data.replace(/\s+/g,' '); + response(data.split(" ")); } } ); }, @@ -599,4 +604,55 @@ $( function() { $("#optionsInput2").append(ui.item.value + " ") } }); + $( "#path-cert-listen" ).autocomplete({ + source: function( request, response ) { + $.ajax( { + url: "options.py", + data: { + getcert:1, + serv: $("#serv").val() + }, + success: function( data ) { + data = data.replace(/\s+/g,' '); + response(data.split(" ")); + } + } ); + }, + autoFocus: true, + minLength: -1 + }); + $( "#path-cert-frontend" ).autocomplete({ + source: function( request, response ) { + $.ajax( { + url: "options.py", + data: { + getcert:1, + serv: $("#serv2").val() + }, + success: function( data ) { + data = data.replace(/\s+/g,' '); + response(data.split(" ")); + } + } ); + }, + autoFocus: true, + minLength: -1 + }); + $( "#path-cert-backend" ).autocomplete({ + source: function( request, response ) { + $.ajax( { + url: "options.py", + data: { + getcert:1, + serv: $("#serv3").val() + }, + success: function( data ) { + data = data.replace(/\s+/g,' '); + response(data.split(" ")); + } + } ); + }, + autoFocus: true, + minLength: -1 + }); }); \ No newline at end of file diff --git a/inc/style.css b/inc/style.css index 40acd0a..970265b 100644 --- a/inc/style.css +++ b/inc/style.css @@ -528,6 +528,7 @@ a:focus { cursor: pointer; font-weight: bold; padding-left: 10px; + margin-bottom: 10px; } .alert-danger { color: #a94442; diff --git a/requirements.txt b/requirements.txt index d2b6394..5e842c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,4 @@ numpy==1.14.0 matplotlib==2.1.2 urllib3==1.22 future==0.13.1 -mysqlclient==1.3.12 \ No newline at end of file +mysql-connector-python==8.0.11 \ No newline at end of file |