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.
pull/418/head
Aidaho 2025-03-17 18:39:08 +03:00
parent 66f1760ca3
commit aedba82e7c
4 changed files with 12 additions and 10 deletions

View File

@ -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')

View File

@ -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(),

View File

@ -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 %}
</script>

View File

@ -76,7 +76,7 @@
{% if waf_service == 'haproxy' %}
<a href="{{ url_for('logs.logs', service=waf_service) }}/waf?serv={{ service.1 }}" class="ui-button ui-widget ui-corner-all" title="{{lang.words.view|title()}} {{lang.words.log}}">{{lang.words.view|title()}}</a>
{% elif waf_service == 'nginx' %}
<a href="{{ url_for('logs.logs', service=waf_service) }}/waf?serv={{ service.1 }}&rows=100&grep=ModSecurity&hour=00&minute=00&hour1=24&minute1=00&file=error.log&waf=0" class="ui-button ui-widget ui-corner-all" title="{{lang.words.view|title()}} {{lang.words.log}}">{{lang.words.view|title()}}</a>
<a href="{{ url_for('logs.logs', service=waf_service) }}/waf?serv={{ service.1 }}&rows=100&grep=ModSecurity&hour=00&minute=00&hour1=24&minute1=00&file=error.log&waf=1" class="ui-button ui-widget ui-corner-all" title="{{lang.words.view|title()}} {{lang.words.log}}">{{lang.words.view|title()}}</a>
{% endif %}
</td>
<td></td>