mirror of https://github.com/Aidaho12/haproxy-wi
parent
77f7c142dd
commit
c1f3fe4a97
|
@ -166,8 +166,8 @@ def update_db_v_31(**kwargs):
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('proxy', '', 'main', 'Proxy server. Use proto://ip:port');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('proxy', '', 'main', 'Proxy server. Use proto://ip:port');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('session_ttl', '5', 'main', 'Time to live users sessions. In days');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('session_ttl', '5', 'main', 'Time to live users sessions. In days');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('token_ttl', '5', 'main', 'Time to live users tokens. In days');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('token_ttl', '5', 'main', 'Time to live users tokens. In days');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('tmp_config_path', '/tmp/', 'main', 'Temp store configs, for check');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('tmp_config_path', '/tmp/', 'main', 'Temp store configs, for check. Path must exist');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('cert_path', '/etc/ssl/certs/', 'main', 'Path to SSL dir');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('cert_path', '/etc/ssl/certs/', 'main', 'Path to SSL dir. Folder owner must be a user which set in the SSH settings. Path must exist');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('lists_path', 'lists', 'main', 'Path to black/white lists. This is a relative path, begins with $HOME_HAPROXY-WI');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('lists_path', 'lists', 'main', 'Path to black/white lists. This is a relative path, begins with $HOME_HAPROXY-WI');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('local_path_logs', '/var/log/haproxy.log', 'logs', 'Logs save locally, enabled by default');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('local_path_logs', '/var/log/haproxy.log', 'logs', 'Logs save locally, enabled by default');")
|
||||||
sql.append("INSERT INTO settings (param, value, section, `desc`) values('syslog_server_enable', '0', 'logs', 'If exist syslog server for HAproxy logs, enable this option');")
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('syslog_server_enable', '0', 'logs', 'If exist syslog server for HAproxy logs, enable this option');")
|
||||||
|
@ -475,9 +475,14 @@ def update_db_v_4_3(**kwargs):
|
||||||
|
|
||||||
def update_db_v_4_3_0(**kwargs):
|
def update_db_v_4_3_0(**kwargs):
|
||||||
con, cur = get_cur()
|
con, cur = get_cur()
|
||||||
sql = """
|
if mysql_enable == '1':
|
||||||
insert OR IGNORE into user_groups(user_id, user_group_id) select id, groups from user;
|
sql = """
|
||||||
"""
|
insert OR IGNORE into user_groups(user_id, user_group_id) select user.id, user.groups from user;
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
sql = """
|
||||||
|
insert OR IGNORE into user_groups(user_id, user_group_id) select id, groups from user;
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
cur.execute(sql)
|
cur.execute(sql)
|
||||||
con.commit()
|
con.commit()
|
||||||
|
@ -567,7 +572,7 @@ def update_db_v_4_4(**kwargs):
|
||||||
except sqltool.Error as e:
|
except sqltool.Error as e:
|
||||||
if kwargs.get('silent') != 1:
|
if kwargs.get('silent') != 1:
|
||||||
if e.args[0] == 'duplicate column name: pos' or e == " 1060 (42S21): Duplicate column name 'pos' ":
|
if e.args[0] == 'duplicate column name: pos' or e == " 1060 (42S21): Duplicate column name 'pos' ":
|
||||||
print('DB was update to 4.4.0')
|
print('Updating... go to version 4.4.2')
|
||||||
else:
|
else:
|
||||||
print("An error occurred:", e)
|
print("An error occurred:", e)
|
||||||
return False
|
return False
|
||||||
|
@ -577,6 +582,32 @@ def update_db_v_4_4(**kwargs):
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
|
def update_db_v_4_4_2(**kwargs):
|
||||||
|
con, cur = get_cur()
|
||||||
|
sql = """CREATE TABLE IF NOT EXISTS `waf_rules` (`id` INTEGER NOT NULL,
|
||||||
|
serv varchar(64),
|
||||||
|
`rule_name` varchar(64),
|
||||||
|
`rule_file` varchar(64),
|
||||||
|
`desc` varchar(1024),
|
||||||
|
`en` INTEGER DEFAULT 1,
|
||||||
|
UNIQUE(serv, rule_name),
|
||||||
|
PRIMARY KEY(`id`) ); """
|
||||||
|
try:
|
||||||
|
cur.execute(sql)
|
||||||
|
con.commit()
|
||||||
|
except sqltool.Error as e:
|
||||||
|
if kwargs.get('silent') != 1:
|
||||||
|
if e.args[0] == 'duplicate column name: version' or e == "1060 (42S21): Duplicate column name 'version' ":
|
||||||
|
print('DB was update to 4.4.2')
|
||||||
|
else:
|
||||||
|
print("DB was update to 4.4.2")
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
cur.close()
|
||||||
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
def update_ver(**kwargs):
|
def update_ver(**kwargs):
|
||||||
con, cur = get_cur()
|
con, cur = get_cur()
|
||||||
sql = """update version set version = '4.4.0.0'; """
|
sql = """update version set version = '4.4.0.0'; """
|
||||||
|
@ -609,6 +640,7 @@ def update_all():
|
||||||
update_db_v_4_3_1()
|
update_db_v_4_3_1()
|
||||||
update_db_v_4_3_2()
|
update_db_v_4_3_2()
|
||||||
update_db_v_4_4()
|
update_db_v_4_4()
|
||||||
|
update_db_v_4_4_2()
|
||||||
update_ver()
|
update_ver()
|
||||||
|
|
||||||
|
|
||||||
|
@ -632,6 +664,7 @@ def update_all_silent():
|
||||||
update_db_v_4_3_1(silent=1)
|
update_db_v_4_3_1(silent=1)
|
||||||
update_db_v_4_3_2(silent=1)
|
update_db_v_4_3_2(silent=1)
|
||||||
update_db_v_4_4(silent=1)
|
update_db_v_4_4(silent=1)
|
||||||
|
update_db_v_4_4_2(silent=1)
|
||||||
update_ver()
|
update_ver()
|
||||||
|
|
||||||
|
|
||||||
|
|
11
app/funct.py
11
app/funct.py
|
@ -523,6 +523,7 @@ def waf_install(serv, **kwargs):
|
||||||
stderr = ssh_command(serv, commands, print_out="1")
|
stderr = ssh_command(serv, commands, print_out="1")
|
||||||
|
|
||||||
sql.insert_waf_metrics_enable(serv, "0")
|
sql.insert_waf_metrics_enable(serv, "0")
|
||||||
|
sql.insert_waf_rules(serv)
|
||||||
|
|
||||||
|
|
||||||
def install_nginx(serv):
|
def install_nginx(serv):
|
||||||
|
@ -607,18 +608,23 @@ def upload(serv, path, file, **kwargs):
|
||||||
try:
|
try:
|
||||||
ssh = ssh_connect(serv)
|
ssh = ssh_connect(serv)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error = e
|
error = e.args
|
||||||
logging('localhost', str(e.args[0]), haproxywi=1)
|
logging('localhost', str(e.args[0]), haproxywi=1)
|
||||||
|
print(' Cannot upload '+file+' to '+full_path+' to server: '+serv+' error: '+str(e.args))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sftp = ssh.open_sftp()
|
sftp = ssh.open_sftp()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
error = e.args
|
||||||
logging('localhost', str(e.args[0]), haproxywi=1)
|
logging('localhost', str(e.args[0]), haproxywi=1)
|
||||||
|
print('Cannot upload '+file+' to '+full_path+' to server: '+serv+' error: '+str(e.args))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
file = sftp.put(file, full_path)
|
file = sftp.put(file, full_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
error = e.args
|
||||||
|
print('Cannot upload '+file+' to '+full_path+' to server: '+serv+' error: '+str(e.args))
|
||||||
logging('localhost', ' Cannot upload '+file+' to '+full_path+' to server: '+serv+' Error: '+str(e.args), haproxywi=1)
|
logging('localhost', ' Cannot upload '+file+' to '+full_path+' to server: '+serv+' Error: '+str(e.args), haproxywi=1)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -628,6 +634,7 @@ def upload(serv, path, file, **kwargs):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error = e.args
|
error = e.args
|
||||||
logging('localhost', str(error[0]), haproxywi=1)
|
logging('localhost', str(error[0]), haproxywi=1)
|
||||||
|
print('Cannot upload '+file+' to '+full_path+' to server: '+serv+' error: '+str(e.args))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return str(error)
|
return str(error)
|
||||||
|
@ -903,7 +910,7 @@ def ssh_command(serv, commands, **kwargs):
|
||||||
ssh.close()
|
ssh.close()
|
||||||
except:
|
except:
|
||||||
logging('localhost', ' '+str(ssh), haproxywi=1)
|
logging('localhost', ' '+str(ssh), haproxywi=1)
|
||||||
return "<div class='alert alert-danger' style='margin: 0;'>"+str(ssh)+"<a title='Close' id='errorMess'><b>X</b></a></div>"
|
return "error: "+str(ssh)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,17 +26,17 @@ if act == "checkrestart":
|
||||||
|
|
||||||
|
|
||||||
if not sql.check_token_exists(form.getvalue("token")):
|
if not sql.check_token_exists(form.getvalue("token")):
|
||||||
print('<div class="alert alert-danger" style="margin:20px;">Your token has been expired</div>')
|
print('error: Your token has been expired')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('getcerts') is not None and serv is not None:
|
if form.getvalue('getcerts') is not None and serv is not None:
|
||||||
cert_path = sql.get_setting('cert_path')
|
cert_path = sql.get_setting('cert_path')
|
||||||
commands = [ "ls -1t "+cert_path+" |grep pem" ]
|
commands = ["sudo ls -1t "+cert_path+" |grep pem"]
|
||||||
try:
|
try:
|
||||||
funct.ssh_command(serv, commands, ip="1")
|
funct.ssh_command(serv, commands, ip="1")
|
||||||
except:
|
except Exception as e:
|
||||||
print('<div class="alert alert-danger" style="margin:0">Can not connect to the server</div>')
|
print('error: Cannot connect to the server: ' + str(e))
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('checkSshConnect') is not None and serv is not None:
|
if form.getvalue('checkSshConnect') is not None and serv is not None:
|
||||||
|
@ -50,7 +50,7 @@ if form.getvalue('getcert') is not None and serv is not None:
|
||||||
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('error: Can not connect to the server')
|
||||||
|
|
||||||
|
|
||||||
if serv and form.getvalue('ssl_cert'):
|
if serv and form.getvalue('ssl_cert'):
|
||||||
|
@ -61,24 +61,24 @@ if serv and form.getvalue('ssl_cert'):
|
||||||
os.makedirs(cert_local_dir)
|
os.makedirs(cert_local_dir)
|
||||||
|
|
||||||
if form.getvalue('ssl_name') is None:
|
if form.getvalue('ssl_name') is None:
|
||||||
print('<div class="alert alert-danger" style="float: left;">Please enter desired name</div>')
|
print('error: Please enter desired name')
|
||||||
else:
|
else:
|
||||||
name = form.getvalue('ssl_name') + '.pem'
|
name = form.getvalue('ssl_name') + '.pem'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(name, "w") as ssl_cert:
|
with open(name, "w") as ssl_cert:
|
||||||
ssl_cert.write(form.getvalue('ssl_cert'))
|
ssl_cert.write(form.getvalue('ssl_cert'))
|
||||||
except IOError:
|
except IOError as e :
|
||||||
print('<div class="alert alert-danger style="float: left;"">Can\'t save ssl keys file. Check ssh keys path in config</div>')
|
print('error: Can\'t save ssl keys file. Check ssh keys path in config '+e.args[0])
|
||||||
else:
|
|
||||||
print('<div class="alert alert-success" style="float: left;">SSL file was upload to %s into: %s %s</div>' % (serv, cert_path, name))
|
|
||||||
|
|
||||||
MASTERS = sql.is_master(serv)
|
MASTERS = sql.is_master(serv)
|
||||||
for master in MASTERS:
|
for master in MASTERS:
|
||||||
if master[0] != None:
|
if master[0] != None:
|
||||||
funct.upload(master[0], cert_path, name)
|
funct.upload(master[0], cert_path, name)
|
||||||
try:
|
try:
|
||||||
funct.upload(serv, cert_path, name)
|
error = funct.upload(serv, cert_path, name)
|
||||||
|
if error == '':
|
||||||
|
print('success: SSL file has been uploaded to %s into: %s%s' % (serv, cert_path, '/'+name))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
funct.logging('localhost', e.args[0], haproxywi=1)
|
funct.logging('localhost', e.args[0], haproxywi=1)
|
||||||
try:
|
try:
|
||||||
|
@ -86,7 +86,7 @@ if serv and form.getvalue('ssl_cert'):
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
funct.logging('localhost', e.args[0], haproxywi=1)
|
funct.logging('localhost', e.args[0], haproxywi=1)
|
||||||
|
|
||||||
funct.logging(serv, "add.py#ssl upload new ssl cert %s" % name)
|
funct.logging(serv, "add.py#ssl uploaded a new SSL cert %s" % name, haproxywi=1, login=1)
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('backend') is not None:
|
if form.getvalue('backend') is not None:
|
||||||
|
@ -200,7 +200,7 @@ if form.getvalue('maxconn_frontend') is not None:
|
||||||
cmd = 'string=`grep %s %s -n -A5 |grep maxcon -n |awk -F":" \'{print $2}\'|awk -F"-" \'{print $1}\'` && sed -Ei "$( echo $string)s/[0-9]+/%s/g" %s' % (frontend, cfg, maxconn, cfg)
|
cmd = 'string=`grep %s %s -n -A5 |grep maxcon -n |awk -F":" \'{print $2}\'|awk -F"-" \'{print $1}\'` && sed -Ei "$( echo $string)s/[0-9]+/%s/g" %s' % (frontend, cfg, maxconn, cfg)
|
||||||
output, stderr = funct.subprocess_execute(cmd)
|
output, stderr = funct.subprocess_execute(cmd)
|
||||||
stderr = funct.master_slave_upload_and_restart(serv, cfg, just_save='save')
|
stderr = funct.master_slave_upload_and_restart(serv, cfg, just_save='save')
|
||||||
print('Maxconn for %s has been set to %s ' % (frontend, maxconn))
|
print('success: Maxconn for %s has been set to %s ' % (frontend, maxconn))
|
||||||
else:
|
else:
|
||||||
print('error: '+output[0])
|
print('error: '+output[0])
|
||||||
|
|
||||||
|
@ -272,9 +272,9 @@ if form.getvalue('action_hap') is not None and serv is not None:
|
||||||
commands = [ "sudo systemctl %s haproxy" % action ]
|
commands = [ "sudo systemctl %s haproxy" % action ]
|
||||||
funct.ssh_command(serv, commands)
|
funct.ssh_command(serv, commands)
|
||||||
funct.logging(serv, 'HAProxy was '+action+'ed', haproxywi=1, login=1)
|
funct.logging(serv, 'HAProxy was '+action+'ed', haproxywi=1, login=1)
|
||||||
print("HAproxy was %s" % action)
|
print("success: HAproxy was %s" % action)
|
||||||
else:
|
else:
|
||||||
print("Bad config, check please")
|
print("error: Bad config, check please")
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('action_nginx') is not None and serv is not None:
|
if form.getvalue('action_nginx') is not None and serv is not None:
|
||||||
|
@ -284,9 +284,9 @@ if form.getvalue('action_nginx') is not None and serv is not None:
|
||||||
commands = [ "sudo systemctl %s nginx" % action ]
|
commands = [ "sudo systemctl %s nginx" % action ]
|
||||||
funct.ssh_command(serv, commands)
|
funct.ssh_command(serv, commands)
|
||||||
funct.logging(serv, 'Nginx was '+action+'ed', haproxywi=1, login=1)
|
funct.logging(serv, 'Nginx was '+action+'ed', haproxywi=1, login=1)
|
||||||
print("Nginx was %s" % action)
|
print("success: Nginx was %s" % action)
|
||||||
else:
|
else:
|
||||||
print("Bad config, check please")
|
print("error: Bad config, check please")
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('action_waf') is not None and serv is not None:
|
if form.getvalue('action_waf') is not None and serv is not None:
|
||||||
|
@ -354,7 +354,7 @@ if act == "overviewHapservers":
|
||||||
try:
|
try:
|
||||||
print(funct.ssh_command(serv, commands))
|
print(funct.ssh_command(serv, commands))
|
||||||
except:
|
except:
|
||||||
print('Cannot get last date')
|
print('error: Cannot get last date')
|
||||||
|
|
||||||
|
|
||||||
if act == "overview":
|
if act == "overview":
|
||||||
|
@ -538,17 +538,17 @@ if serv is not None and act == "stats":
|
||||||
try:
|
try:
|
||||||
response = requests.get('http://%s:%s/%s' % (serv, stats_port, stats_page), auth=(haproxy_user, haproxy_pass))
|
response = requests.get('http://%s:%s/%s' % (serv, stats_port, stats_page), auth=(haproxy_user, haproxy_pass))
|
||||||
except requests.exceptions.ConnectTimeout:
|
except requests.exceptions.ConnectTimeout:
|
||||||
print('Oops. Connection timeout occured!')
|
print('error: Oops. Connection timeout occured!')
|
||||||
except requests.exceptions.ReadTimeout:
|
except requests.exceptions.ReadTimeout:
|
||||||
print('Oops. Read timeout occured')
|
print('error: Oops. Read timeout occured')
|
||||||
except requests.exceptions.HTTPError as errh:
|
except requests.exceptions.HTTPError as errh:
|
||||||
print ("Http Error:",errh)
|
print ("error: Http Error:",errh)
|
||||||
except requests.exceptions.ConnectionError as errc:
|
except requests.exceptions.ConnectionError as errc:
|
||||||
print ('<div class="alert alert-danger">Error Connecting: %s</div>' % errc)
|
print ('error: Error Connecting: %s' % errc)
|
||||||
except requests.exceptions.Timeout as errt:
|
except requests.exceptions.Timeout as errt:
|
||||||
print ("Timeout Error:",errt)
|
print ("error: Timeout Error:",errt)
|
||||||
except requests.exceptions.RequestException as err:
|
except requests.exceptions.RequestException as err:
|
||||||
print ("OOps: Something Else",err)
|
print ("error: OOps: Something Else",err)
|
||||||
|
|
||||||
data = response.content
|
data = response.content
|
||||||
if form.getvalue('service') == 'nginx':
|
if form.getvalue('service') == 'nginx':
|
||||||
|
@ -627,11 +627,11 @@ if serv is not None and act == "showMap":
|
||||||
|
|
||||||
error = funct.get_config(serv, cfg)
|
error = funct.get_config(serv, cfg)
|
||||||
if error:
|
if error:
|
||||||
print('<div class="alert alert-danger">'+error+'</div>')
|
print(error)
|
||||||
try:
|
try:
|
||||||
conf = open(cfg, "r")
|
conf = open(cfg, "r")
|
||||||
except IOError:
|
except IOError:
|
||||||
print('<div class="alert alert-danger">Can\'t read import config file</div>')
|
print('error: Can\'t read import config file')
|
||||||
|
|
||||||
node = ""
|
node = ""
|
||||||
line_new2 = [1,""]
|
line_new2 = [1,""]
|
||||||
|
@ -703,7 +703,7 @@ if serv is not None and act == "showMap":
|
||||||
plt.savefig("map.png")
|
plt.savefig("map.png")
|
||||||
plt.show()
|
plt.show()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('<div class="alert alert-danger">' + str(e) + '</div>')
|
print(str(e))
|
||||||
|
|
||||||
cmd = "rm -f "+os.path.dirname(os.getcwd())+"/map*.png && mv map.png "+os.path.dirname(os.getcwd())+"/map"+date+".png"
|
cmd = "rm -f "+os.path.dirname(os.getcwd())+"/map*.png && mv map.png "+os.path.dirname(os.getcwd())+"/map"+date+".png"
|
||||||
output, stderr = funct.subprocess_execute(cmd)
|
output, stderr = funct.subprocess_execute(cmd)
|
||||||
|
@ -1339,7 +1339,7 @@ if form.getvalue('get_hap_v'):
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('get_nginx_v'):
|
if form.getvalue('get_nginx_v'):
|
||||||
cmd = [ "/usr/sbin/nginx -v" ]
|
cmd = [ '/usr/sbin/nginx -v' ]
|
||||||
print(funct.ssh_command(serv, cmd))
|
print(funct.ssh_command(serv, cmd))
|
||||||
|
|
||||||
|
|
||||||
|
@ -1355,7 +1355,7 @@ if form.getvalue('bwlists'):
|
||||||
file.close
|
file.close
|
||||||
print(file_read)
|
print(file_read)
|
||||||
except IOError:
|
except IOError:
|
||||||
print('<div class="alert alert-danger" style="margin:0">Cat\'n read '+form.getvalue('color')+' list</div>')
|
print('error: Cat\'n read '+form.getvalue('color')+' list , ')
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('bwlists_create'):
|
if form.getvalue('bwlists_create'):
|
||||||
|
@ -1365,13 +1365,13 @@ if form.getvalue('bwlists_create'):
|
||||||
list = os.path.dirname(os.getcwd())+"/"+sql.get_setting('lists_path')+"/"+form.getvalue('group')+"/"+color+"/"+list_name
|
list = os.path.dirname(os.getcwd())+"/"+sql.get_setting('lists_path')+"/"+form.getvalue('group')+"/"+color+"/"+list_name
|
||||||
try:
|
try:
|
||||||
open(list, 'a').close()
|
open(list, 'a').close()
|
||||||
print('<div class="alert alert-success" style="margin-left:14px">'+color+' list was created</div>')
|
print(color)
|
||||||
try:
|
try:
|
||||||
funct.logging(server[1], 'has created '+color+' list '+list_name, haproxywi=1, login=1)
|
funct.logging(server[1], 'has created '+color+' list '+list_name, haproxywi=1, login=1)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print('<div class="alert alert-danger" style="margin-left:14px">Cat\'n create new '+color+' list. %s </div>' % e)
|
print('error: Cat\'n create new '+color+' list. %s , ' % e)
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('bwlists_save'):
|
if form.getvalue('bwlists_save'):
|
||||||
|
@ -1382,7 +1382,7 @@ if form.getvalue('bwlists_save'):
|
||||||
with open(list, "w") as file:
|
with open(list, "w") as file:
|
||||||
file.write(form.getvalue('bwlists_content'))
|
file.write(form.getvalue('bwlists_content'))
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print('<div class="alert alert-danger" style="margin-left:14px">Cat\'n save '+color+' list. %s </div>' % e)
|
print('error: Cat\'n save '+color+' list. %s , ' % e)
|
||||||
|
|
||||||
path = sql.get_setting('haproxy_dir')+"/"+color
|
path = sql.get_setting('haproxy_dir')+"/"+color
|
||||||
servers = []
|
servers = []
|
||||||
|
@ -1404,9 +1404,9 @@ if form.getvalue('bwlists_save'):
|
||||||
funct.ssh_command(serv, ["sudo chown $(whoami) "+path])
|
funct.ssh_command(serv, ["sudo chown $(whoami) "+path])
|
||||||
error = funct.upload(serv, path+"/"+bwlists_save, list, dir='fullpath')
|
error = funct.upload(serv, path+"/"+bwlists_save, list, dir='fullpath')
|
||||||
if error:
|
if error:
|
||||||
print('<div class="alert alert-danger">Upload fail: %s</div>' % error)
|
print('error: Upload fail: %s , ' % error)
|
||||||
else:
|
else:
|
||||||
print('<div class="alert alert-success" style="margin:10px; margin-left:14px">Edited '+color+' list was uploaded to '+serv+'</div>')
|
print('success: Edited '+color+' list was uploaded to '+serv+' , ')
|
||||||
try:
|
try:
|
||||||
funct.logging(serv, 'has edited '+color+' list '+bwlists_save, haproxywi=1, login=1)
|
funct.logging(serv, 'has edited '+color+' list '+bwlists_save, haproxywi=1, login=1)
|
||||||
except:
|
except:
|
||||||
|
@ -1468,7 +1468,7 @@ if form.getvalue('change_waf_mode'):
|
||||||
funct.logging(serv, 'Was changed WAF mod to '+waf_mode, haproxywi=1, login=1)
|
funct.logging(serv, 'Was changed WAF mod to '+waf_mode, haproxywi=1, login=1)
|
||||||
|
|
||||||
|
|
||||||
error_mess = '<span class="alert alert-danger" id="error">All fields must be completed <a title="Close" id="errorMess"><b>X</b></a></span>'
|
error_mess = 'error: All fields must be completed'
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('newuser') is not None:
|
if form.getvalue('newuser') is not None:
|
||||||
|
@ -1731,9 +1731,9 @@ if form.getvalue('ssh_cert'):
|
||||||
with open(ssh_keys, "w") as conf:
|
with open(ssh_keys, "w") as conf:
|
||||||
conf.write(form.getvalue('ssh_cert'))
|
conf.write(form.getvalue('ssh_cert'))
|
||||||
except IOError:
|
except IOError:
|
||||||
print('<div class="alert alert-danger">Can\'t save ssh keys file. Check ssh keys path in config</div>')
|
print('error: Can\'t save ssh keys file. Check ssh keys path in config')
|
||||||
else:
|
else:
|
||||||
print('<div class="alert alert-success">Ssh key was save into: %s </div>' % ssh_keys)
|
print('success: Ssh key was save into: %s </div>' % ssh_keys)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = 'chmod 600 %s' % ssh_keys
|
cmd = 'chmod 600 %s' % ssh_keys
|
||||||
|
@ -1867,6 +1867,7 @@ if form.getvalue('smondel') is not None:
|
||||||
|
|
||||||
if sql.delete_smon(id, user_group):
|
if sql.delete_smon(id, user_group):
|
||||||
print('Ok')
|
print('Ok')
|
||||||
|
funct.logging('SMON','Has been delete server from SMON ', haproxywi=1, login=1)
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('showsmon') is not None:
|
if form.getvalue('showsmon') is not None:
|
||||||
|
@ -1907,6 +1908,7 @@ if form.getvalue('updateSmonIp') is not None:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if sql.update_smon(id, ip, port, body, telegram, group, desc, en):
|
if sql.update_smon(id, ip, port, body, telegram, group, desc, en):
|
||||||
print("Ok")
|
print("Ok")
|
||||||
|
funct.logging('SMON','Has been update the server '+ip+' to SMON ', haproxywi=1, login=1)
|
||||||
|
|
||||||
|
|
||||||
if form.getvalue('showBytes') is not None:
|
if form.getvalue('showBytes') is not None:
|
||||||
|
|
|
@ -32,10 +32,15 @@
|
||||||
<td>
|
<td>
|
||||||
{% set id = 'smon-body-' + s.0|string() %}
|
{% set id = 'smon-body-' + s.0|string() %}
|
||||||
{% if s.5 != 'None' %}
|
{% if s.5 != 'None' %}
|
||||||
|
<span id="{{id}}">{{s.5}}</span>
|
||||||
|
{% else %}
|
||||||
|
<span id="{{id}}"></span>
|
||||||
|
{% endif %}
|
||||||
|
{#{% if s.5 != 'None' %}
|
||||||
{{ input(id, value=s.5, size='10') }}
|
{{ input(id, value=s.5, size='10') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ input(id, size='10') }}
|
{{ input(id, size='10') }}
|
||||||
{% endif %}
|
{% endif %} #}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="smon-telegram-{{s.0}}">
|
<select id="smon-telegram-{{s.0}}">
|
||||||
|
|
110
inc/script.js
110
inc/script.js
|
@ -283,9 +283,14 @@ function showStats() {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
if (data.indexOf('error') != '-1') {
|
||||||
window.history.pushState("Stats", "Stats", cur_url[0]+"?service="+$("#service").val()+"&serv="+$("#serv").val());
|
toastr.error(data);
|
||||||
wait();
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$("#ajax").html(data);
|
||||||
|
window.history.pushState("Stats", "Stats", cur_url[0] + "?service=" + $("#service").val() + "&serv=" + $("#serv").val());
|
||||||
|
wait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -344,16 +349,21 @@ function showLog() {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
if (data.indexOf('error') != '-1') {
|
||||||
window.history.pushState("Logs", "Logs", cur_url[0]+"?service="+service+"&serv="+$("#serv").val()+
|
toastr.error(data);
|
||||||
'&rows='+rows+
|
} else {
|
||||||
'&exgrep='+exgrep+
|
toastr.clear();
|
||||||
'&grep='+grep+
|
$("#ajax").html(data);
|
||||||
'&hour='+hour+
|
window.history.pushState("Logs", "Logs", cur_url[0] + "?service=" + service + "&serv=" + $("#serv").val() +
|
||||||
'&minut='+minut+
|
'&rows=' + rows +
|
||||||
'&hour1='+hour1+
|
'&exgrep=' + exgrep +
|
||||||
'&minut1='+minut1+
|
'&grep=' + grep +
|
||||||
'&waf='+waf);
|
'&hour=' + hour +
|
||||||
|
'&minut=' + minut +
|
||||||
|
'&hour1=' + hour1 +
|
||||||
|
'&minut1=' + minut1 +
|
||||||
|
'&waf=' + waf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -372,8 +382,13 @@ function showMap() {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
if (data.indexOf('error') != '-1') {
|
||||||
window.history.pushState("Show map", "Show map", cur_url[0]+'?serv='+$("#serv").val()+'&showMap');
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$("#ajax").html(data);
|
||||||
|
window.history.pushState("Show map", "Show map", cur_url[0] + '?serv=' + $("#serv").val() + '&showMap');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -389,7 +404,12 @@ function showCompare() {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
if (data.indexOf('error') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$("#ajax").html(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -408,10 +428,15 @@ function showCompareConfigs() {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax-compare").html(data);
|
if (data.indexOf('error') != '-1') {
|
||||||
$( "input[type=submit], button" ).button();
|
toastr.error(data);
|
||||||
$( "select" ).selectmenu();
|
} else {
|
||||||
window.history.pushState("Show compare config", "Show compare config", cur_url[0]+'?service='+$("#service").val()+'&serv='+$("#serv").val()+'&showCompare');
|
toastr.clear();
|
||||||
|
$("#ajax-compare").html(data);
|
||||||
|
$("input[type=submit], button").button();
|
||||||
|
$("select").selectmenu();
|
||||||
|
window.history.pushState("Show compare config", "Show compare config", cur_url[0] + '?service=' + $("#service").val() + '&serv=' + $("#serv").val() + '&showCompare');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -431,9 +456,14 @@ function showConfig() {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
if (data.indexOf('error') != '-1') {
|
||||||
$.getScript('/inc/configshow.js');
|
toastr.error(data);
|
||||||
window.history.pushState("Show config", "Show config", cur_url[0]+"?service="+service+"&serv="+$("#serv").val()+"&showConfig");
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$("#ajax").html(data);
|
||||||
|
$.getScript('/inc/configshow.js');
|
||||||
|
window.history.pushState("Show config", "Show config", cur_url[0] + "?service=" + service + "&serv=" + $("#serv").val() + "&showConfig");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -452,9 +482,14 @@ function showUploadConfig() {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
if (data.indexOf('error') != '-1') {
|
||||||
window.history.pushState("Show config", "Show config", cur_url[0]+"?service="+service+"&serv="+serv+"&open=open&configver="+configver);
|
toastr.error(data);
|
||||||
$.getScript('/inc/configshow.js');
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$("#ajax").html(data);
|
||||||
|
window.history.pushState("Show config", "Show config", cur_url[0] + "?service=" + service + "&serv=" + serv + "&open=open&configver=" + configver);
|
||||||
|
$.getScript('/inc/configshow.js');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -499,19 +534,24 @@ function viewLogs() {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
$("#ajax").html(data);
|
||||||
window.history.pushState("View logs", "View logs", cur_url[0]+"?viewlogs="+viewlogs+
|
window.history.pushState("View logs", "View logs", cur_url[0] + "?viewlogs=" + viewlogs +
|
||||||
'&rows='+rows+
|
'&rows=' + rows +
|
||||||
'&grep='+grep+
|
'&grep=' + grep +
|
||||||
'&exgrep='+exgrep+
|
'&exgrep=' + exgrep +
|
||||||
'&hour='+hour+
|
'&hour=' + hour +
|
||||||
'&minut='+minut+
|
'&minut=' + minut +
|
||||||
'&hour1='+hour1+
|
'&hour1=' + hour1 +
|
||||||
'&minut1='+minut1);
|
'&minut1=' + minut1);
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$( function() {
|
$( function() {
|
||||||
|
toastr.options.closeButton = true;
|
||||||
|
toastr.options.progressBar = true;
|
||||||
|
toastr.options.positionClass = 'toast-bottom-full-width';
|
||||||
|
toastr.options.timeOut = 25000;
|
||||||
|
toastr.options.extendedTimeOut = 50000;
|
||||||
$('#errorMess').click(function(){
|
$('#errorMess').click(function(){
|
||||||
$('#error').remove();
|
$('#error').remove();
|
||||||
});
|
});
|
||||||
|
@ -1005,7 +1045,7 @@ function showSmon(action) {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
alert(data);
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
$("#smon_dashboard").html(data);
|
$("#smon_dashboard").html(data);
|
||||||
if (action == 'not_sort') {
|
if (action == 'not_sort') {
|
||||||
|
|
|
@ -0,0 +1,228 @@
|
||||||
|
.toast-title {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.toast-message {
|
||||||
|
-ms-word-wrap: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
.toast-message a,
|
||||||
|
.toast-message label {
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
.toast-message a:hover {
|
||||||
|
color: #CCCCCC;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.toast-close-button {
|
||||||
|
position: relative;
|
||||||
|
right: -0.3em;
|
||||||
|
top: -0.3em;
|
||||||
|
float: right;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #FFFFFF;
|
||||||
|
-webkit-text-shadow: 0 1px 0 #ffffff;
|
||||||
|
text-shadow: 0 1px 0 #ffffff;
|
||||||
|
opacity: 0.8;
|
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
|
||||||
|
filter: alpha(opacity=80);
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.toast-close-button:hover,
|
||||||
|
.toast-close-button:focus {
|
||||||
|
color: #000000;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.4;
|
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
|
||||||
|
filter: alpha(opacity=40);
|
||||||
|
}
|
||||||
|
.rtl .toast-close-button {
|
||||||
|
left: -0.3em;
|
||||||
|
float: left;
|
||||||
|
right: 0.3em;
|
||||||
|
}
|
||||||
|
/*Additional properties for button version
|
||||||
|
iOS requires the button element instead of an anchor tag.
|
||||||
|
If you want the anchor version, it requires `href="#"`.*/
|
||||||
|
button.toast-close-button {
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
background: transparent;
|
||||||
|
border: 0;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
.toast-top-center {
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.toast-bottom-center {
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.toast-top-full-width {
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.toast-bottom-full-width {
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.toast-top-left {
|
||||||
|
top: 12px;
|
||||||
|
left: 12px;
|
||||||
|
}
|
||||||
|
.toast-top-right {
|
||||||
|
top: 12px;
|
||||||
|
right: 12px;
|
||||||
|
}
|
||||||
|
.toast-bottom-right {
|
||||||
|
right: 12px;
|
||||||
|
bottom: 12px;
|
||||||
|
}
|
||||||
|
.toast-bottom-left {
|
||||||
|
bottom: 12px;
|
||||||
|
left: 12px;
|
||||||
|
}
|
||||||
|
#toast-container {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 999999;
|
||||||
|
pointer-events: none;
|
||||||
|
/*overrides*/
|
||||||
|
}
|
||||||
|
#toast-container * {
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
#toast-container > div {
|
||||||
|
position: relative;
|
||||||
|
pointer-events: auto;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0 0 6px;
|
||||||
|
padding: 15px 15px 15px 50px;
|
||||||
|
width: 300px;
|
||||||
|
-moz-border-radius: 3px 3px 3px 3px;
|
||||||
|
-webkit-border-radius: 3px 3px 3px 3px;
|
||||||
|
border-radius: 3px 3px 3px 3px;
|
||||||
|
background-position: 15px center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
-moz-box-shadow: 0 0 12px #999999;
|
||||||
|
-webkit-box-shadow: 0 0 12px #999999;
|
||||||
|
box-shadow: 0 0 12px #999999;
|
||||||
|
color: #FFFFFF;
|
||||||
|
opacity: 0.8;
|
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80);
|
||||||
|
filter: alpha(opacity=80);
|
||||||
|
}
|
||||||
|
#toast-container > div.rtl {
|
||||||
|
direction: rtl;
|
||||||
|
padding: 15px 50px 15px 15px;
|
||||||
|
background-position: right 15px center;
|
||||||
|
}
|
||||||
|
#toast-container > div:hover {
|
||||||
|
-moz-box-shadow: 0 0 12px #000000;
|
||||||
|
-webkit-box-shadow: 0 0 12px #000000;
|
||||||
|
box-shadow: 0 0 12px #000000;
|
||||||
|
opacity: 1;
|
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
|
||||||
|
filter: alpha(opacity=100);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
#toast-container > .toast-info {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important;
|
||||||
|
}
|
||||||
|
#toast-container > .toast-error {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important;
|
||||||
|
}
|
||||||
|
#toast-container > .toast-success {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important;
|
||||||
|
}
|
||||||
|
#toast-container > .toast-warning {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important;
|
||||||
|
}
|
||||||
|
#toast-container.toast-top-center > div,
|
||||||
|
#toast-container.toast-bottom-center > div {
|
||||||
|
width: 300px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
#toast-container.toast-top-full-width > div,
|
||||||
|
#toast-container.toast-bottom-full-width > div {
|
||||||
|
width: 96%;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
.toast {
|
||||||
|
background-color: #030303;
|
||||||
|
}
|
||||||
|
.toast-success {
|
||||||
|
background-color: #51A351;
|
||||||
|
}
|
||||||
|
.toast-error {
|
||||||
|
background-color: #BD362F;
|
||||||
|
}
|
||||||
|
.toast-info {
|
||||||
|
background-color: #2F96B4;
|
||||||
|
}
|
||||||
|
.toast-warning {
|
||||||
|
background-color: #F89406;
|
||||||
|
}
|
||||||
|
.toast-progress {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
height: 4px;
|
||||||
|
background-color: #000000;
|
||||||
|
opacity: 0.4;
|
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
|
||||||
|
filter: alpha(opacity=40);
|
||||||
|
}
|
||||||
|
/*Responsive Design*/
|
||||||
|
@media all and (max-width: 240px) {
|
||||||
|
#toast-container > div {
|
||||||
|
padding: 8px 8px 8px 50px;
|
||||||
|
width: 11em;
|
||||||
|
}
|
||||||
|
#toast-container > div.rtl {
|
||||||
|
padding: 8px 50px 8px 8px;
|
||||||
|
}
|
||||||
|
#toast-container .toast-close-button {
|
||||||
|
right: -0.2em;
|
||||||
|
top: -0.2em;
|
||||||
|
}
|
||||||
|
#toast-container .rtl .toast-close-button {
|
||||||
|
left: -0.2em;
|
||||||
|
right: 0.2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media all and (min-width: 241px) and (max-width: 480px) {
|
||||||
|
#toast-container > div {
|
||||||
|
padding: 8px 8px 8px 50px;
|
||||||
|
width: 18em;
|
||||||
|
}
|
||||||
|
#toast-container > div.rtl {
|
||||||
|
padding: 8px 50px 8px 8px;
|
||||||
|
}
|
||||||
|
#toast-container .toast-close-button {
|
||||||
|
right: -0.2em;
|
||||||
|
top: -0.2em;
|
||||||
|
}
|
||||||
|
#toast-container .rtl .toast-close-button {
|
||||||
|
left: -0.2em;
|
||||||
|
right: 0.2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media all and (min-width: 481px) and (max-width: 768px) {
|
||||||
|
#toast-container > div {
|
||||||
|
padding: 15px 15px 15px 50px;
|
||||||
|
width: 25em;
|
||||||
|
}
|
||||||
|
#toast-container > div.rtl {
|
||||||
|
padding: 15px 50px 15px 15px;
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
420
inc/users.js
420
inc/users.js
|
@ -25,7 +25,11 @@ $( function() {
|
||||||
},
|
},
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
response(data.split(" "));
|
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
response(data.split(" "));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
@ -43,7 +47,11 @@ $( function() {
|
||||||
},
|
},
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
response(data.split(" "));
|
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
response(data.split(" "));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
@ -68,11 +76,11 @@ $( function() {
|
||||||
$("#ajax").html('')
|
$("#ajax").html('')
|
||||||
if( $("#master").val() == "" || $("#slave").val() == "" || $("#interface").val() == "" ||
|
if( $("#master").val() == "" || $("#slave").val() == "" || $("#interface").val() == "" ||
|
||||||
$("#vrrp-ip").val() == "") {
|
$("#vrrp-ip").val() == "") {
|
||||||
$("#ajax").html('<div class="alert alert-danger">Please fill in all fields</div>')
|
toastr.warning('Please fill in all fields');
|
||||||
} else if(! $("#vrrp-ip").val().match(ipformat)) {
|
} else if(! $("#vrrp-ip").val().match(ipformat)) {
|
||||||
$("#ajax").html('<div class="alert alert-danger">Please enter IP in "VRRP IP" field</div>')
|
toastr.warning('Please enter IP in "VRRP IP" field');
|
||||||
} else if ($("#master").val() == $("#slave").val() ){
|
} else if ($("#master").val() == $("#slave").val() ){
|
||||||
$("#ajax").html('<div class="alert alert-danger">Master and slave must be diff servers</div>')
|
toastr.warning('Master and slave must be diff servers');
|
||||||
} else {
|
} else {
|
||||||
$("#ajax").html(wait_mess);
|
$("#ajax").html(wait_mess);
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
|
@ -91,16 +99,16 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1' || data.indexOf('alert') != '-1' || data.indexOf('FAILED') != '-1') {
|
if (data.indexOf('error') != '-1' || data.indexOf('alert') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||||
$("#ajax").html('<div class="alert alert-danger">'+data+'</div>');
|
toastr.error(data);
|
||||||
} else if (data.indexOf('info') != '-1' ){
|
} else if (data.indexOf('info') != '-1' ){
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</div>');
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#ajax").html('<div class="alert alert-success">'+data+'</div>');
|
toastr.success(data);
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -116,9 +124,9 @@ $( function() {
|
||||||
$("#ajax").html('')
|
$("#ajax").html('')
|
||||||
if( $("#master-add").val() == "" || $("#slave-add").val() == "" || $("#interface-add").val() == "" ||
|
if( $("#master-add").val() == "" || $("#slave-add").val() == "" || $("#interface-add").val() == "" ||
|
||||||
$("#vrrp-ip-add").val() == "") {
|
$("#vrrp-ip-add").val() == "") {
|
||||||
$("#ajax").html('<div class="alert alert-danger">Please fill in all fields</div>')
|
toastr.warning('Please fill in all fields')
|
||||||
} else if(! $("#vrrp-ip-add").val().match(ipformat)) {
|
} else if(! $("#vrrp-ip-add").val().match(ipformat)) {
|
||||||
$("#ajax").html('<div class="alert alert-danger">Please enter IP in "VRRP IP" field</div>')
|
toastr.warning('Please enter IP in "VRRP IP" field')
|
||||||
} else {
|
} else {
|
||||||
$("#ajax").html(wait_mess);
|
$("#ajax").html(wait_mess);
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
|
@ -135,14 +143,14 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax").html('<div class="alert alert-danger">'+data+'</div>');
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
} else if (data.indexOf('success') != '-1'){
|
} else if (data.indexOf('success') != '-1'){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#ajax").html('<div class="alert alert-success">'+data+'</div>');
|
toastr.success(data);
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -167,19 +175,16 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
|
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||||
$("#ajax").html('<div class="alert alert-danger">'+data+'</div>');
|
toastr.error(data);
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.remove();
|
||||||
$('.alert-warning').remove();
|
toastr.success(data);
|
||||||
$("#ajax").html('<div class="alert alert-success">'+data+'</div>');
|
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.remove();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.remove();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -202,19 +207,17 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
|
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||||
$("#ajax").html('<div class="alert alert-danger">'+data+'</div>');
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.success(data);
|
||||||
$("#ajax").html('<div class="alert alert-success">'+data+'</div>');
|
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -232,19 +235,17 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('FAILED') != '-1') {
|
if (data.indexOf('FAILED') != '-1') {
|
||||||
$("#ajaxmon").html('<div class="alert alert-danger">'+data+'</div>');
|
toastr.clear();
|
||||||
|
toastr.error(data);;
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.success(data);
|
||||||
$("#ajaxmon").html('<div class="alert alert-success">'+data+'</div>');
|
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajaxmon").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajaxmon").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -262,21 +263,19 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
|
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||||
$("#ajaxmon").html('<div class="alert alert-danger">'+data+'</div>');
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.success(data);
|
||||||
$("#ajaxmon").html('<div class="alert alert-success">'+data+'</div>');
|
|
||||||
$('#cur_haproxy_exp_ver').text('HAProxy expoter is installed');
|
$('#cur_haproxy_exp_ver').text('HAProxy expoter is installed');
|
||||||
$('#haproxy_exp_install').text('Update');
|
$('#haproxy_exp_install').text('Update');
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajaxmon").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -294,21 +293,18 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
|
if (data.indexOf('error') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||||
$("#ajaxmon").html('<div class="alert alert-danger">'+data+'</div>');
|
toastr.error(data);
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.success(data);
|
||||||
$("#ajaxmon").html('<div class="alert alert-success">'+data+'</div>');
|
|
||||||
$('#cur_nginx_exp_ver').text('Nginx expoter is installed');
|
$('#cur_nginx_exp_ver').text('Nginx expoter is installed');
|
||||||
$('#nginx_exp_install').text('Update');
|
$('#nginx_exp_install').text('Update');
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajaxmon").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajaxmon").html('<div class="alert alert-info">'+data+'</div>');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -419,54 +415,46 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
|
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
|
||||||
$("#ajax").html('<div class="alert alert-danger">'+data+'</div>');
|
toastr.error(data);
|
||||||
} else if (data.indexOf('Complete!') != '-1'){
|
} else if (data.indexOf('Complete!') != '-1'){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.success('Update was success!');
|
||||||
$("#ajax-update").html('<div class="alert alert-success">Update was success!</div>');
|
|
||||||
} else if (data.indexOf('Unauthorized') != '-1') {
|
} else if (data.indexOf('Unauthorized') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error('It is seems like you Unauthorized in the HAProxy-WI repository. How to get HAProxy-WI auth you can read <a href="https://haproxy-wi.org/installation.py" title="How to get HAProxy-WI auth">hear</a>');
|
||||||
$("#ajax-update").html('<div class="alert alert-danger">It is seems like you Unauthorized in the HAProxy-WI repository. How to get HAProxy-WI auth you can read <a href="https://haproxy-wi.org/installation.py" title="How to get HAProxy-WI auth">hear</a> </div>');
|
|
||||||
} else if (data.indexOf('but not installed') != '-1') {
|
} else if (data.indexOf('but not installed') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error('You have settings for HAProxy-WI repository, but installed HAProxy-WI without repository. Please reinstall with yum');
|
||||||
$("#ajax-update").html('<div class="alert alert-warning">You have settings for HAProxy-WI repository, but installed HAProxy-WI without repository. Please reinstall with yum or use update.sh</div>');
|
|
||||||
} else if (data.indexOf('No Match for argument') != '-1') {
|
} else if (data.indexOf('No Match for argument') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error('It is seems like you do not have HAProxy-WI repository settings. Please read docs for <a href="https://haproxy-wi.org/updates.py">detail</a>');
|
||||||
$("#ajax-update").html('<div class="alert alert-warning">It is seems like you do not have HAProxy-WI repository settings. Please read docs for<a href="https://haproxy-wi.org/updates.py">detail</a></div>');
|
|
||||||
} else if (data.indexOf('password for') != '-1') {
|
} else if (data.indexOf('password for') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error('It is seems like you need add Apache user to sudoers. Please read docs for<a href="https://haproxy-wi.org/updates.py">detail</a>');
|
||||||
$("#ajax-update").html('<div class="alert alert-warning">It is seems like you need add Apache user to sudoers. Please read docs for<a href="https://haproxy-wi.org/updates.py">detail</a></div>');
|
|
||||||
} else if (data.indexOf('No packages marked for update') != '-1') {
|
} else if (data.indexOf('No packages marked for update') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error('It is seems like you have the lastest version HAProxy-WI');
|
||||||
$("#ajax-update").html('<div class="alert alert-info">It is seems like you have the lastest version HAProxy-WI</div>');
|
|
||||||
} else if (data.indexOf('Connection timed out') != '-1') {
|
} else if (data.indexOf('Connection timed out') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error('Cannot connect to HAProxy-WI repository. Connection timed out');
|
||||||
$("#ajax-update").html('<div class="alert alert-danger">Cannot connect to HAProxy-WI repository. Connection timed out</div>');
|
|
||||||
} else if (data.indexOf('--disable') != '-1') {
|
} else if (data.indexOf('--disable') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error('It is seems like you have problem with your repositorys');
|
||||||
$("#ajax-update").html('<div class="alert alert-danger">It is seems like you have problem with your repositorys.</div>');
|
|
||||||
} else if (data.indexOf('Unauthorized') != '-1') {
|
} else if (data.indexOf('Unauthorized') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error('It is seems like you Unauthorized in the HAProxy-WI repository');
|
||||||
$("#ajax-update").html('<div class="alert alert-danger">It is seems like you Unauthorized in the HAProxy-WI repository.</div>');
|
|
||||||
} else if (data.indexOf('Error: Package') != '-1') {
|
} else if (data.indexOf('Error: Package') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.error(data);
|
||||||
$("#ajax-update").html('<div class="alert alert-danger">'+data+'</div>');
|
} else if (data.indexOf('conflicts with file from') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
});
|
});
|
||||||
$('#add-group').click(function() {
|
$('#add-group').click(function() {
|
||||||
$('#error').remove();
|
toastr.clear();
|
||||||
$('.alert-danger').remove();
|
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
|
@ -478,12 +466,9 @@ $( function() {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-group").append('<div class="alert alert-danger" style="width: 100%;">'+data+'</div><br /><br />');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
|
toastr.clear();
|
||||||
var getId = new RegExp('[0-9]+');
|
var getId = new RegExp('[0-9]+');
|
||||||
var id = data.match(getId);
|
var id = data.match(getId);
|
||||||
$("#ajax-group").append(data);
|
$("#ajax-group").append(data);
|
||||||
|
@ -495,8 +480,7 @@ $( function() {
|
||||||
} );
|
} );
|
||||||
});
|
});
|
||||||
$('#add-ssh').click(function() {
|
$('#add-ssh').click(function() {
|
||||||
$('#error').remove();
|
toastr.clear();
|
||||||
$('.alert-danger').remove();
|
|
||||||
var ssh_enable = 0;
|
var ssh_enable = 0;
|
||||||
if ($('#new-ssh_enable').is(':checked')) {
|
if ($('#new-ssh_enable').is(':checked')) {
|
||||||
ssh_enable = '1';
|
ssh_enable = '1';
|
||||||
|
@ -515,12 +499,9 @@ $( function() {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-ssh").append('<div class="alert alert-danger" style="width: 100%;">'+data+'</div><br /><br />');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
|
toastr.clear();
|
||||||
var getId = new RegExp('ssh-table-[0-9]+');
|
var getId = new RegExp('ssh-table-[0-9]+');
|
||||||
var id = data.match(getId) + '';
|
var id = data.match(getId) + '';
|
||||||
id = id.split('-').pop();;
|
id = id.split('-').pop();;
|
||||||
|
@ -540,8 +521,7 @@ $( function() {
|
||||||
} );
|
} );
|
||||||
});
|
});
|
||||||
$('#add-telegram').click(function() {
|
$('#add-telegram').click(function() {
|
||||||
$('#error').remove();
|
toastr.clear();
|
||||||
$('.alert-danger').remove();
|
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
|
@ -554,11 +534,7 @@ $( function() {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-telegram").append('<div class="alert alert-danger" style="width: 100%;">'+data+'</div><br /><br />');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$("#checker_table").append(data);
|
$("#checker_table").append(data);
|
||||||
$( ".newgroup" ).addClass( "update", 1000, callbackGroup );
|
$( ".newgroup" ).addClass( "update", 1000, callbackGroup );
|
||||||
|
@ -794,13 +770,13 @@ $( function() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
alert(data)
|
toastr.error(data);
|
||||||
$('#new-email').val('');
|
$('#new-email').val('');
|
||||||
$('#new-password').attr('readonly', false);
|
$('#new-password').attr('readonly', false);
|
||||||
$('#new-password').val('');
|
$('#new-password').val('');
|
||||||
} else {
|
} else {
|
||||||
var json = $.parseJSON(data);
|
var json = $.parseJSON(data);
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('#new-email').val(json[0]);
|
$('#new-email').val(json[0]);
|
||||||
$('#new-username').val(user+'@'+json[1]);
|
$('#new-username').val(user+'@'+json[1]);
|
||||||
$('#new-password').val('aduser');
|
$('#new-password').val('aduser');
|
||||||
|
@ -882,19 +858,16 @@ function addNewSmonServer() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1' || data.indexOf('unique') != '-1') {
|
if (data.indexOf('error') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
$("#ajax").html('<div class="alert alert-danger" style="width: 50%;">'+data+'</div><br /><br />');;
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#ajax-smon").append(data);
|
$("#ajax-smon").append(data);
|
||||||
$(".newserver").addClass( "update", 1000 );
|
$(".newserver").addClass( "update", 1000 );
|
||||||
$( "input[type=submit], button" ).button();
|
$( "input[type=submit], button" ).button();
|
||||||
$( "input[type=checkbox]" ).checkboxradio();
|
$( "input[type=checkbox]" ).checkboxradio();
|
||||||
$( "select" ).selectmenu();
|
$( "select" ).selectmenu();
|
||||||
$.getScript(awesome);
|
$.getScript(awesome);
|
||||||
|
$.getScript('/inc/unsers.js');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( ".newserver" ).removeClass( "update" );
|
$( ".newserver" ).removeClass( "update" );
|
||||||
}, 2500 );
|
}, 2500 );
|
||||||
|
@ -934,13 +907,9 @@ function addUser() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-users").append('<div class="alert alert-danger" style="width: 100%;">'+data+'</div><br /><br />');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.remove();
|
||||||
$("#ajax-users").append(data);
|
$("#ajax-users").append(data);
|
||||||
var getId = new RegExp('[0-9]+');
|
var getId = new RegExp('[0-9]+');
|
||||||
var id = data.match(getId);
|
var id = data.match(getId);
|
||||||
|
@ -953,8 +922,7 @@ function addUser() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function addServer() {
|
function addServer() {
|
||||||
$('#error').remove();
|
toastr.clear()
|
||||||
$('.alert-danger').remove();
|
|
||||||
var valid = true;
|
var valid = true;
|
||||||
var servername = $('#new-server-add').val();
|
var servername = $('#new-server-add').val();
|
||||||
var newip = $('#new-ip').val();
|
var newip = $('#new-ip').val();
|
||||||
|
@ -1004,13 +972,9 @@ function addServer() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-servers").append('<div class="alert alert-danger" style="width: 100%;">'+data+'</div><br /><br />');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear()
|
||||||
$("#ajax-servers").append(data);
|
$("#ajax-servers").append(data);
|
||||||
$(".newserver").addClass( "update", 1000 );
|
$(".newserver").addClass( "update", 1000 );
|
||||||
$( "input[type=submit], button" ).button();
|
$( "input[type=submit], button" ).button();
|
||||||
|
@ -1056,13 +1020,9 @@ function addBackup() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-backup").html('<div class="alert alert-danger" style="width: 50%;">'+data+'</div><br /><br />');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else if (data.indexOf('success') != '-1') {
|
} else if (data.indexOf('success') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.remove();
|
||||||
$("#ajax-backup-table").append(data);
|
$("#ajax-backup-table").append(data);
|
||||||
$(".newbackup").addClass( "update", 1000 );
|
$(".newbackup").addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
@ -1071,8 +1031,8 @@ function addBackup() {
|
||||||
$( "select" ).selectmenu();
|
$( "select" ).selectmenu();
|
||||||
$.getScript(awesome);
|
$.getScript(awesome);
|
||||||
} else if (data.indexOf('info') != '-1') {
|
} else if (data.indexOf('info') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.remove();
|
||||||
$("#ajax-backup").html('<div class="alert alert-info">'+data+'</div><br />');
|
toastr.info(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -1081,7 +1041,7 @@ function addBackup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function updateSettings(param, val) {
|
function updateSettings(param, val) {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
|
@ -1093,13 +1053,9 @@ function updateSettings(param, val) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax").append(data);
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#"+param).parent().parent().addClass( "update", 1000 );
|
$("#"+param).parent().parent().addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#"+param ).parent().parent().removeClass( "update" );
|
$( "#"+param ).parent().parent().removeClass( "update" );
|
||||||
|
@ -1444,13 +1400,13 @@ function removeSmon(id) {
|
||||||
if(data == "Ok ") {
|
if(data == "Ok ") {
|
||||||
$("#smon-"+id).remove();
|
$("#smon-"+id).remove();
|
||||||
} else {
|
} else {
|
||||||
alert(data);
|
toastr.error(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function updateUser(id) {
|
function updateUser(id) {
|
||||||
$('.alert-danger').remove();
|
toastr.remove();
|
||||||
cur_url[0] = cur_url[0].split('#')[0]
|
cur_url[0] = cur_url[0].split('#')[0]
|
||||||
var usergroup = Cookies.get('group');
|
var usergroup = Cookies.get('group');
|
||||||
var activeuser = 0;
|
var activeuser = 0;
|
||||||
|
@ -1472,13 +1428,9 @@ function updateUser(id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-users").append(data);
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.remove();
|
||||||
$("#user-"+id).addClass( "update", 1000 );
|
$("#user-"+id).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#user-"+id ).removeClass( "update" );
|
$( "#user-"+id ).removeClass( "update" );
|
||||||
|
@ -1488,7 +1440,7 @@ function updateUser(id) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function updateGroup(id) {
|
function updateGroup(id) {
|
||||||
$('#error').remove();
|
toastr.clear();
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
|
@ -1501,13 +1453,9 @@ function updateGroup(id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-group").append(data);
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#group-"+id).addClass( "update", 1000 );
|
$("#group-"+id).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#group-"+id ).removeClass( "update" );
|
$( "#group-"+id ).removeClass( "update" );
|
||||||
|
@ -1519,7 +1467,7 @@ function updateGroup(id) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function updateServer(id) {
|
function updateServer(id) {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
var typeip = 0;
|
var typeip = 0;
|
||||||
var enable = 0;
|
var enable = 0;
|
||||||
var haproxy = 0;
|
var haproxy = 0;
|
||||||
|
@ -1560,13 +1508,9 @@ function updateServer(id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-servers").append(data);
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#server-"+id).addClass( "update", 1000 );
|
$("#server-"+id).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#server-"+id ).removeClass( "update" );
|
$( "#server-"+id ).removeClass( "update" );
|
||||||
|
@ -1576,9 +1520,9 @@ function updateServer(id) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function uploadSsh() {
|
function uploadSsh() {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
if ($( "#ssh-key-name option:selected" ).val() == "Choose server" || $('#ssh_cert').val() == '') {
|
if ($( "#ssh-key-name option:selected" ).val() == "Choose server" || $('#ssh_cert').val() == '') {
|
||||||
$("#ajax-ssh").html('<div class="alert alert-danger" style="margin: 10px;">All fields must be completed</div>');
|
toastr.error('All fields must be completed');
|
||||||
} else {
|
} else {
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
|
@ -1591,19 +1535,19 @@ function uploadSsh() {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('danger') != '-1') {
|
if (data.indexOf('danger') != '-1') {
|
||||||
$("#ajax-ssh").html(data);
|
toastr.error(data);
|
||||||
} else if (data.indexOf('success') != '-1') {
|
} else if (data.indexOf('success') != '-1') {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#ajax-ssh").html(data);
|
toastr.success(data)
|
||||||
} else {
|
} else {
|
||||||
$("#ajax-ssh").html('<div class="alert alert-danger">Something wrong, check and try again</div>');
|
toastr.error('Something wrong, check and try again');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function updateSSH(id) {
|
function updateSSH(id) {
|
||||||
$('#error').remove();
|
toastr.clear();
|
||||||
var ssh_enable = 0;
|
var ssh_enable = 0;
|
||||||
if ($('#ssh_enable-'+id).is(':checked')) {
|
if ($('#ssh_enable-'+id).is(':checked')) {
|
||||||
ssh_enable = '1';
|
ssh_enable = '1';
|
||||||
|
@ -1628,13 +1572,9 @@ function updateSSH(id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-ssh").append(data);
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#ssh-table-"+id).addClass( "update", 1000 );
|
$("#ssh-table-"+id).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#ssh-table-"+id ).removeClass( "update" );
|
$( "#ssh-table-"+id ).removeClass( "update" );
|
||||||
|
@ -1648,7 +1588,7 @@ function updateSSH(id) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function updateTelegram(id) {
|
function updateTelegram(id) {
|
||||||
$('#error').remove();
|
toastr.clear();
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
data: {
|
data: {
|
||||||
|
@ -1662,13 +1602,9 @@ function updateTelegram(id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-ssh").append(data);
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#telegram-table-"+id).addClass( "update", 1000 );
|
$("#telegram-table-"+id).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#telegram-table-"+id ).removeClass( "update" );
|
$( "#telegram-table-"+id ).removeClass( "update" );
|
||||||
|
@ -1678,9 +1614,9 @@ function updateTelegram(id) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
function updateBackup(id) {
|
function updateBackup(id) {
|
||||||
$('#error').remove();
|
toastr.clear();
|
||||||
if ($( "#backup-type-"+id+" option:selected" ).val() == "Choose server" || $('#backup-rserver-'+id).val() == '' || $('#backup-rpath-'+id).val() == '') {
|
if ($( "#backup-type-"+id+" option:selected" ).val() == "Choose server" || $('#backup-rserver-'+id).val() == '' || $('#backup-rpath-'+id).val() == '') {
|
||||||
$("#ajax-backup").html('<div class="alert alert-danger" style="margin: 10px;">All fields must be completed</div>');
|
toastr.error('All fields must be completed');
|
||||||
} else {
|
} else {
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
|
@ -1699,13 +1635,9 @@ function updateBackup(id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-backup").html('<div class="alert alert-danger" style="margin: 10px;">'+data+'</div>');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#backup-table-"+id).addClass( "update", 1000 );
|
$("#backup-table-"+id).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#backup-table-"+id ).removeClass( "update" );
|
$( "#backup-table-"+id ).removeClass( "update" );
|
||||||
|
@ -1716,7 +1648,7 @@ function updateBackup(id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function updateSmon(id) {
|
function updateSmon(id) {
|
||||||
$('#error').remove();
|
toastr.clear();
|
||||||
var enable = 0;
|
var enable = 0;
|
||||||
if ($('#smon-enable-'+id).is(':checked')) {
|
if ($('#smon-enable-'+id).is(':checked')) {
|
||||||
enable = '1';
|
enable = '1';
|
||||||
|
@ -1728,7 +1660,7 @@ function updateSmon(id) {
|
||||||
updateSmonPort: $('#smon-port-'+id).val(),
|
updateSmonPort: $('#smon-port-'+id).val(),
|
||||||
updateSmonEn: enable,
|
updateSmonEn: enable,
|
||||||
updateSmonHttp: $('#smon-proto1-'+id).text(),
|
updateSmonHttp: $('#smon-proto1-'+id).text(),
|
||||||
updateSmonBody: $('#smon-body-'+id).val(),
|
updateSmonBody: $('#smon-body-'+id).text(),
|
||||||
updateSmonTelegram: $('#smon-telegram-'+id).val(),
|
updateSmonTelegram: $('#smon-telegram-'+id).val(),
|
||||||
updateSmonGroup: $('#smon-group-'+id).val(),
|
updateSmonGroup: $('#smon-group-'+id).val(),
|
||||||
updateSmonDesc: $('#smon-desc-'+id).val(),
|
updateSmonDesc: $('#smon-desc-'+id).val(),
|
||||||
|
@ -1739,13 +1671,9 @@ function updateSmon(id) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax").html('<div class="alert alert-danger" style="margin: 10px;">'+data+'</div>');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#smon-"+id).addClass( "update", 1000 );
|
$("#smon-"+id).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#smon-"+id ).removeClass( "update" );
|
$( "#smon-"+id ).removeClass( "update" );
|
||||||
|
@ -1778,12 +1706,12 @@ function showApacheLog(serv) {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#ajax").html(data);
|
$("#ajax").html(data);
|
||||||
window.history.pushState("Logs", "Logs", cur_url[0]+"?serv="+serv+"&rows1="+rows+"&grep="+grep+
|
window.history.pushState("Logs", "Logs", cur_url[0] + "?serv=" + serv + "&rows1=" + rows + "&grep=" + grep +
|
||||||
'&exgrep='+exgrep+
|
'&exgrep=' + exgrep +
|
||||||
'&hour='+hour+
|
'&hour=' + hour +
|
||||||
'&minut='+minut+
|
'&minut=' + minut +
|
||||||
'&hour1='+hour1+
|
'&hour1=' + hour1 +
|
||||||
'&minut1='+minut1);
|
'&minut1=' + minut1);
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -1798,15 +1726,11 @@ function checkSshConnect(ip) {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#checkSshConnect").html(data);
|
toastr.error(data)
|
||||||
} else {
|
} else {
|
||||||
$("#checkSshConnect").html("<div class='alert alert-success' style='margin: 0; margin-left: 15px;'>Connect is accepted<a title='Close' id='errorMess'><b>X</b></a></div>");
|
toastr.clear();
|
||||||
|
toastr.success('Connect is accepted');
|
||||||
}
|
}
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
$('.alert-success').remove();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -1862,13 +1786,9 @@ function changeUserPassword(id, d) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1') {
|
if (data.indexOf('error') != '-1') {
|
||||||
$("#ajax-users").append(data);
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$("#user-"+id).addClass( "update", 1000 );
|
$("#user-"+id).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( "#user-"+id ).removeClass( "update" );
|
$( "#user-"+id ).removeClass( "update" );
|
||||||
|
@ -1889,9 +1809,9 @@ function changeUserGroupDialog(id) {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
if (data.indexOf('danger') != '-1') {
|
if (data.indexOf('danger') != '-1') {
|
||||||
$("#ajax").html(data);
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('#change-user-groups-form').html(data);
|
$('#change-user-groups-form').html(data);
|
||||||
$( "#change-user-groups-dialog" ).dialog({
|
$( "#change-user-groups-dialog" ).dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
|
@ -1925,10 +1845,14 @@ function changeUserGroup(id) {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#user-"+id).addClass( "update", 1000 );
|
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
|
||||||
setTimeout(function() {
|
toastr.error(data);
|
||||||
$( "#user-"+id ).removeClass( "update" );
|
} else {
|
||||||
}, 2500 );
|
$("#user-" + id).addClass("update", 1000);
|
||||||
|
setTimeout(function () {
|
||||||
|
$("#user-" + id).removeClass("update");
|
||||||
|
}, 2500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -1943,10 +1867,14 @@ function addUserGroup(id) {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$("#user-"+id).addClass( "update", 1000 );
|
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
|
||||||
setTimeout(function() {
|
toastr.error(data);
|
||||||
$( "#user-"+id ).removeClass( "update" );
|
} else {
|
||||||
}, 2500 );
|
$("#user-" + id).addClass("update", 1000);
|
||||||
|
setTimeout(function () {
|
||||||
|
$("#user-" + id).removeClass("update");
|
||||||
|
}, 2500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
46
inc/waf.js
46
inc/waf.js
|
@ -66,19 +66,13 @@ function installWaf(ip1) {
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace(/\s+/g,' ');
|
data = data.replace(/\s+/g,' ');
|
||||||
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
|
if (data.indexOf('error') != '-1' || data.indexOf('Failed') != '-1') {
|
||||||
$("#ajax").html('<div class="alert alert-danger" style="margin: 15px;">'+data+'</data>');
|
toastr.error(data);
|
||||||
$('#errorMess').click(function() {
|
|
||||||
$('#error').remove();
|
|
||||||
$('.alert-danger').remove();
|
|
||||||
});
|
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.info(data);
|
||||||
$("#ajax").html('<div class="alert alert-info">'+data+'</data>');
|
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
$('.alert-danger').remove();
|
toastr.clear();
|
||||||
$('.alert-warning').remove();
|
toastr.success('WAF service has installed');
|
||||||
$("#ajax").html('<div class="alert alert-success">WAF service has installed</data>');
|
|
||||||
showOverviewWaf(ip, hostnamea)
|
showOverviewWaf(ip, hostnamea)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +90,7 @@ function changeWafMode(id) {
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
alert('Do not forget restart WAF server: '+server_hostname)
|
toastr.info('Do not forget restart WAF service');
|
||||||
$( '#'+server_hostname+'-select-line' ).addClass( "update", 1000 );
|
$( '#'+server_hostname+'-select-line' ).addClass( "update", 1000 );
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$( '#'+server_hostname+'-select-line' ).removeClass( "update" );
|
$( '#'+server_hostname+'-select-line' ).removeClass( "update" );
|
||||||
|
@ -104,3 +98,31 @@ function changeWafMode(id) {
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
$( function() {
|
||||||
|
$( "#waf_rules input" ).change(function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
waf_rules_en(id[1])
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function waf_rules_en(id) {
|
||||||
|
var enable = 0;
|
||||||
|
if ($('#rule_id-'+id).is(':checked')) {
|
||||||
|
enable = '1';
|
||||||
|
}
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
waf_rule_id: id,
|
||||||
|
waf_en: enable,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function( data ) {
|
||||||
|
toastr.info('Do not forget restart WAF service');
|
||||||
|
$( '#rule-'+id ).addClass( "update", 1000 );
|
||||||
|
setTimeout(function() {
|
||||||
|
$( '#rule-'+id ).removeClass( "update" );
|
||||||
|
}, 2500 );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
Loading…
Reference in New Issue