mirror of https://github.com/Aidaho12/haproxy-wi
parent
d82b65e7d1
commit
ee4631f214
|
@ -5,21 +5,7 @@ import modules.tools.common as tools_common
|
|||
import modules.roxywi.common as roxywi_common
|
||||
|
||||
|
||||
def load_checker() -> None:
|
||||
groups = sql.select_groups()
|
||||
services = tools_common.get_services_status()
|
||||
keepalived_settings = ''
|
||||
haproxy_settings = ''
|
||||
apache_settings = ''
|
||||
nginx_settings = ''
|
||||
keepalived_servers = ''
|
||||
haproxy_servers = ''
|
||||
apache_servers = ''
|
||||
nginx_servers = ''
|
||||
telegrams = ''
|
||||
slacks = ''
|
||||
pds = ''
|
||||
|
||||
def load_checker() -> str:
|
||||
try:
|
||||
user_subscription = roxywi_common.return_user_status()
|
||||
except Exception as e:
|
||||
|
@ -31,27 +17,28 @@ def load_checker() -> None:
|
|||
except Exception:
|
||||
return redirect(url_for('login_page'))
|
||||
|
||||
if user_subscription['user_status']:
|
||||
haproxy_settings = sql.select_checker_settings(1)
|
||||
nginx_settings = sql.select_checker_settings(2)
|
||||
keepalived_settings = sql.select_checker_settings(3)
|
||||
apache_settings = sql.select_checker_settings(4)
|
||||
user_group = roxywi_common.get_user_group(id=1)
|
||||
telegrams = sql.get_user_telegram_by_group(user_group)
|
||||
slacks = sql.get_user_slack_by_group(user_group)
|
||||
pds = sql.get_user_pd_by_group(user_group)
|
||||
haproxy_servers = roxywi_common.get_dick_permit(haproxy=1, only_group=1)
|
||||
nginx_servers = roxywi_common.get_dick_permit(nginx=1, only_group=1)
|
||||
apache_servers = roxywi_common.get_dick_permit(apache=1, only_group=1)
|
||||
keepalived_servers = roxywi_common.get_dick_permit(keepalived=1, only_group=1)
|
||||
kwargs = {
|
||||
'user_subscription': user_subscription,
|
||||
'user_params': user_params,
|
||||
'lang': user_params['lang']
|
||||
}
|
||||
|
||||
return render_template(
|
||||
'ajax/load_telegram.html', services=services, telegrams=telegrams, pds=pds, groups=groups, slacks=slacks,
|
||||
user_status=user_subscription['user_status'], user_plan=user_subscription['user_plan'], haproxy_servers=haproxy_servers,
|
||||
nginx_servers=nginx_servers, apache_servers=apache_servers, keepalived_servers=keepalived_servers, haproxy_settings=haproxy_settings,
|
||||
nginx_settings=nginx_settings, keepalived_settings=keepalived_settings, apache_settings=apache_settings,
|
||||
role=user_params['role'], lang=user_params['lang']
|
||||
)
|
||||
if user_subscription['user_status']:
|
||||
user_group = roxywi_common.get_user_group(id=1)
|
||||
kwargs.setdefault('services', tools_common.get_services_status())
|
||||
kwargs.setdefault('telegrams', sql.get_user_telegram_by_group(user_group))
|
||||
kwargs.setdefault('pds', sql.get_user_pd_by_group(user_group))
|
||||
kwargs.setdefault('groups', sql.select_groups())
|
||||
kwargs.setdefault('slacks', sql.get_user_slack_by_group(user_group))
|
||||
kwargs.setdefault('haproxy_servers', roxywi_common.get_dick_permit(haproxy=1, only_group=1))
|
||||
kwargs.setdefault('nginx_servers', roxywi_common.get_dick_permit(nginx=1, only_group=1))
|
||||
kwargs.setdefault('apache_servers', roxywi_common.get_dick_permit(apache=1, only_group=1))
|
||||
kwargs.setdefault('keepalived_servers', roxywi_common.get_dick_permit(keepalived=1, only_group=1))
|
||||
kwargs.setdefault('user_subscription', user_subscription)
|
||||
kwargs.setdefault('user_params', user_params)
|
||||
kwargs.setdefault('lang', user_params['lang'])
|
||||
|
||||
return render_template('ajax/load_checker.html', **kwargs)
|
||||
|
||||
|
||||
def update_haproxy_settings(setting_id, email, service_alert, backend_alert, maxconn_alert, telegram_id, slack_id, pd_id) -> str:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% import 'languages/'+lang|default('en')+'.html' as lang %}
|
||||
{% from 'include/input_macros.html' import input, select, checkbox %}
|
||||
{% if user_status == 0 %}
|
||||
{% if user_subscription['user_status'] == 0 %}
|
||||
{% include 'include/no_sub.html' %}
|
||||
{% else %}
|
||||
<script>
|
||||
|
@ -34,7 +34,7 @@
|
|||
{{lang.words.token|title()}}
|
||||
</td>
|
||||
<td style="width: 20%;">{{lang.words.channel|title()}}</td>
|
||||
{% if role|int() == 1 %}
|
||||
{% if user_params['role']|int() == 1 %}
|
||||
<td style="width: 25%;">{{lang.words.group|title()}}</td>
|
||||
{% endif %}
|
||||
<td style="width: 100%;"></td>
|
||||
|
@ -51,7 +51,7 @@
|
|||
{% set id = 'telegram-chanel-' + telegram.id|string() %}
|
||||
{{ input(id, value=telegram.chanel_name, size='30') }}
|
||||
</td>
|
||||
{% if role|int() == 1 %}
|
||||
{% if user_params['role']|int() == 1 %}
|
||||
<td>
|
||||
<select id="telegramgroup-{{telegram.id}}" name="telegramgroup-{{telegram.id}}">
|
||||
<option disabled selected>------</option>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<span title="Token that has given with APP registration">{{lang.words.token|title()}}</span>
|
||||
</td>
|
||||
<td style="width: 20%;">{{lang.words.channel|title()}}</td>
|
||||
{% if role|int() == 1 %}
|
||||
{% if user_params['role']|int() == 1 %}
|
||||
<td style="width: 25%;">{{lang.words.group|title()}}</td>
|
||||
{% endif %}
|
||||
<td style="width: 100%;"></td>
|
||||
|
@ -103,7 +103,7 @@
|
|||
{% set id = 'slack-chanel-' + slack.id|string() %}
|
||||
{{ input(id, value=slack.chanel_name, size='30') }}
|
||||
</td>
|
||||
{% if role|int() == 1 %}
|
||||
{% if user_params['role']|int() == 1 %}
|
||||
<td>
|
||||
<select id="slackgroup-{{slack.id}}" name="slackgroup-{{slack.id}}">
|
||||
<option disabled selected>------</option>
|
||||
|
@ -138,7 +138,7 @@
|
|||
{{lang.words.key|title()}}
|
||||
</td>
|
||||
<td style="width: 20%;">{{lang.words.name|title()}}</td>
|
||||
{% if role|int() == 1 %}
|
||||
{% if user_params['role']|int() == 1 %}
|
||||
<td style="width: 25%;">{{lang.words.group|title()}}</td>
|
||||
{% endif %}
|
||||
<td style="width: 100%;"></td>
|
||||
|
@ -155,7 +155,7 @@
|
|||
{% set id = 'pd-chanel-' + pd.id|string() %}
|
||||
{{ input(id, value=pd.chanel_name, size='30') }}
|
||||
</td>
|
||||
{% if role|int() == 1 %}
|
||||
{% if user_params['role']|int() == 1 %}
|
||||
<td>
|
||||
<select id="pdgroup-{{pd.id}}" name="pdgroup-{{pd.id}}">
|
||||
<option disabled selected>------</option>
|
|
@ -11,12 +11,12 @@
|
|||
</style>
|
||||
<center>
|
||||
<h4>
|
||||
{% if user_status['user_status'] == 0 %}
|
||||
{% if user_subscription['user_status'] == 0 %}
|
||||
You are not subscribed. Please subscribe to have access to this feature.
|
||||
<p>
|
||||
Read <a href="https://roxy-wi.org/pricing" title="Roxy-WI pricing" target="_blank" class="link">here</a> about subscriptions
|
||||
</p>
|
||||
{% elif user_status['user_plan'] == 'user' or user_status['user_plan'] != 'support' %}
|
||||
{% elif user_subscription['user_plan'] == 'user' or user_subscription['user_plan'] != 'support' %}
|
||||
This feature is not available for your plan. To change the plan, follow this <a href="https://roxy-wi.org/pricing" title="Roxy-WI pricing" target="_blank" class="link">link</a>
|
||||
{% endif %}
|
||||
</h4>
|
||||
|
|
Loading…
Reference in New Issue