From 333b53a3270b50c1700fe8c636c7f5ca848251e7 Mon Sep 17 00:00:00 2001 From: Aidaho Date: Mon, 16 Oct 2023 18:35:26 +0300 Subject: [PATCH] v7.0.1.0 Changelog: https://roxy-wi.org/changelog#7.0.1 --- app/modules/db/sql.py | 50 ++++++++++++++++++++++++++++ app/routes/runtime/routes.py | 4 +-- app/templates/include/main_menu.html | 2 +- config_other/requirements_deb.txt | 2 +- config_other/requirements_el7.txt | 2 +- config_other/requirements_el8.txt | 2 +- config_other/requirements_el9.txt | 2 +- inc/css/awesome-6.3.9.css | 1 + inc/overview.js | 10 ++---- inc/runtimeapi.js | 2 +- inc/script.js | 2 +- inc/users.js | 15 +++++++-- requirements.txt | 1 + 13 files changed, 77 insertions(+), 18 deletions(-) diff --git a/app/modules/db/sql.py b/app/modules/db/sql.py index 87254e0e..d13d7ac6 100755 --- a/app/modules/db/sql.py +++ b/app/modules/db/sql.py @@ -1391,6 +1391,7 @@ def insert_metrics(serv, curr_con, cur_ssl_con, sess_rate, max_sess_rate): if not conn.is_closed(): conn.close() + def insert_metrics_http(serv, http_2xx, http_3xx, http_4xx, http_5xx): cur_date = get_date.return_date('regular') try: @@ -4141,3 +4142,52 @@ def is_user_super_admin(user_id: int) -> bool: return True else: return False + + +def get_roxy_tools(): + query = RoxyTool.select() + try: + query_res = query.where(RoxyTool.is_roxy == 1).execute() + except Exception as e: + out_error(e) + else: + tools = [] + for tool in query_res: + tools.append(tool.name) + return tools + + +def get_all_tools(): + try: + query_res = RoxyTool.select().execute() + except Exception as e: + out_error(e) + else: + tools = {} + for tool in query_res: + tools.setdefault(tool.name, {'current_version': tool.current_version, 'new_version': tool.new_version, 'desc': tool.desc}) + + return tools + + +def update_tool_cur_version(tool_name: str, version: str): + try: + RoxyTool.update(current_version=version).where(RoxyTool.name == tool_name).execute() + except Exception as e: + out_error(e) + + +def update_tool_new_version(tool_name: str, version: str): + try: + RoxyTool.update(new_version=version).where(RoxyTool.name == tool_name).execute() + except Exception as e: + out_error(e) + + +def get_tool_cur_version(tool_name: str): + try: + query = RoxyTool.get(RoxyTool.name == tool_name).current_version + except Exception as e: + out_error(e) + else: + return query diff --git a/app/routes/runtime/routes.py b/app/routes/runtime/routes.py index c31ec10f..2c08f68f 100644 --- a/app/routes/runtime/routes.py +++ b/app/routes/runtime/routes.py @@ -185,8 +185,8 @@ def delete_ip_from_list(): @bp.route('/list/add', methods=['POST']) def add_ip_to_list(): ip = request.form.get('list_ip_for_add') - ip = ip.strip() - ip = common.is_ip_or_dns(ip) + ip = common.is_ip_or_dns(ip.strip()) + serv = common.is_ip_or_dns(request.form.get('serv')) list_id = common.checkAjaxInput(request.form.get('list_id_for_add')) list_name = common.checkAjaxInput(request.form.get('list_name')) diff --git a/app/templates/include/main_menu.html b/app/templates/include/main_menu.html index eb61cb93..a490b981 100644 --- a/app/templates/include/main_menu.html +++ b/app/templates/include/main_menu.html @@ -124,7 +124,7 @@
  • {{lang.words.servers|title()}}
  • SSH {{lang.words.creds|title()}}
  • {{lang.words.settings|title()}}
  • -
  • {{lang.words.tools|title()}}
  • +
  • {{lang.words.tools|title()}}
  • {{lang.words.internal|title()}} {{lang.words.logs}}
  • {{lang.words.w_update|title()}}
  • diff --git a/config_other/requirements_deb.txt b/config_other/requirements_deb.txt index f3bec21e..7f31c53b 100644 --- a/config_other/requirements_deb.txt +++ b/config_other/requirements_deb.txt @@ -1,5 +1,6 @@ configparser>=3.5.0 pytz>=2017.3 +tzlocal==2.0.0 pyTelegramBotAPI>=3.6.3 slack-sdk>=3.4.0 distro>=1.2.0 @@ -12,4 +13,3 @@ python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 websockets>=9.0 -retry>=0.9.2 diff --git a/config_other/requirements_el7.txt b/config_other/requirements_el7.txt index 5050310c..16a0e638 100644 --- a/config_other/requirements_el7.txt +++ b/config_other/requirements_el7.txt @@ -7,6 +7,7 @@ peewee>=3.14.10 PyMySQL>=1.0.2 retry>=0.9.2 pdpyras>=4.5.2 +tzlocal==2.0.0 pika>=1.3.1 Flask>=2.0.3 Flask-Login>=0.4.1 @@ -16,4 +17,3 @@ python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 websockets>=9.0 -retry>=0.9.2 diff --git a/config_other/requirements_el8.txt b/config_other/requirements_el8.txt index c8968547..6cc084ae 100644 --- a/config_other/requirements_el8.txt +++ b/config_other/requirements_el8.txt @@ -7,6 +7,7 @@ peewee>=3.14.10 PyMySQL>=1.0.2 bottle>=0.12.18 retry>=0.9.2 +tzlocal==2.0.0 pdpyras>=4.5.2 pika>=1.3.1 Flask>=2.0.3 @@ -17,4 +18,3 @@ python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 websockets>=9.0 -retry>=0.9.2 diff --git a/config_other/requirements_el9.txt b/config_other/requirements_el9.txt index 7187c6e8..73e23209 100644 --- a/config_other/requirements_el9.txt +++ b/config_other/requirements_el9.txt @@ -17,4 +17,4 @@ python3-nmap<=1.5.1 aio-pika>=7.1.0 pika>=1.2.0 websockets>=9.0 -retry>=0.9.2 +tzlocal==2.0.0 diff --git a/inc/css/awesome-6.3.9.css b/inc/css/awesome-6.3.9.css index 71224412..3ec2c062 100644 --- a/inc/css/awesome-6.3.9.css +++ b/inc/css/awesome-6.3.9.css @@ -146,6 +146,7 @@ font-family: "Font Awesome 5 Solid"; content: "\f1da"; } +.tools::before, .services::before { display: none; font-family: "Font Awesome 5 Solid"; diff --git a/inc/overview.js b/inc/overview.js index ebb9e65e..646dbef8 100644 --- a/inc/overview.js +++ b/inc/overview.js @@ -580,13 +580,9 @@ function ShowOverviewLogs() { }, success: function( data ) { data = data.replace(/\s+/g,' '); - if (data.indexOf('error:') != '-1') { - toastr.error(data); - } else { - $("#overview-logs").html(data); - $.getScript("/inc/fontawesome.min.js") - $.getScript("/inc/overview.js") - } + $("#overview-logs").html(data); + $.getScript("/inc/fontawesome.min.js") + $.getScript("/inc/overview.js") } } ); } diff --git a/inc/runtimeapi.js b/inc/runtimeapi.js index f3dc738a..402fd75a 100644 --- a/inc/runtimeapi.js +++ b/inc/runtimeapi.js @@ -319,7 +319,7 @@ function addNewIp() { var ip = $('#list_add_ip_new_ip').val(); if(valid) { $.ajax({ - url: "/app/runtimeapi/add/", + url: "/app/runtimeapi/list/add/", data: { serv: $('#list_serv_select').val(), list_ip_for_add: ip, diff --git a/inc/script.js b/inc/script.js index 9e6559d0..e3783ee7 100644 --- a/inc/script.js +++ b/inc/script.js @@ -359,7 +359,6 @@ function showLog() { var serv = $("#serv").val(); if ((file === undefined || file === null) && (waf == '' || waf === undefined)) { var file_from_get = findGetParameter('file'); - console.log(file_from_get) if (file_from_get === undefined || file_from_get === null) { toastr.warning('Select a log file first') return false; @@ -884,6 +883,7 @@ $( function() { } else if (data.indexOf('error') != '-1') { toastr.error(data); } else { + sessionStorage.removeItem('check-service'); window.location.replace(data); } } diff --git a/inc/users.js b/inc/users.js index 260fc8fe..45f0a91b 100644 --- a/inc/users.js +++ b/inc/users.js @@ -917,8 +917,6 @@ $( function() { $("#tabs ul li").click(function() { var activeTab = $(this).find("a").attr("href"); var activeTabClass = activeTab.replace('#', ''); - console.log(activeTab) - console.log(activeTabClass) $('.menu li ul li').each(function () { $(this).find('a').css('border-left', '0px solid var(--right-menu-blue-rolor)'); $(this).find('a').css('padding-left', '20px') @@ -2412,6 +2410,7 @@ function updateService(service, action='update') { } $("#ajax-update").html(''); loadupdatehapwi(); + loadServices(); show_version(); } }); @@ -2569,6 +2568,18 @@ function loadupdatehapwi() { } } ); } +function checkUpdateRoxy() { + $.ajax({ + url: "/app/admin/update/check", + // data: { + // token: $('#token').val() + // }, + // type: "POST", + success: function (data) { + loadupdatehapwi(); + } + } ); +} function loadchecker() { $.ajax({ url: "/app/checker/settings/load", diff --git a/requirements.txt b/requirements.txt index 5e9f6b03..d914c133 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ configparser>=3.5.0 paramiko-ng>=2.5.0 pytz>=2017.3 +tzlocal==2.0.0 requests>=2.22.0 pyTelegramBotAPI>=3.6.3 networkx>=2.6