Enforce authentication on all endpoints

This commit is contained in:
Ryan
2025-03-07 10:53:50 -05:00
committed by GitHub
parent 12e0acf5bd
commit 9a606ab59f
9 changed files with 38 additions and 2 deletions

View File

@@ -2,6 +2,13 @@
require 'config.php';
header('Content-Type: application/json');
// Ensure user is authenticated
if (!isset($_SESSION['authenticated']) || $_SESSION['authenticated'] !== true) {
echo json_encode(["error" => "Unauthorized"]);
http_response_code(401);
exit;
}
$folderList = [];
$dir = rtrim(UPLOAD_DIR, '/\\');
if (is_dir($dir)) {