update
This commit is contained in:
parent
cbc99fa81c
commit
cf09a56ae2
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
exec("sudo chmod 444 /sys/class/dmi/id/product_uuid");
|
exec("sudo chmod 444 /sys/class/dmi/id/product_uuid");
|
||||||
$version = 7;
|
$version = 8;
|
||||||
|
|
||||||
function fail(string $msg): never
|
function fail(string $msg): never
|
||||||
{
|
{
|
||||||
|
|
@ -94,13 +94,73 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
|
||||||
$data = json_decode($response, true);
|
$data = json_decode($response, true);
|
||||||
|
|
||||||
|
if ($data['status'] != "valid") {
|
||||||
echo '<script>alert("'
|
echo '<script>alert("'
|
||||||
. htmlspecialchars($data['message'], ENT_QUOTES)
|
. htmlspecialchars($data['message'], ENT_QUOTES)
|
||||||
. '");</script>';
|
. '");</script>';
|
||||||
|
}
|
||||||
error_log($data['status']);
|
|
||||||
|
|
||||||
if ($data['status'] == "valid") {
|
if ($data['status'] == "valid") {
|
||||||
|
echo '
|
||||||
|
<style>
|
||||||
|
#blocker {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0,0,0,0.75);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 999999;
|
||||||
|
pointer-events: all;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blockerBox {
|
||||||
|
background: #111827;
|
||||||
|
color: #ffffff;
|
||||||
|
padding: 28px 36px;
|
||||||
|
border-radius: 8px;
|
||||||
|
text-align: center;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
min-width: 320px;
|
||||||
|
box-shadow: 0 20px 50px rgba(0,0,0,.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
#blockerBox .msg {
|
||||||
|
font-size: 18px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#blockerBox .timer {
|
||||||
|
font-size: 34px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div id="blocker">
|
||||||
|
<div id="blockerBox">
|
||||||
|
<div class="msg">'
|
||||||
|
. htmlspecialchars($data['message'], ENT_QUOTES) .
|
||||||
|
'</div>
|
||||||
|
<div>Continuing in</div>
|
||||||
|
<div class="timer" id="blockerTimer">100</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let seconds = 100;
|
||||||
|
const timer = document.getElementById("blockerTimer");
|
||||||
|
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
seconds--;
|
||||||
|
timer.textContent = seconds;
|
||||||
|
|
||||||
|
if (seconds <= 0) {
|
||||||
|
clearInterval(interval);
|
||||||
|
document.getElementById("blocker").remove();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
</script>
|
||||||
|
';
|
||||||
|
|
||||||
$public_key = "-----BEGIN PUBLIC KEY-----
|
$public_key = "-----BEGIN PUBLIC KEY-----
|
||||||
MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEAm+7Vl0fEgey2tF6v2mTn
|
MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEAm+7Vl0fEgey2tF6v2mTn
|
||||||
3C/FDGn589uY5a9rpDeZLlhjdOdFaTMWL3d8oEhmImCd+aPELpxydQ+xGxVPNOzO
|
3C/FDGn589uY5a9rpDeZLlhjdOdFaTMWL3d8oEhmImCd+aPELpxydQ+xGxVPNOzO
|
||||||
|
|
|
||||||
|
|
@ -757,7 +757,10 @@ function update_service($which_service)
|
||||||
break;
|
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 = "/var/www/encoder-rtmp0.sh";
|
||||||
file_put_contents($file, $rtmp);
|
file_put_contents($file, $rtmp);
|
||||||
exec('sudo systemctl enable encoder-rtmp0');
|
exec('sudo systemctl enable encoder-rtmp0');
|
||||||
|
|
@ -795,7 +798,10 @@ function update_service($which_service)
|
||||||
error_log("service_rtmp1_multiple");
|
error_log("service_rtmp1_multiple");
|
||||||
break;
|
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 = "/var/www/encoder-rtmp1.sh";
|
||||||
file_put_contents($file, $rtmp);
|
file_put_contents($file, $rtmp);
|
||||||
exec('sudo systemctl enable encoder-rtmp1');
|
exec('sudo systemctl enable encoder-rtmp1');
|
||||||
|
|
@ -1335,7 +1341,7 @@ rtmp {
|
||||||
chunk_size 4096;
|
chunk_size 4096;
|
||||||
|
|
||||||
";
|
";
|
||||||
if ($input_source === "rtmp") {
|
if ($input_source === "rtmp" || $input_rtmp_mount !== "") {
|
||||||
$nginx .= "
|
$nginx .= "
|
||||||
|
|
||||||
application " . $input_rtmp_mount . " {
|
application " . $input_rtmp_mount . " {
|
||||||
|
|
|
||||||
27
install.sh
27
install.sh
|
|
@ -384,26 +384,19 @@ server {
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
index index.php index.html;
|
index index.php 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 / {
|
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
|
||||||
|
|
||||||
|
|
|
||||||
26
setup.sh
26
setup.sh
|
|
@ -18,5 +18,31 @@ if [ ! -f "$TARGET_FILE" ]; then
|
||||||
cp "$SOURCE_FILE" "$TARGET_FILE"
|
cp "$SOURCE_FILE" "$TARGET_FILE"
|
||||||
fi
|
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 chown -R www-data:www-data /var/www/*
|
||||||
sudo reboot
|
sudo reboot
|
||||||
Loading…
Reference in New Issue