diff --git a/app/modules/db/migrations/20252105000014_update_version.py b/app/modules/db/migrations/20252105000014_update_version.py index ec4eaaf0..1707ab7f 100644 --- a/app/modules/db/migrations/20252105000014_update_version.py +++ b/app/modules/db/migrations/20252105000014_update_version.py @@ -7,7 +7,7 @@ migrator = connect(get_migrator=1) def up(): """Apply the migration.""" try: - Version.update(version='8.2.0.3').execute() + Version.update(version='8.2.0.4').execute() except Exception as e: print(f"Error updating version: {str(e)}") raise e diff --git a/app/modules/roxywi/class_models.py b/app/modules/roxywi/class_models.py index 3088c679..a55b8281 100644 --- a/app/modules/roxywi/class_models.py +++ b/app/modules/roxywi/class_models.py @@ -25,6 +25,7 @@ class EscapedString(str): return field_value else: return quote(field_value.rstrip()) + return field_value @classmethod def __get_pydantic_core_schema__( @@ -232,6 +233,7 @@ class ChannelRequest(BaseModel): class ServerInstall(BaseModel): id: int master: Optional[bool] = 0 + version: Optional[str] = '3.1.7-1' class ServiceInstall(BaseModel): @@ -616,14 +618,14 @@ class NginxLocationRequest(BaseModel): class NginxProxyPassRequest(BaseModel): locations: List[NginxLocationRequest] - name: EscapedString + name: Union[IPvAnyAddress, DomainName] port: Annotated[int, Gt(1), Le(65535)] type: Literal['proxy_pass'] = 'proxy_pass' scheme: Literal['http', 'https'] = 'http' ssl_crt: Optional[str] = None ssl_key: Optional[str] = None ssl_offloading: Optional[bool] = False - action: Optional[Literal['save', 'test', 'reload', 'restart']] = 'save' + action: Optional[Literal['save', 'test', 'reload', 'restart']] = 'reload' compression: bool = False compression_level: Annotated[int, Gt(0), Le(10)] = 6 compression_min_length: Optional[int] = 1024 diff --git a/app/modules/roxywi/logs.py b/app/modules/roxywi/logs.py index c9981266..9502a36f 100644 --- a/app/modules/roxywi/logs.py +++ b/app/modules/roxywi/logs.py @@ -130,8 +130,13 @@ def show_roxy_log( if serv == 'backup.log': awk_column = 2 - cmd = f"cat {log_path}/{serv}| awk '${awk_column}>\"{date}:00\" && ${awk_column}<\"{date1}:00\"' {user_grep} {grep_act} {exgrep_act} |tail -{rows}" - + if serv == 'roxy-wi.log': + cmd = (f"awk -F'\"' -v t_start=\"{date}:00\" -v t_end=\"{date1}:00\" '{{for(i=1;i=t_start && d[2]<=t_end) print; break}}}}' {log_path}/roxy-wi.log" + f"{user_grep} {grep_act} {exgrep_act} |tail -{rows}") + else: + cmd = f"cat {log_path}/{serv}| awk '${awk_column}>\"{date}:00\" && ${awk_column}<\"{date1}:00\"' {user_grep} {grep_act} {exgrep_act} |tail -{rows}" output, stderr = server_mod.subprocess_execute(cmd) return show_log(output, grep=grep) + return '' diff --git a/app/modules/service/installation.py b/app/modules/service/installation.py index 387cce4f..c9df9b2e 100644 --- a/app/modules/service/installation.py +++ b/app/modules/service/installation.py @@ -127,7 +127,7 @@ def generate_haproxy_inv(json_data: ServiceInstall, installed_service: str) -> o stats_password = sql.get_setting('haproxy_stats_password') haproxy_dir = sql.get_setting('haproxy_dir') container_name = sql.get_setting('haproxy_container_name') - haproxy_ver = '3.1.1-1' + haproxy_ver = json_data['servers'][0]['version'] is_docker = json_data['services']['haproxy']['docker'] for v in json_data['servers']: diff --git a/app/scripts/ansible/roles/haproxy/tasks/installation.yml b/app/scripts/ansible/roles/haproxy/tasks/installation.yml index 02dae605..1c9177cd 100644 --- a/app/scripts/ansible/roles/haproxy/tasks/installation.yml +++ b/app/scripts/ansible/roles/haproxy/tasks/installation.yml @@ -86,6 +86,7 @@ - socat - rsyslog state: present + update_cache: yes when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu' environment: http_proxy: "{{PROXY}}" diff --git a/app/scripts/ansible/roles/waf/tasks/main.yml b/app/scripts/ansible/roles/waf/tasks/main.yml index 8f8533b4..fe53e084 100644 --- a/app/scripts/ansible/roles/waf/tasks/main.yml +++ b/app/scripts/ansible/roles/waf/tasks/main.yml @@ -100,6 +100,7 @@ - make - git state: present + update_cache: yes when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu' environment: http_proxy: "{{PROXY}}" diff --git a/app/scripts/ansible/roles/waf_nginx/tasks/main.yml b/app/scripts/ansible/roles/waf_nginx/tasks/main.yml index 44d33fc0..6ca97866 100644 --- a/app/scripts/ansible/roles/waf_nginx/tasks/main.yml +++ b/app/scripts/ansible/roles/waf_nginx/tasks/main.yml @@ -69,6 +69,7 @@ - zlib1g - zlib1g-dev state: present + update_cache: yes when: ansible_facts['os_family'] == 'Debian' or ansible_facts['os_family'] == 'Ubuntu' environment: http_proxy: "{{PROXY}}" diff --git a/app/static/js/edit_config.js b/app/static/js/edit_config.js index c45b86a2..d2a8d448 100644 --- a/app/static/js/edit_config.js +++ b/app/static/js/edit_config.js @@ -291,10 +291,18 @@ function delete_section(section_type, section_name, server_id, service) { method: "DELETE", statusCode: { 204: function (xhr) { - showConfig(); + if (service === 'nginx') { + window.open('/config/' + service + '/' + $('#serv').val() + '/show-files', '_self') + } else { + showConfig(); + } }, 404: function (xhr) { - showConfig(); + if (service === 'nginx') { + window.open('/config/' + service + '/' + $('#serv').val() + '/show-files', '_self') + } else { + showConfig(); + } } }, success: function (data) { @@ -758,6 +766,7 @@ function openNginxSection(section) { } } } + $('#location').val(location.location); $('#proxy_connect_timeout').val(location.proxy_connect_timeout); $('#proxy_read_timeout').val(location.proxy_read_timeout); $('#proxy_send_timeout').val(location.proxy_send_timeout); diff --git a/app/templates/config.html b/app/templates/config.html index 45d24c18..0ee9218b 100644 --- a/app/templates/config.html +++ b/app/templates/config.html @@ -26,6 +26,7 @@ + {% if is_serv_protected and g.user_params['role'] > 2 %} diff --git a/app/templates/install.html b/app/templates/install.html index d4abae21..0eb95d37 100644 --- a/app/templates/install.html +++ b/app/templates/install.html @@ -39,7 +39,7 @@ {% set values = dict() %} - {% set values = {'2.6.14-1':'2.6.14-1','2.7.9-1':'2.7.9-1','2.8.1-1':'2.8.1-1','2.9.6-1':'2.9.6-1','3.0.3-1':'3.0.3-1','3.1.1-1':'3.1.1-1'} %} + {% set values = {'2.6.14-1':'2.6.14-1','2.7.9-1':'2.7.9-1','2.8.1-1':'2.8.1-1','2.9.6-1':'2.9.6-1','3.0.10-1':'3.0.10-1','3.1.7-1':'3.1.7-1'} %} {{ select('hapver', values=values, selected='3.1.1-1', required='required') }}