Compare commits

...

3 Commits

Author SHA1 Message Date
b6fd907373 add 404 for unknown files
All checks were successful
/ docker (push) Successful in 1m40s
2023-07-05 01:01:54 +01:00
1770795f16 change default secret key to a variable 2023-07-05 00:52:36 +01:00
f45a186b42 fix comment 2023-07-05 00:51:24 +01:00
3 changed files with 8 additions and 3 deletions

@ -39,7 +39,7 @@ http {
expires 7d; expires 7d;
# Serve the file directly from disk # Serve the file directly from disk
try_files $uri $uri/; try_files $uri $uri/ =404;
} }
} }
} }

@ -13,7 +13,7 @@ fi
echo "Setting permissions for upload script" echo "Setting permissions for upload script"
chmod 777 /var/www/html/upload.php chmod 777 /var/www/html/upload.php
# Start php dep # Start php dependencies
echo "Starting PHP" echo "Starting PHP"
service php8.1-fpm start service php8.1-fpm start

@ -1,5 +1,10 @@
<?php <?php
/**
* DO NOT TOUCH!!!!!!!!
*/
$before = microtime(true); // Start time of the script $before = microtime(true); // Start time of the script
$defaultSecretKey = "set me"; // The default secret key
header('Content-type:application/json;charset=utf-8'); // Set the response content type to JSON header('Content-type:application/json;charset=utf-8'); // Set the response content type to JSON
/** /**
@ -76,7 +81,7 @@ try {
} }
// Check if the secret is the default one, and if so, tell the user to change it // Check if the secret is the default one, and if so, tell the user to change it
if ($secret == "set me") { if ($secret == $defaultSecretKey) {
returnJson(array( returnJson(array(
'status' => 'ERROR', 'status' => 'ERROR',
'url' => 'You need to set your upload secret in the configuration section of the upload.php file', 'url' => 'You need to set your upload secret in the configuration section of the upload.php file',