This commit is contained in:
devdatt 2025-12-31 13:14:24 +05:30
parent 21e3466415
commit 8a9b741f15
6 changed files with 145 additions and 148 deletions

View File

@ -1,17 +1,20 @@
user www-data; user www-data;
worker_processes auto; worker_processes auto;
worker_rlimit_nofile 100000;
pid /run/nginx.pid; pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf; include /etc/nginx/modules-enabled/*.conf;
events { events {
worker_connections 2048; worker_connections 8192;
multi_accept on; multi_accept on;
} }
rtmp { rtmp {
server { server {
listen 1935; listen 1935;
chunk_size 4096; chunk_size 8192;
application shree { application shree {
live on; live on;
@ -19,46 +22,61 @@ rtmp {
meta off; meta off;
wait_video on; wait_video on;
sync 10ms;
idle_streams off;
hls on; hls on;
hls_path /var/www/html/hls/shree; hls_path /var/www/html/hls/shree;
hls_fragment 3; hls_fragment 4;
hls_playlist_length 60; hls_playlist_length 48;
hls_cleanup on;
hls_continuous on;
hls_nested on;
dash on; dash on;
dash_path /var/www/html/dash/shree; dash_path /var/www/html/dash/shree;
dash_fragment 4;
dash_playlist_length 48;
dash_cleanup on;
} }
application shreeshree { application shreeshree {
live on; live on;
record off; record off;
meta off; meta off;
wait_video on; wait_video on;
sync 10ms;
idle_streams off;
hls on; hls on;
hls_path /var/www/html/hls/shreeshree; hls_path /var/www/html/hls/shreeshree;
hls_fragment 3; hls_fragment 4;
hls_playlist_length 60; hls_playlist_length 48;
hls_cleanup on;
hls_continuous on;
hls_nested on;
dash on; dash on;
dash_path /var/www/html/dash/shreeshree; dash_path /var/www/html/dash/shreeshree;
dash_fragment 4;
dash_playlist_length 48;
dash_cleanup on;
} }
} }
} }
http { http {
sendfile on; sendfile off;
tcp_nopush on; tcp_nopush off;
types_hash_max_size 2048; tcp_nodelay on;
keepalive_timeout 65;
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on; ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log; access_log /var/log/nginx/access.log;

View File

@ -1,10 +1,68 @@
<?php <?php
exec("sudo chmod 444 /sys/class/dmi/id/product_uuid"); exec("sudo chmod 444 /sys/class/dmi/id/product_uuid");
$device_id = trim(file_get_contents('/sys/class/dmi/id/product_uuid'));
$publicKey = "-----BEGIN PUBLIC KEY-----
MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEAm6glpTALuc82R+9Mqb5f
HVRC5dScc7USgWoIsYN1tF8YE0d7rhSIFvayVabiyabVmWscjAIlmYf6InSlLsDx
avfmapg32ECd92H49ZbsvXQpLqasyOkN7z6FUcuQ6pEMqfPBmBXKGngHazPp420o
Iki9hLc7IE9EMlDHfozckuJI8mB+bsd2oqua6SSTBYx5HYuSCbootf9GliSd7PVk
H6uir88j49/NFfvmrReicFBiMba959uOdBIhWl9AveZL+iI2NdS5SPw6eWltaMot
PSk7/5Z4Vn5Od7sQA0yUqmCj5XNV5EzRlP1jhP7SDv0D6Mpdf3HuKWdCBqepJBe2
rCHPQ9KrChQau4eEbJb5LIE3gFDpLxTHk9FEp+50evkpFONj0aAjSb3P4wsEGiOk
95Tm56gDRirnbbw/6SzhE7pEvXRUfMl1KO6maYK1z7KNMgEH99C2zCjZhpaXL5Io
rywCw009zoMT2qdKPMGOyQ4KPlCLCJYSF0y/rE07WNgl4BupVZR41B5MbXL5L7+X
OD0jBpbWI7v2ChP9rn5u6Lqpq6ewvc2RJO8lrAyZtzrNJNZNYmUKHrm7qAHJeJZX
Zh7OEf9U/T9JBpzf8l0MzyywlQGUBzb/niG0iZILt3XIpD+Xeyrr6hr+nabeiKXV
jHyUcG84zzLjv7sREzWEGoLBrdztMy69rbfd3d0DpjS90xceKZYBDd3vwjn6h0TN
KssqUb7BMH+zkCe/LQg6EGdXB13+xUSUjFKLLeBKu1VxMPfd/WmV1QumOodidvee
rQAv6yMevq2hVFkiFo7CUpaRv6dvQnQaqX2rHFKZY6zEIzbJXTznl6ZMtCcmcZMk
CYcoWZIAUR5tFP221XzIfJmymVRfJGiKTvt+g/SUUFJt6mq8ettu11XS4KSIxtaA
l8q2SSxpRQa80NUuaBpQc/3eP293wgcf/EOfzhCjxDLjsHSKV1AkSMyjvCzSsCdG
mMEIuT/D7PB7N8vlfhn5qsyt1Sm81/1EZ3u8UqToELhe8j7G26GVl/8ptSxofvZE
X0goYwW18PPhtZvkR8CXpZ7qwjqDcL5cQzcCldufjtqJ5GAwN6SrcmnYjQoo2cu9
XlWo0InPE8BpjR7vJpKLbppQzwUs9GQYx2bMSTbsrduc8zDXlPT5aOfgkJui/NQa
uxttvsXqXd3nNJhbO0BN+wCDT0j4LNRvMlJloWEGrBkY4SA5I1MX8XBL34Csy6Bu
bHWxXNBAGYMchcJKly7XN2hA61V4QCCiFz/MP9l1llw/Mk4D5IUTxcfcEDHx7LO0
To+pc5kuXS6Aps6lKJdwv6h0Bi9SWtBpFi2RtpQpAc+dVPQ9lwq3VTJV5GZz3AgV
KQIDAQAB
-----END PUBLIC KEY-----
";
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
switch ($_POST['action']) { switch ($_POST['action']) {
case 'update': case 'update':
update_firmware(); $payload = $_POST;
$payload['device_id'] = $device_id;
$payload['project_id'] = "28f27590923d962388f0da125553c5";
$payload = json_encode($_POST, JSON_UNESCAPED_UNICODE);
openssl_public_encrypt(
$payload,
$encrypted,
$publicKey,
OPENSSL_PKCS1_OAEP_PADDING
);
$postData = [
'encrypted' => base64_encode($encrypted)
];
$ch = curl_init('http://account.urmic.org/encoder/update.php');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postData,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
]);
$response = curl_exec($ch);
curl_close($ch);
error_log(print_r($response,true));
break; break;
case 'reset': case 'reset':
$files = glob('/var/www/encoder/*.json'); $files = glob('/var/www/encoder/*.json');

View File

@ -1,47 +0,0 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 2048;
multi_accept on;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application shree {
live on;
record off;
meta off;
wait_video on;
}
}
}
http {
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

View File

@ -1199,8 +1199,11 @@ function update_service_backend($service, $srt_pass1, $srt_pass2)
$hls0 = " $hls0 = "
hls on; hls on;
hls_path /var/www/html/hls/shree; hls_path /var/www/html/hls/shree;
hls_fragment 3; hls_fragment 4;
hls_playlist_length 60; hls_playlist_length 48;
hls_cleanup on;
hls_continuous on;
hls_nested on;
"; ";
} else { } else {
$hls0 = " $hls0 = "
@ -1210,6 +1213,9 @@ function update_service_backend($service, $srt_pass1, $srt_pass2)
$dash0 = " $dash0 = "
dash on; dash on;
dash_path /var/www/html/dash/shree; dash_path /var/www/html/dash/shree;
dash_fragment 4;
dash_playlist_length 48;
dash_cleanup on;
"; ";
} else { } else {
$dash0 = " $dash0 = "
@ -1219,8 +1225,11 @@ function update_service_backend($service, $srt_pass1, $srt_pass2)
$hls1 = " $hls1 = "
hls on; hls on;
hls_path /var/www/html/hls/shreeshree; hls_path /var/www/html/hls/shreeshree;
hls_fragment 3; hls_fragment 4;
hls_playlist_length 60; hls_playlist_length 48;
hls_cleanup on;
hls_continuous on;
hls_nested on;
"; ";
} else { } else {
$hls1 = " $hls1 = "
@ -1230,6 +1239,9 @@ function update_service_backend($service, $srt_pass1, $srt_pass2)
$dash1 = " $dash1 = "
dash on; dash on;
dash_path /var/www/html/dash/shreeshree; dash_path /var/www/html/dash/shreeshree;
dash_fragment 4;
dash_playlist_length 48;
dash_cleanup on;
"; ";
} else { } else {
$dash1 = " $dash1 = "
@ -1259,11 +1271,12 @@ function update_service_backend($service, $srt_pass1, $srt_pass2)
$nginx = " $nginx = "
user www-data; user www-data;
worker_processes auto; worker_processes auto;
worker_rlimit_nofile 100000;
pid /run/nginx.pid; pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf; include /etc/nginx/modules-enabled/*.conf;
events { events {
worker_connections 2048; worker_connections 8192;
multi_accept on; multi_accept on;
} }
@ -1282,6 +1295,9 @@ rtmp {
meta off; meta off;
wait_video on; wait_video on;
sync 10ms;
idle_streams off;
" . $rtmp_input_copy . " " . $rtmp_input_copy . "
} }
@ -1295,6 +1311,9 @@ rtmp {
meta off; meta off;
wait_video on; wait_video on;
sync 10ms;
idle_streams off;
" . $hls0 . " " . $hls0 . "
" . $dash0 . " " . $dash0 . "
" . $rtmp_push0 . " " . $rtmp_push0 . "
@ -1305,6 +1324,9 @@ rtmp {
meta off; meta off;
wait_video on; wait_video on;
sync 10ms;
idle_streams off;
" . $hls1 . " " . $hls1 . "
" . $dash1 . " " . $dash1 . "
" . $rtmp_push1 . " " . $rtmp_push1 . "
@ -1361,7 +1383,7 @@ http {
srt { srt {
worker_threads 64; worker_threads 64;
worker_connections 500; worker_connections 1000;
log_file /tmp/logs/error.log ; log_file /tmp/logs/error.log ;
log_level info; log_level info;

View File

@ -20,6 +20,7 @@ cat > /etc/apache2/sites-available/000-default.conf << 'EOL'
</VirtualHost> </VirtualHost>
EOL EOL
cat > /etc/apache2/sites-available/default-ssl.conf << 'EOL' cat > /etc/apache2/sites-available/default-ssl.conf << 'EOL'
<VirtualHost *:8443> <VirtualHost *:8443>
@ -39,6 +40,7 @@ cat > /etc/apache2/sites-available/default-ssl.conf << 'EOL'
<Directory /usr/lib/cgi-bin> <Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars SSLOptions +StdEnvVars
</Directory> </Directory>
</VirtualHost> </VirtualHost>
EOL EOL
@ -378,6 +380,23 @@ server {
location / { location / {
try_files $uri $uri/ =404; 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 EOL

View File

@ -1,73 +0,0 @@
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 2048;
multi_accept on;
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application shree {
live on;
record off;
meta off;
wait_video on;
hls on;
hls_path /var/www/html/hls/shree;
hls_fragment 3;
hls_playlist_length 60;
dash on;
dash_path /var/www/html/dash/shree;
}
application shreeshree {
live on;
record off;
meta off;
wait_video on;
hls on;
hls_path /var/www/html/hls/shreeshree;
hls_fragment 3;
hls_playlist_length 60;
dash on;
dash_path /var/www/html/dash/shreeshree;
}
}
}
http {
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}