From cf09a56ae2bd3342523204967cfc4ccaad057224 Mon Sep 17 00:00:00 2001 From: devdatt Date: Thu, 22 Jan 2026 16:47:19 +0530 Subject: [PATCH] update --- encoder/firmware.php | 74 +++++++++++++++++++++++++++++++++++++++----- encoder/static.php | 12 +++++-- install.sh | 41 ++++++++++-------------- setup.sh | 26 ++++++++++++++++ 4 files changed, 119 insertions(+), 34 deletions(-) diff --git a/encoder/firmware.php b/encoder/firmware.php index 1f71991..c3f6089 100755 --- a/encoder/firmware.php +++ b/encoder/firmware.php @@ -1,7 +1,7 @@ alert("' - . htmlspecialchars($data['message'], ENT_QUOTES) - . '");'; - - error_log($data['status']); - + if ($data['status'] != "valid") { + echo ''; + } if ($data['status'] == "valid") { + echo ' + + +
+
+
' + . htmlspecialchars($data['message'], ENT_QUOTES) . + '
+
Continuing in
+
100
+
+
+ + +'; + $public_key = "-----BEGIN PUBLIC KEY----- MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEAm+7Vl0fEgey2tF6v2mTn 3C/FDGn589uY5a9rpDeZLlhjdOdFaTMWL3d8oEhmImCd+aPELpxydQ+xGxVPNOzO diff --git a/encoder/static.php b/encoder/static.php index 5eb0601..2c3b4d5 100755 --- a/encoder/static.php +++ b/encoder/static.php @@ -757,7 +757,10 @@ function update_service($which_service) break; } } - + if ($use_common_backend_rtmp0 === "disable") { + $rtmp = str_replace("ffmpeg -hwaccel auto -hide_banner -fflags nobuffer -analyzeduration 3000000 -i", "ffmpeg -hwaccel qsv -hwaccel_output_format qsv -hide_banner -fflags nobuffer -analyzeduration 3000000 -i ", $rtmp); + $rtmp = str_replace("scale", "scale_qsv", $rtmp); + } $file = "/var/www/encoder-rtmp0.sh"; file_put_contents($file, $rtmp); exec('sudo systemctl enable encoder-rtmp0'); @@ -795,7 +798,10 @@ function update_service($which_service) error_log("service_rtmp1_multiple"); break; } - + if ($use_common_backend_rtmp1 === "disable") { + $rtmp = str_replace("ffmpeg -hwaccel auto -hide_banner -fflags nobuffer -analyzeduration 3000000 -i", "ffmpeg -hwaccel qsv -hwaccel_output_format qsv -hide_banner -fflags nobuffer -analyzeduration 3000000 -i ", $rtmp); + $rtmp = str_replace("scale", "scale_qsv", $rtmp); + } $file = "/var/www/encoder-rtmp1.sh"; file_put_contents($file, $rtmp); exec('sudo systemctl enable encoder-rtmp1'); @@ -1335,7 +1341,7 @@ rtmp { chunk_size 4096; "; - if ($input_source === "rtmp") { + if ($input_source === "rtmp" || $input_rtmp_mount !== "") { $nginx .= " application " . $input_rtmp_mount . " { diff --git a/install.sh b/install.sh index 51902ca..bfc2e21 100755 --- a/install.sh +++ b/install.sh @@ -375,35 +375,28 @@ network: EOL -cat > /etc/nginx/sites-available/default<< 'EOL' +cat > /etc/nginx/sites-available/default << 'EOL' server { - listen 80 default_server; - listen [::]:80 default_server; - server_name _; + listen 80 default_server; + listen [::]:80 default_server; + server_name _; - root /var/www/html; - index index.php index.html; + root /var/www/html; + index index.php index.html; - location / { + add_header Access-Control-Allow-Origin "*" always; + add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" always; + add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept, Origin, X-Requested-With" always; + + if ($request_method = OPTIONS) { + add_header Content-Length 0; + add_header Content-Type text/plain; + return 204; + } + + location / { try_files $uri $uri/ =404; - } - - location /hls/ { - root /var/www/html; - add_header Cache-Control no-cache; - add_header Access-Control-Allow-Origin *; - sendfile off; - proxy_buffering off; - proxy_request_buffering off; } - - location /dash/ { - root /var/www/html; - add_header Cache-Control no-cache; - add_header Access-Control-Allow-Origin *; - sendfile off; - } - } EOL diff --git a/setup.sh b/setup.sh index 20cc34e..f3d475f 100644 --- a/setup.sh +++ b/setup.sh @@ -18,5 +18,31 @@ if [ ! -f "$TARGET_FILE" ]; then cp "$SOURCE_FILE" "$TARGET_FILE" fi +cat > /etc/nginx/sites-available/default << 'EOL' +server { + listen 80 default_server; + listen [::]:80 default_server; + server_name _; + + root /var/www/html; + index index.html; + + add_header Access-Control-Allow-Origin "*" always; + add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" always; + add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept, Origin, X-Requested-With" always; + + if ($request_method = OPTIONS) { + add_header Content-Length 0; + add_header Content-Type text/plain; + return 204; + } + + location / { + try_files $uri $uri/ =404; + } +} +EOL + + sudo chown -R www-data:www-data /var/www/* sudo reboot \ No newline at end of file