header update

This commit is contained in:
devdatt 2026-02-09 20:13:18 +05:30
parent e3a2cb8185
commit 475ce92bd5
3 changed files with 8 additions and 34 deletions

Binary file not shown.

View File

@ -9,7 +9,7 @@ https://github.com/shreebhattji/Urmi/blob/main/licence.md
*/ */
exec("sudo chmod 444 /sys/class/dmi/id/product_uuid"); exec("sudo chmod 444 /sys/class/dmi/id/product_uuid");
$version = 11.13; $version = 11.14;
function fail(string $msg): never function fail(string $msg): never
{ {
@ -70,6 +70,9 @@ KQIDAQAB
"; ";
if ($_SERVER['REQUEST_METHOD'] === 'POST') { if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($_POST['action'] !== "backup")
include 'header.php';
switch ($_POST['action']) { switch ($_POST['action']) {
case 'update': case 'update':
@ -274,7 +277,6 @@ EwIDAQAB
} }
} }
exec('sudo cp /var/www/default_nginx.conf /etc/nginx/nginx.conf'); exec('sudo cp /var/www/default_nginx.conf /etc/nginx/nginx.conf');
exec('sudo cp /var/www/default_nginx_site /etc/nginx/sites-available/default'); exec('sudo cp /var/www/default_nginx_site /etc/nginx/sites-available/default');
@ -352,7 +354,6 @@ EwIDAQAB
unlink($tmpZip); unlink($tmpZip);
break; break;
case 'restore': case 'restore':
$jsonFiles = [ $jsonFiles = [
'input.json', 'input.json',
@ -494,8 +495,10 @@ EwIDAQAB
update_service("input"); update_service("input");
break; break;
} }
} if ($_POST['action'] === "backup")
include 'header.php'; include 'header.php';
} else
include 'header.php';
?> ?>
<script> <script>

View File

@ -46,35 +46,6 @@ 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;
# These are fine at the server level, but safer inside 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;
location / {
# Handle the OPTIONS (Preflight) request correctly
if ($request_method = OPTIONS) {
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;
add_header Content-Length 0;
add_header Content-Type text/plain;
return 204;
}
try_files $uri $uri/ =404;
}
}
EOL
cat > /etc/systemd/system/encoder-rtmp0.service<< 'EOL' cat > /etc/systemd/system/encoder-rtmp0.service<< 'EOL'
[Unit] [Unit]