From aedba82e7cd6677c284c868364193fc05d1cc3cf Mon Sep 17 00:00:00 2001 From: Aidaho Date: Mon, 17 Mar 2025 18:39:08 +0300 Subject: [PATCH] v8.1.6.1: Update version, improve WAF handling, and fix minor bugs Updated the version in the database to 8.1.6.1. Adjusted WAF log handling to correctly process parameters and URLs, improving functionality and accuracy. Fixed minor issues, including initializing variables and handling edge cases for section edits in configurations. --- app/create_db.py | 2 +- app/static/js/script.js | 15 +++++++++------ app/templates/ajax/config_show.html | 3 +-- app/templates/ajax/overviewWaf.html | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/create_db.py b/app/create_db.py index f91547f5..5c1df4e6 100644 --- a/app/create_db.py +++ b/app/create_db.py @@ -723,7 +723,7 @@ def update_db_v_8_1_6(): def update_ver(): try: - Version.update(version='8.1.6').execute() + Version.update(version='8.1.6.1').execute() except Exception: print('Cannot update version') diff --git a/app/static/js/script.js b/app/static/js/script.js index 158243c6..fcd7c5c1 100644 --- a/app/static/js/script.js +++ b/app/static/js/script.js @@ -144,8 +144,10 @@ function openVersions() { win.focus(); } function showLog() { - let waf = cur_url[0].split('?')[0]; + let service = $('#service').val(); + let waf = findGetParameter('waf'); let file = $('#log_files').val(); + let file_from_get = ''; if (!checkIsServerFiled('#serv')) return false; let serv = $("#serv").val(); if ((file === undefined || file === null || file === 'Select a file') && (waf === '' || waf === undefined)) { @@ -160,7 +162,6 @@ function showLog() { if ((file === undefined || file === null) && waf === '') { toastr.warning('Select a log file first') return false; - } let rows = $('#rows').val(); let grep = $('#grep').val(); @@ -169,14 +170,13 @@ function showLog() { let minute = $('#time_range_out_minut').val(); let hour1 = $('#time_range_out_hour1').val(); let minute1 = $('#time_range_out_minut1').val(); - let service = $('#service').val(); let url = "/logs/" + service + "/" + serv + "/" + rows; if (service === 'None') { service = 'haproxy'; } - if (waf && waf != 'haproxy' && waf != 'apache' && waf != 'keepalived') { + if (waf == '1') { file = findGetParameter('file'); - url = "/logs/" + service + "/waf/" + serv + "/" + rows + '?file_from_get=' + file; + url = "/logs/" + service + "/waf/" + serv + "/" + rows + file_from_get; } $.ajax( { url: url, @@ -301,6 +301,7 @@ function showCompareConfigs() { } function showConfig() { let edit_section = ''; + let edit_section_uri = ''; let service = $('#service').val(); let config_file = $('#config_file_name').val() let config_file_name = encodeURI(config_file); @@ -319,7 +320,9 @@ function showConfig() { if (service === 'haproxy') { edit_section = findGetParameter('section'); - let edit_section_uri = '?section=' + edit_section; + if (edit_section != null) { + edit_section_uri = '?section=' + edit_section; + } } let json_data = { "serv": $("#serv").val(), diff --git a/app/templates/ajax/config_show.html b/app/templates/ajax/config_show.html index 5a0e814a..1de0ba5b 100644 --- a/app/templates/ajax/config_show.html +++ b/app/templates/ajax/config_show.html @@ -420,8 +420,7 @@ function expand_button(event) { $("#expand_link").click(); } - console.log("{{edit_section}}"); - {% if service == 'haproxy' and edit_section != '' %} + {% if service == 'haproxy' and edit_section != '' and edit_section != None %} openSection('{{ edit_section }}'); {% endif %} diff --git a/app/templates/ajax/overviewWaf.html b/app/templates/ajax/overviewWaf.html index 0b5afeb7..e98800f2 100644 --- a/app/templates/ajax/overviewWaf.html +++ b/app/templates/ajax/overviewWaf.html @@ -76,7 +76,7 @@ {% if waf_service == 'haproxy' %} {{lang.words.view|title()}} {% elif waf_service == 'nginx' %} - {{lang.words.view|title()}} + {{lang.words.view|title()}} {% endif %}