From be142bd8f366d85fd6aa5da1d256a620e605396c Mon Sep 17 00:00:00 2001 From: Aidaho Date: Tue, 28 Feb 2023 09:55:03 +0300 Subject: [PATCH] v6.3.6.0 Changelog: https://roxy-wi.org/changelog#6_3_6 --- app/modules/server/server.py | 12 +++--- app/runtimeapi.py | 15 +++---- app/templates/add.html | 2 + app/templates/add_nginx.html | 4 +- app/templates/ha.html | 4 +- app/templates/history.html | 4 +- app/templates/ovw.html | 2 +- app/templates/runtimeapi.html | 73 +++++++++++++++++------------------ 8 files changed, 57 insertions(+), 59 deletions(-) diff --git a/app/modules/server/server.py b/app/modules/server/server.py index 039582ab..10ef893f 100644 --- a/app/modules/server/server.py +++ b/app/modules/server/server.py @@ -424,6 +424,12 @@ def create_server(hostname, ip, group, typeip, enable, master, cred, port, desc, if sql.add_server(hostname, ip, group, typeip, enable, master, cred, port, desc, haproxy, nginx, apache, firewall): try: + try: + sql.insert_new_checker_setting_for_server(ip) + except Exception as e: + roxywi_common.logging(f'Cannot insert Checker settings for {hostname}', str(e), roxywi=1) + raise Exception(f'error: Cannot insert Checker settings for {hostname} {e}') + if scan_server == '1': nginx_config_path = sql.get_setting('nginx_config_path') haproxy_config_path = sql.get_setting('haproxy_config_path') @@ -454,12 +460,6 @@ def create_server(hostname, ip, group, typeip, enable, master, cred, port, desc, roxywi_common.logging(f'Cannot scan a new server {hostname}', str(e), roxywi=1) raise Exception(f'error: Cannot scan a new server {hostname} {e}') - try: - sql.insert_new_checker_setting_for_server(ip) - except Exception as e: - roxywi_common.logging(f'Cannot insert Checker settings for {hostname}', str(e), roxywi=1) - raise Exception(f'error: Cannot insert Checker settings for {hostname} {e}') - try: get_system_info(ip) except Exception as e: diff --git a/app/runtimeapi.py b/app/runtimeapi.py index 31b83358..0db37b8b 100644 --- a/app/runtimeapi.py +++ b/app/runtimeapi.py @@ -20,17 +20,14 @@ except Exception as e: sys.exit() form = common.form - -try: - servbackend = form.getvalue('servbackend') - serv = form.getvalue('serv') - if servbackend is None: - servbackend = "" -except Exception: - pass +servbackend = form.getvalue('servbackend') +serv = form.getvalue('serv') +if servbackend is None: + servbackend = "" rendered_template = template.render( h2=0, title="RunTime API", role=user_params['role'], user=user_params['user'], select_id="serv", - selects=user_params['servers'], token=user_params['token'], user_services=user_params['user_services'], servbackend=servbackend + selects=user_params['servers'], token=user_params['token'], user_services=user_params['user_services'], + servbackend=servbackend, lang=user_params['lang'] ) print(rendered_template) diff --git a/app/templates/add.html b/app/templates/add.html index 49da1712..20bc62b9 100644 --- a/app/templates/add.html +++ b/app/templates/add.html @@ -1,4 +1,6 @@ {% extends "base.html" %} +{% block title %}{{lang.menu_links.add_proxy|title()}}{% endblock %} +{% block h2 %}{{lang.menu_links.add_proxy|title()}}{% endblock %} {% block content %} {% from 'include/input_macros.html' import input, checkbox, select %} {% set balance_params = dict() %} diff --git a/app/templates/add_nginx.html b/app/templates/add_nginx.html index d7d7afbe..d113df96 100644 --- a/app/templates/add_nginx.html +++ b/app/templates/add_nginx.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block title %}{{lang.menu_links.add_proxy.title}}{% endblock %} -{% block h2 %}{{lang.menu_links.add_proxy.title}}{% endblock %} +{% block title %}{{lang.menu_links.add_proxy|title()}}{% endblock %} +{% block h2 %}{{lang.menu_links.add_proxy|title()}}{% endblock %} {% block content %} {% from 'include/input_macros.html' import input, checkbox, select %} {% set balance_params = dict() %} diff --git a/app/templates/ha.html b/app/templates/ha.html index 605b83fe..1d82b3c5 100644 --- a/app/templates/ha.html +++ b/app/templates/ha.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block title %}{{ lang.menu_links.ha.title }} {% endblock %} -{% block h2 %}{{ lang.menu_links.ha.title }} {% endblock %} +{% block title %}{{ lang.menu_links.ha|title() }} {% endblock %} +{% block h2 %}{{ lang.menu_links.ha|title() }} {% endblock %} {% block content %} {% from 'include/input_macros.html' import input, checkbox %} diff --git a/app/templates/history.html b/app/templates/history.html index 074bc4bd..dfb5d7ff 100644 --- a/app/templates/history.html +++ b/app/templates/history.html @@ -1,7 +1,7 @@ {% from 'include/input_macros.html' import copy_to_clipboard %} {% extends "base.html" %} -{% block title %}{{ lang.menu_links.history.title }} {{ lang.words[service] }}{% endblock %} -{% block h2 %}{{ lang.menu_links.history.title }} {{ lang.words[service] }}{% endblock %} +{% block title %}{{ lang.menu_links.history|title() }} {{ lang.words[service] }}{% endblock %} +{% block h2 %}{{ lang.menu_links.history|title() }} {{ lang.words[service] }}{% endblock %} {% block content %} {% if user_status == 0 or user_plan == 'user' %} {% include 'include/no_sub.html' %} diff --git a/app/templates/ovw.html b/app/templates/ovw.html index 5366f3c2..75e27a8e 100644 --- a/app/templates/ovw.html +++ b/app/templates/ovw.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}{{lang.menu_links.overview.title}}{% endblock %} +{% block title %}{{lang.menu_links.overview|title()}}{% endblock %} {% block h2 %}{{lang.menu_links.overview.h2}}{% endblock %} {% block content %} diff --git a/app/templates/runtimeapi.html b/app/templates/runtimeapi.html index acc25072..7d53c2d5 100644 --- a/app/templates/runtimeapi.html +++ b/app/templates/runtimeapi.html @@ -1,4 +1,6 @@ {% extends "base.html" %} +{% block title %}Runtime API{% endblock %} +{% block h2 %}Runtime API{% endblock %} {% block content %} {% from 'include/input_macros.html' import input, checkbox %} @@ -8,11 +10,11 @@ @@ -20,11 +22,11 @@
- - - + + + {% if role <= 3 %} - + {% endif %} @@ -35,7 +37,7 @@ {% endif %} @@ -74,15 +76,15 @@
- You can read the description of all Run Time API here + You can read the description of all Run Time API {{lang.words.here}}
{% if role <= 3 %}
ServerDisable/Enable server or output any informationCommand{{lang.words.server|title()}}{{lang.words.action|title()}}{{lang.words.command|title()}}Save change{{lang.words.save|title()}} {{lang.words.change}}
- +
- - + + @@ -101,28 +103,28 @@
ServerChoose Frontend{{lang.words.server|title()}}{{lang.words.select|title()}} {{lang.words.frontend|title()}} Maxconn
- {{ input('maxconnint', title='Enter maxconn', type="number", required='required') }} + {{ input('maxconnint', title=lang.words.enter|title() + ' maxconn', type="number", required='required') }} - +
- You can read how it works here + {{lang.phrases.read_how_it_works}} {{lang.words.here}}
- - - - - + + + + + @@ -144,10 +146,10 @@
ServerChoose BackendChoose ServerNew IPNew Port{{lang.words.server|title()}}{{lang.words.select|title()}} {{lang.words.backend|title()}}{{lang.words.select|title()}} {{lang.words.server}}{{lang.words.new|title()}} IP{{lang.words.new|title()}} {{lang.words.port}}
- {{ input('backend_ip', title='Set new server IP', required='required', size='16') }} + {{ input('backend_ip', title=lang.words.set|title()+' '+lang.words.new + ' ' + lang.words.server + ' IP', required='required', size='16') }} - {{ input('backend_port', title='Set new server Port', type="number", required='required', size='6') }} + {{ input('backend_port', title=lang.words.set|title()+' '+lang.words.new + ' ' + lang.words.server + ' ' + lang.words.port, type="number", required='required', size='6') }} @@ -157,14 +159,14 @@
- You can read how it works here + {{lang.phrases.read_how_it_works}} {{lang.words.here}}
- - + + @@ -182,21 +184,21 @@
ServerChoose Table{{lang.words.server|title()}}{{lang.words.select|title()}} {{lang.words.table}}
- +
- You can read how it works here + {{lang.phrases.read_how_it_works}} {{lang.words.here}}
- - + + @@ -214,20 +216,20 @@
ServerChoose List{{lang.words.server|title()}}{{lang.words.select|title()}} {{lang.words.list}}
- +
- You can read how it works here + {{lang.phrases.read_how_it_works}} {{lang.words.here}}
- + @@ -241,15 +243,12 @@
Server{{lang.words.server|title()}}
- +
-
- You can read how it works here -
{% endif %}