v8.2.4: Add WebSocket support in Nginx configuration and update version

- Introduced WebSocket support in Nginx models, templates, and JavaScript.
- Updated database migration to version `8.2.4`.
- Refactored logrotate configurations for consistency.
- Added Page Size pragma in database initialization for optimized performance.
master v8.2.4
Aidaho 2025-10-13 10:24:03 +03:00
parent 35bd366f55
commit 980f563eb0
10 changed files with 42 additions and 11 deletions

View File

@ -36,7 +36,8 @@ def connect(get_migrator=None):
conn = SqliteExtDatabase(db, pragmas=(
('cache_size', -1024 * 64), # 64MB page-cache.
('journal_mode', 'wal'),
('foreign_keys', 1)
('foreign_keys', 1),
('page_size', 4096),
))
migrator = SqliteMigrator(conn)
if get_migrator:

View File

@ -0,0 +1,22 @@
from playhouse.migrate import *
from app.modules.db.db_model import connect, Version
migrator = connect(get_migrator=1)
def up():
"""Apply the migration."""
try:
Version.update(version='8.2.4').execute()
except Exception as e:
print(f"Error updating version: {str(e)}")
raise e
def down():
"""Roll back the migration."""
try:
Version.update(version='8.2.3').execute()
except Exception as e:
print(f"Error rolling back migration: {str(e)}")
raise e

View File

@ -626,6 +626,7 @@ class NginxLocationRequest(BaseModel):
proxy_send_timeout: Optional[int] = 60
headers: Optional[List[NginxHeaderRequest]] = None
upstream: str
websocket: Optional[bool] = False
@model_validator(mode='before')
@classmethod

View File

@ -79,7 +79,7 @@ location {{ location.location }} {
proxy_read_timeout {{ location.proxy_read_timeout }};
proxy_send_timeout {{ location.proxy_send_timeout }};
{% if nginx_proxy.websocket.enabled %}
{% if location.websocket %}
# WebSocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;

View File

@ -28,9 +28,6 @@ nginx_proxy:
inactive: "60m" # Cache retention time for inactive entries
levels: "1:2" # Directory structure levels
websocket:
enabled: false
# Custom error pages
error_pages:
enabled: false # Enable custom error pages

View File

@ -237,12 +237,17 @@ function getNginxFormData($form, form_name) {
let header = {action, name, value};
headers.push(header);
});
let websocket = false;
if ($('input[name="websocket"]').is(':checked')) {
websocket = true;
}
let location_config = {
location,
proxy_connect_timeout,
proxy_read_timeout,
proxy_send_timeout,
headers,
websocket,
upstream
};
indexed_array['locations'].push(location_config)

View File

@ -798,6 +798,9 @@ function openNginxSection(section) {
$('#proxy_read_timeout').val(location.proxy_read_timeout);
$('#proxy_send_timeout').val(location.proxy_send_timeout);
$('#proxy_pass-upstream').val(location.upstream);
if (location.websocket) {
$('#websocket').prop("checked", true);
}
}
if (data.compression) {
$('#compression').prop("checked", true);

View File

@ -106,6 +106,8 @@ Timeouts: Timeouts (proxy_connect_timeout).
<a class="link add-server" id="add_header" title="{{lang.words.add|title()}} {{lang.words.headers}}" style="display: none;"></a>
</span>
<br>
{{ checkbox('websocket', title=lang.words.enable|title() + ' Websocket', desc='Websocket') }}
<br>
Upstream: {{ input('proxy_pass-upstream', name='upstream', placeholder='upstream_config') }}
<div class="tooltip tooltipTop">
<b>{{lang.words.note|title()}}</b>: {{lang.add_nginx_page.desc.def_backend}}, <span title="{{lang.words.create|title()}} {{lang.words.upstream}}" class="redirectUpstream link">{{lang.add_nginx_page.desc.def_backend_exit}}</span>.

View File

@ -3,7 +3,7 @@
rotate 10
missingok
notifempty
create 0644 apache apache
dateext
create 0644 apache apache
dateext
sharedscripts
}

View File

@ -3,8 +3,8 @@
rotate 10
missingok
notifempty
create 0644 apache apache
dateext
create 0644 apache apache
dateext
sharedscripts
}
@ -13,7 +13,7 @@
rotate 10
missingok
notifempty
create 0644 apache apache
dateext
create 0644 apache apache
dateext
sharedscripts
}