mirror of https://github.com/Aidaho12/haproxy-wi
				
				
				
			
							parent
							
								
									cd36944153
								
							
						
					
					
						commit
						0dd4142945
					
				| 
						 | 
				
			
			@ -748,7 +748,8 @@ def update_db_v_5_2_5(**kwargs):
 | 
			
		|||
			else:
 | 
			
		||||
				print("An error occurred:", e)
 | 
			
		||||
	else:
 | 
			
		||||
		print("Updating... DB has been updated to version 5.2.5")
 | 
			
		||||
		if kwargs.get('silent') != 1:
 | 
			
		||||
			print("Updating... DB has been updated to version 5.2.5")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_db_v_5_2_5_1(**kwargs):
 | 
			
		||||
| 
						 | 
				
			
			@ -758,7 +759,8 @@ def update_db_v_5_2_5_1(**kwargs):
 | 
			
		|||
	except Exception as e:
 | 
			
		||||
		print("An error occurred:", e)
 | 
			
		||||
	else:
 | 
			
		||||
		print("Updating... DB has been updated to version 5.2.5-1")
 | 
			
		||||
		if kwargs.get('silent') != 1:
 | 
			
		||||
			print("Updating... DB has been updated to version 5.2.5-1")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_db_v_5_2_5_2(**kwargs):
 | 
			
		||||
| 
						 | 
				
			
			@ -768,7 +770,23 @@ def update_db_v_5_2_5_2(**kwargs):
 | 
			
		|||
	except Exception as e:
 | 
			
		||||
		print("An error occurred:", e)
 | 
			
		||||
	else:
 | 
			
		||||
		print("Updating... DB has been updated to version 5.2.5-2")
 | 
			
		||||
		if kwargs.get('silent') != 1:
 | 
			
		||||
			print("Updating... DB has been updated to version 5.2.5-2")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_db_v_5_2_5_3(**kwargs):
 | 
			
		||||
	cursor = conn.cursor()
 | 
			
		||||
	sql = list()
 | 
			
		||||
	sql.append("alter table user add column last_login_date timestamp default '0000-00-00 00:00:00'")
 | 
			
		||||
	sql.append("alter table user add column last_login_ip VARCHAR ( 64 )")
 | 
			
		||||
	for i in sql:
 | 
			
		||||
		try:
 | 
			
		||||
			cursor.execute(i)
 | 
			
		||||
		except:
 | 
			
		||||
			pass
 | 
			
		||||
	else:
 | 
			
		||||
		if kwargs.get('silent') != 1:
 | 
			
		||||
			print('Updating... DB has been updated to version 5.2.5-3')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_ver():
 | 
			
		||||
| 
						 | 
				
			
			@ -803,6 +821,7 @@ def update_all():
 | 
			
		|||
	update_db_v_5_2_5()
 | 
			
		||||
	update_db_v_5_2_5_1()
 | 
			
		||||
	update_db_v_5_2_5_2()
 | 
			
		||||
	update_db_v_5_2_5_3()
 | 
			
		||||
	update_ver()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -830,6 +849,7 @@ def update_all_silent():
 | 
			
		|||
	update_db_v_5_2_5(silent=1)
 | 
			
		||||
	update_db_v_5_2_5_1(silent=1)
 | 
			
		||||
	update_db_v_5_2_5_2(silent=1)
 | 
			
		||||
	update_db_v_5_2_5_3(silent=1)
 | 
			
		||||
	update_ver()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,8 @@ class User(BaseModel):
 | 
			
		|||
    ldap_user = IntegerField(default=0)
 | 
			
		||||
    activeuser = IntegerField(default=1)
 | 
			
		||||
    user_services = CharField(constraints=[SQL('DEFAULT "1 2 3"')])
 | 
			
		||||
    last_login_date = DateTimeField(default=datetime.now)
 | 
			
		||||
    last_login_ip = CharField()
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        table_name = 'user'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										37
									
								
								app/funct.py
								
								
								
								
							
							
						
						
									
										37
									
								
								app/funct.py
								
								
								
								
							| 
						 | 
				
			
			@ -58,6 +58,16 @@ def get_data(log_type, **kwargs):
 | 
			
		|||
			now_utc = datetime.now(timezone(sql.get_setting('time_zone'))) - timedelta(days=kwargs.get('timedelta_minus'))
 | 
			
		||||
		except Exception:
 | 
			
		||||
			now_utc = datetime.now(timezone('UTC')) - timedelta(days=kwargs.get('timedelta_minus'))
 | 
			
		||||
	elif kwargs.get('timedelta_minutes'):
 | 
			
		||||
		try:
 | 
			
		||||
			now_utc = datetime.now(timezone(sql.get_setting('time_zone'))) + timedelta(minutes=kwargs.get('timedelta_minutes'))
 | 
			
		||||
		except Exception:
 | 
			
		||||
			now_utc = datetime.now(timezone('UTC')) + timedelta(minutes=kwargs.get('timedelta_minutes'))
 | 
			
		||||
	elif kwargs.get('timedelta_minutes_minus'):
 | 
			
		||||
		try:
 | 
			
		||||
			now_utc = datetime.now(timezone(sql.get_setting('time_zone'))) - timedelta(minutes=kwargs.get('timedelta_minutes_minus'))
 | 
			
		||||
		except Exception:
 | 
			
		||||
			now_utc = datetime.now(timezone('UTC')) - timedelta(minutes=kwargs.get('timedelta_minutes_minus'))
 | 
			
		||||
	else:
 | 
			
		||||
		try:
 | 
			
		||||
			now_utc = datetime.now(timezone(sql.get_setting('time_zone')))
 | 
			
		||||
| 
						 | 
				
			
			@ -242,7 +252,6 @@ def check_login(**kwargs):
 | 
			
		|||
	sql.delete_old_uuid()
 | 
			
		||||
 | 
			
		||||
	if user_uuid is not None:
 | 
			
		||||
		sql.update_last_act_user(user_uuid.value)
 | 
			
		||||
		if sql.get_user_name_by_uuid(user_uuid.value) is None:
 | 
			
		||||
			print('<meta http-equiv="refresh" content="0; url=login.py?ref=%s">' % ref)
 | 
			
		||||
			return False
 | 
			
		||||
| 
						 | 
				
			
			@ -255,6 +264,9 @@ def check_login(**kwargs):
 | 
			
		|||
			else:
 | 
			
		||||
				print('<meta http-equiv="refresh" content="0; url=overview.py">')
 | 
			
		||||
				return False
 | 
			
		||||
 | 
			
		||||
		user, user_uuid, role, token, servers, user_services = get_users_params()
 | 
			
		||||
		sql.update_last_act_user(user_uuid.value, token)
 | 
			
		||||
	else:
 | 
			
		||||
		print('<meta http-equiv="refresh" content="0; url=login.py?ref=%s">' % ref)
 | 
			
		||||
		return False
 | 
			
		||||
| 
						 | 
				
			
			@ -336,11 +348,11 @@ def ssh_connect(serv):
 | 
			
		|||
 | 
			
		||||
	try:
 | 
			
		||||
		if ssh_enable == 1:
 | 
			
		||||
			cloud = sql.is_cloud()
 | 
			
		||||
			if cloud != '':
 | 
			
		||||
				k = paramiko.pkey.load_private_key_file(ssh_key_name, password=cloud)
 | 
			
		||||
			else:
 | 
			
		||||
				k = paramiko.pkey.load_private_key_file(ssh_key_name)
 | 
			
		||||
			# cloud = sql.is_cloud()
 | 
			
		||||
			# if cloud != '':
 | 
			
		||||
			# 	k = paramiko.pkey.load_private_key_file(ssh_key_name, password=cloud)
 | 
			
		||||
			# else:
 | 
			
		||||
			k = paramiko.pkey.load_private_key_file(ssh_key_name)
 | 
			
		||||
			ssh.connect(hostname=serv, port=ssh_port, username=ssh_user_name, pkey=k, timeout=11, banner_timeout=200)
 | 
			
		||||
		else:
 | 
			
		||||
			ssh.connect(hostname=serv, port=ssh_port, username=ssh_user_name, password=ssh_user_password, timeout=11, banner_timeout=200)
 | 
			
		||||
| 
						 | 
				
			
			@ -736,15 +748,14 @@ def install_nginx(serv, **kwargs):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def update_haproxy_wi(service):
 | 
			
		||||
	if service != 'roxy-wi':
 | 
			
		||||
		try:
 | 
			
		||||
			if service != 'keep_alive':
 | 
			
		||||
				service = service.split('_')[0]
 | 
			
		||||
		except Exception:
 | 
			
		||||
			pass
 | 
			
		||||
	import distro
 | 
			
		||||
	if distro.id() == 'ubuntu':
 | 
			
		||||
		cmd = 'sudo apt-get update && sudo apt-get install ' + service +' && sudo systemctl restart ' + service
 | 
			
		||||
		try:
 | 
			
		||||
			if service == 'roxy-wi-keep_alive':
 | 
			
		||||
				service = 'roxy-wi-keep-alive'
 | 
			
		||||
		except Exception:
 | 
			
		||||
			pass
 | 
			
		||||
		cmd = 'sudo -S apt-get update && sudo apt-get install ' + service +' && sudo systemctl restart ' + service
 | 
			
		||||
	else:
 | 
			
		||||
		cmd = 'sudo -S yum -y update ' + service +' && sudo systemctl restart ' + service
 | 
			
		||||
	output, stderr = subprocess_execute(cmd)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -281,15 +281,15 @@ if form.getvalue('list_select_id') is not None:
 | 
			
		|||
if form.getvalue('list_id_for_delete') is not None:
 | 
			
		||||
    haproxy_sock_port = sql.get_setting('haproxy_sock_port')
 | 
			
		||||
    lists_path = sql.get_setting('lists_path')
 | 
			
		||||
    fullpath = funct.get_config_var('main', 'fullpath')
 | 
			
		||||
    full_path = funct.get_config_var('main', 'fullpath')
 | 
			
		||||
    ip_id = form.getvalue('list_ip_id_for_delete')
 | 
			
		||||
    ip = form.getvalue('list_ip_for_delete')
 | 
			
		||||
    list_id = form.getvalue('list_id_for_delete')
 | 
			
		||||
    list_name = form.getvalue('list_name')
 | 
			
		||||
    user_group = funct.get_user_group(id=1)
 | 
			
		||||
 | 
			
		||||
    cmd = "sed -i 's!%s$!!' %s/%s/%s/%s" % (ip, fullpath, lists_path, user_group, list_name)
 | 
			
		||||
    cmd1 = "sed -i '/^$/d' %s/%s/%s/%s" % (fullpath, lists_path, user_group, list_name)
 | 
			
		||||
    cmd = "sed -i 's!%s$!!' %s/%s/%s/%s" % (ip, full_path, lists_path, user_group, list_name)
 | 
			
		||||
    cmd1 = "sed -i '/^$/d' %s/%s/%s/%s" % (full_path, lists_path, user_group, list_name)
 | 
			
		||||
    output, stderr = funct.subprocess_execute(cmd)
 | 
			
		||||
    output1, stderr1 = funct.subprocess_execute(cmd1)
 | 
			
		||||
    if output:
 | 
			
		||||
| 
						 | 
				
			
			@ -2176,11 +2176,11 @@ if form.getvalue('ssh_cert'):
 | 
			
		|||
    ssh_keys = full_dir + name + '.pem'
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        cloud = sql.is_cloud()
 | 
			
		||||
        if cloud != '':
 | 
			
		||||
            key.write_private_key_file(ssh_keys, password=cloud)
 | 
			
		||||
        else:
 | 
			
		||||
            key.write_private_key_file(ssh_keys)
 | 
			
		||||
        # cloud = sql.is_cloud()
 | 
			
		||||
        # if cloud != '':
 | 
			
		||||
        #     key.write_private_key_file(ssh_keys, password=cloud)
 | 
			
		||||
        # else:
 | 
			
		||||
        key.write_private_key_file(ssh_keys)
 | 
			
		||||
    except IOError as e:
 | 
			
		||||
        print('error: Cannot save SSH key file. ', str(e))
 | 
			
		||||
    else:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,7 @@ try:
 | 
			
		|||
 | 
			
		||||
			i += 1
 | 
			
		||||
 | 
			
		||||
		cmd = "ps ax |grep 'metrics_worker\|metrics_waf_worker.py'|grep -v grep|grep '%s' |wc -l" % servers_for_grep
 | 
			
		||||
		cmd = "ps ax |grep 'metrics_worker\|metrics_waf_worker.py\|metrics_nginx_worker.py'|grep -v grep|grep '%s' |wc -l" % servers_for_grep
 | 
			
		||||
		metrics_worker, stderr = funct.subprocess_execute(cmd)
 | 
			
		||||
		cmd = "ps ax |grep 'checker_worker\|checker_nginx'|grep -v grep |grep '%s' |wc -l" % servers_for_grep
 | 
			
		||||
		checker_worker, stderr = funct.subprocess_execute(cmd)
 | 
			
		||||
| 
						 | 
				
			
			@ -49,8 +49,8 @@ try:
 | 
			
		|||
		prometheus = ''
 | 
			
		||||
		host = ''
 | 
			
		||||
	else:
 | 
			
		||||
		users = sql.select_users()
 | 
			
		||||
		cmd = "ps ax |grep 'metrics_worker\|metrics_waf_worker.py' |grep -v grep |wc -l"
 | 
			
		||||
		users = sql.select_users(online=1)
 | 
			
		||||
		cmd = "ps ax |grep 'metrics_worker\|metrics_waf_worker.py\|metrics_nginx_worker.py' |grep -v grep |wc -l"
 | 
			
		||||
		metrics_worker, stderr = funct.subprocess_execute(cmd)
 | 
			
		||||
		cmd = "ps ax |grep 'checker_worker\|checker_nginx' |grep -v grep |wc -l"
 | 
			
		||||
		checker_worker, stderr = funct.subprocess_execute(cmd)
 | 
			
		||||
| 
						 | 
				
			
			@ -80,7 +80,7 @@ try:
 | 
			
		|||
	cmd = "systemctl is-active roxy-wi-portscanner"
 | 
			
		||||
	port_scanner, stderr = funct.subprocess_execute(cmd)
 | 
			
		||||
 | 
			
		||||
except:
 | 
			
		||||
except Exception as e:
 | 
			
		||||
	role = ''
 | 
			
		||||
	user = ''
 | 
			
		||||
	users = ''
 | 
			
		||||
| 
						 | 
				
			
			@ -101,6 +101,7 @@ except:
 | 
			
		|||
	is_checker_worker = ''
 | 
			
		||||
	is_metrics_worker = ''
 | 
			
		||||
	token = ''
 | 
			
		||||
	print(str(e))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
template = template.render(h2=1,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										32
									
								
								app/sql.py
								
								
								
								
							
							
						
						
									
										32
									
								
								app/sql.py
								
								
								
								
							| 
						 | 
				
			
			@ -313,8 +313,18 @@ def select_users(**kwargs):
 | 
			
		|||
				 join(UserGroups, on=(User.user_id == UserGroups.user_id)).
 | 
			
		||||
				 where(UserGroups.user_group_id == kwargs.get("group"))
 | 
			
		||||
				 )
 | 
			
		||||
	elif kwargs.get('online') is not None:
 | 
			
		||||
		query = (User.
 | 
			
		||||
				 select(
 | 
			
		||||
					User,
 | 
			
		||||
					Case(0, [((
 | 
			
		||||
						User.last_login_date >= funct.get_data('regular', timedelta_minutes_minus=15)
 | 
			
		||||
							  ), 0)], 1).alias('last_login')
 | 
			
		||||
				)
 | 
			
		||||
			)
 | 
			
		||||
	else:
 | 
			
		||||
		query = User.select().order_by(User.user_id)
 | 
			
		||||
 | 
			
		||||
	try:
 | 
			
		||||
		query_res = query.execute()
 | 
			
		||||
	except Exception as e:
 | 
			
		||||
| 
						 | 
				
			
			@ -490,15 +500,13 @@ def write_user_uuid(login, user_uuid):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def write_user_token(login, user_token):
 | 
			
		||||
	token_ttl = int(get_setting('token_ttl'))
 | 
			
		||||
 | 
			
		||||
	try:
 | 
			
		||||
		user_id = User.get(User.username == login)
 | 
			
		||||
	except Exception as e:
 | 
			
		||||
		out_error(e)
 | 
			
		||||
 | 
			
		||||
	try:
 | 
			
		||||
		Token.insert(user_id=user_id, token=user_token, exp=funct.get_data('regular', timedelta=token_ttl)).execute()
 | 
			
		||||
		Token.insert(user_id=user_id, token=user_token, exp=funct.get_data('regular')).execute()
 | 
			
		||||
	except Exception as e:
 | 
			
		||||
		out_error(e)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -570,8 +578,9 @@ def delete_uuid(uuid):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def delete_old_uuid():
 | 
			
		||||
	token_ttl = int(get_setting('token_ttl'))
 | 
			
		||||
	query = UUID.delete().where((UUID.exp < funct.get_data('regular')) | (UUID.exp.is_null(True)) )
 | 
			
		||||
	query1 = Token.delete().where((Token.exp < funct.get_data('regular')) | (Token.exp.is_null(True)) )
 | 
			
		||||
	query1 = Token.delete().where((Token.exp > funct.get_data('regular', timedelta=token_ttl)) | (Token.exp.is_null(True)) )
 | 
			
		||||
	try:
 | 
			
		||||
		query.execute()
 | 
			
		||||
		query1.execute()
 | 
			
		||||
| 
						 | 
				
			
			@ -579,12 +588,25 @@ def delete_old_uuid():
 | 
			
		|||
		out_error(e)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def update_last_act_user(uuid):
 | 
			
		||||
def update_last_act_user(uuid, token):
 | 
			
		||||
	session_ttl = int(get_setting('session_ttl'))
 | 
			
		||||
	token_ttl = int(get_setting('token_ttl'))
 | 
			
		||||
	try:
 | 
			
		||||
		import cgi
 | 
			
		||||
		import os
 | 
			
		||||
		ip = cgi.escape(os.environ["REMOTE_ADDR"])
 | 
			
		||||
	except Exception:
 | 
			
		||||
		ip = ''
 | 
			
		||||
 | 
			
		||||
	user_id = get_user_id_by_uuid(uuid)
 | 
			
		||||
 | 
			
		||||
	query = UUID.update(exp=funct.get_data('regular', timedelta=session_ttl)).where(UUID.uuid == uuid)
 | 
			
		||||
	query1 = Token.update(exp=funct.get_data('regular', timedelta=token_ttl)).where(Token.token == token)
 | 
			
		||||
	query2 = User.update(last_login_date=funct.get_data('regular'), last_login_ip=ip).where(User.user_id == user_id)
 | 
			
		||||
	try:
 | 
			
		||||
		query.execute()
 | 
			
		||||
		query1.execute()
 | 
			
		||||
		query2.execute()
 | 
			
		||||
	except Exception as e:
 | 
			
		||||
		out_error(e)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -286,9 +286,16 @@
 | 
			
		|||
	</tr>
 | 
			
		||||
</table>
 | 
			
		||||
{% if role <= 2 %}
 | 
			
		||||
	{% if role == 2 %}
 | 
			
		||||
		{% set admin_uri = 'servers.py' %}
 | 
			
		||||
	{% elif role == 1 %}
 | 
			
		||||
		{% set admin_uri = 'users.py' %}
 | 
			
		||||
	{% endif %}
 | 
			
		||||
	<table class="overview-wi">
 | 
			
		||||
		<tr class="overviewHead">
 | 
			
		||||
			<td class="padding10 first-collumn-wi">Login</td>
 | 
			
		||||
			<td class="padding10 first-collumn-wi">
 | 
			
		||||
				<a href="{{admin_uri}}#users" title="Manage users" class="logs_link">Login</a>
 | 
			
		||||
			</td>
 | 
			
		||||
			<td class="second-collumn">Groups</td>
 | 
			
		||||
			<td>Role</td>
 | 
			
		||||
			<td>
 | 
			
		||||
| 
						 | 
				
			
			@ -299,20 +306,18 @@
 | 
			
		|||
				</span>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
		{% if role == 2 %}
 | 
			
		||||
			{% set admin_uri = 'servers.py' %}
 | 
			
		||||
		{% elif role == 1 %}
 | 
			
		||||
			{% set admin_uri = 'users.py' %}
 | 
			
		||||
		{% endif %}
 | 
			
		||||
		{% set counter = 0 %}
 | 
			
		||||
		{% for USER in users %}
 | 
			
		||||
			{% set counter = counter + loop.index0 %}
 | 
			
		||||
			{% if counter <= 2 %}
 | 
			
		||||
				<tr class="{{ loop.cycle('odd', 'even') }}">
 | 
			
		||||
					<td class="padding10 first-collumn-wi"> 
 | 
			
		||||
						<a href="{{admin_uri}}#users" title="Edit user" class="logs_link div-pic">
 | 
			
		||||
							{{ USER.username }}
 | 
			
		||||
						</a>
 | 
			
		||||
					<td class="padding10 first-collumn-wi">
 | 
			
		||||
						{% if USER.last_login %}
 | 
			
		||||
						<span class="serverUp" style="margin-right: 5px;" title="{{USER.username}} is online"></span>
 | 
			
		||||
						{% else %}
 | 
			
		||||
						<span class="serverNone" style="margin-right: 5px;" title="{{USER.username}} is offline"></span>
 | 
			
		||||
						{% endif %}
 | 
			
		||||
						{{ USER.username }}
 | 
			
		||||
					</td>
 | 
			
		||||
					<td class="third-collumn-wi">
 | 
			
		||||
						{% for group in users_groups %}
 | 
			
		||||
| 
						 | 
				
			
			@ -326,9 +331,12 @@
 | 
			
		|||
			{% else %}
 | 
			
		||||
				<tr style="display: none;" class="show-users {{ loop.cycle('odd', 'even') }}">
 | 
			
		||||
					<td class="padding10 first-collumn-wi"> 
 | 
			
		||||
						<a href="users.py#users" title="Edit user" class="logs_link div-pic">
 | 
			
		||||
							{{ USER.username }}
 | 
			
		||||
						</a>
 | 
			
		||||
						{% if USER.last_login %}
 | 
			
		||||
						<span class="serverUp" style="margin-right: 5px;" title="{{USER.username}} is online"></span>
 | 
			
		||||
						{% else %}
 | 
			
		||||
						<span class="serverNone" style="margin-right: 5px;" title="{{USER.username}} is offline"></span>
 | 
			
		||||
						{% endif %}
 | 
			
		||||
						{{ USER.username }}
 | 
			
		||||
					</td>
 | 
			
		||||
					<td class="third-collumn-wi">
 | 
			
		||||
						{% for group in users_groups %}
 | 
			
		||||
| 
						 | 
				
			
			@ -346,7 +354,9 @@
 | 
			
		|||
{% if role <= 1 %}
 | 
			
		||||
	<table class="overview-wi">
 | 
			
		||||
		<tr class="overviewHead">
 | 
			
		||||
			<td class="padding10 first-collumn-wi">Group</td> 
 | 
			
		||||
			<td class="padding10 first-collumn-wi">
 | 
			
		||||
				<a href="users.py#groups" title="Manage groups" class="logs_link">Group</a>
 | 
			
		||||
			</td>
 | 
			
		||||
			<td class="second-collumn" style="width: 40%">Description</td>
 | 
			
		||||
			<td>
 | 
			
		||||
			<span class="add-button-wi">
 | 
			
		||||
| 
						 | 
				
			
			@ -362,18 +372,14 @@
 | 
			
		|||
			{% if counter <= 2 %}
 | 
			
		||||
			<tr class="{{ loop.cycle('odd', 'even') }}">
 | 
			
		||||
				<td class="padding10 first-collumn-wi"> 
 | 
			
		||||
					<a href="users.py#groups" title="Edit groups" class="logs_link div-pic">
 | 
			
		||||
							{{ group.name }}
 | 
			
		||||
					</a>			
 | 
			
		||||
					{{ group.name }}
 | 
			
		||||
				</td>
 | 
			
		||||
				<td class="third-collumn-wi" colspan="2">{{ group.description }}</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			{% else %}
 | 
			
		||||
			<tr style="display: none;" class="show-groups {{ loop.cycle('odd', 'even') }}">
 | 
			
		||||
				<td class="padding10 first-collumn-wi"> 
 | 
			
		||||
					<a href="users.py#groups" title="Edit groups" class="logs_link div-pic">
 | 
			
		||||
							{{ group.name }}
 | 
			
		||||
					</a>			
 | 
			
		||||
				<td class="padding10 first-collumn-wi">
 | 
			
		||||
					{{ group.name }}
 | 
			
		||||
				</td>
 | 
			
		||||
				<td class="third-collumn-wi" colspan="2">{{ group.description }}</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								inc/add.js
								
								
								
								
							
							
						
						
									
										10
									
								
								inc/add.js
								
								
								
								
							| 
						 | 
				
			
			@ -1527,7 +1527,7 @@ function createList(color) {
 | 
			
		|||
		},
 | 
			
		||||
		type: "POST",
 | 
			
		||||
		success: function( data ) {
 | 
			
		||||
			if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
 | 
			
		||||
			if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1' || data.indexOf('Errno') != '-1') {
 | 
			
		||||
				toastr.error(data);
 | 
			
		||||
			} else if (data.indexOf('Info') != '-1' ){
 | 
			
		||||
				toastr.clear();
 | 
			
		||||
| 
						 | 
				
			
			@ -1591,8 +1591,8 @@ function editList(list, color) {
 | 
			
		|||
}
 | 
			
		||||
function saveList(action, list, color) {
 | 
			
		||||
	var serv = $( "#serv-"+color+"-list option:selected" ).val();
 | 
			
		||||
	if (serv == 'Choose server') {
 | 
			
		||||
		toastr.warning('Choose a server before updating');
 | 
			
		||||
	if (serv == '------') {
 | 
			
		||||
		toastr.warning('Select a server before updating');
 | 
			
		||||
	} else {
 | 
			
		||||
		$.ajax({
 | 
			
		||||
			url: "options.py",
 | 
			
		||||
| 
						 | 
				
			
			@ -1611,7 +1611,7 @@ function saveList(action, list, color) {
 | 
			
		|||
 | 
			
		||||
				for (i = 0; i < data.length; i++) {
 | 
			
		||||
					if (data[i]) {
 | 
			
		||||
						if (data[i].indexOf('error: ') != '-1') {
 | 
			
		||||
						if (data[i].indexOf('error: ') != '-1' || data[i].indexOf('Errno') != '-1') {
 | 
			
		||||
							toastr.error(data[i]);
 | 
			
		||||
						} else {
 | 
			
		||||
							toastr.success(data[i]);
 | 
			
		||||
| 
						 | 
				
			
			@ -1638,7 +1638,7 @@ function deleteList(list, color) {
 | 
			
		|||
			},
 | 
			
		||||
			type: "POST",
 | 
			
		||||
			success: function (data) {
 | 
			
		||||
				if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
 | 
			
		||||
				if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1' || data.indexOf('Errno') != '-1') {
 | 
			
		||||
					toastr.error(data);
 | 
			
		||||
				} else if (data.indexOf('Info') != '-1' ){
 | 
			
		||||
					toastr.clear();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2117,7 +2117,7 @@ function updateService(service) {
 | 
			
		|||
				toastr.error(data);
 | 
			
		||||
			} else if (data.indexOf('Complete!') != '-1'){
 | 
			
		||||
				toastr.clear();
 | 
			
		||||
				toastr.success('Update was success!');
 | 
			
		||||
				toastr.success(service + ' has been updated');
 | 
			
		||||
			} else if (data.indexOf('Unauthorized') != '-1') {
 | 
			
		||||
				toastr.clear();
 | 
			
		||||
				toastr.error('It seems like Unauthorized in the Roxy-WI repository. How to get Roxy-WI auth you can read <b><a href="https://haproxy-wi.org/installation.py" title="How to get Roxy-WI auth">hear</a></b>');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue