2024-03-01 22:14:20 +01:00
|
|
|
<?php
|
2024-04-27 11:48:58 +02:00
|
|
|
declare(strict_types=1);
|
2024-03-01 22:14:20 +01:00
|
|
|
|
|
|
|
require_once "lib/upload.php";
|
|
|
|
|
|
|
|
function endpoint($endpoint_data): array
|
|
|
|
{
|
|
|
|
|
|
|
|
return match ($endpoint_data["action"]) {
|
|
|
|
"getMyFiles" => listFiles(),
|
|
|
|
"getAllFiles" => listFiles(false),
|
2024-04-11 10:36:40 +02:00
|
|
|
"uploadFiles" => parseIncomingFiles(),
|
2024-04-25 15:01:17 +02:00
|
|
|
"deleteFile" => deleteFile($endpoint_data['file_id']),
|
2024-04-11 10:36:40 +02:00
|
|
|
"addToGroup" => addToGroup($endpoint_data['group_id'], $endpoint_data['file_id']),
|
2024-04-26 14:37:54 +02:00
|
|
|
"myFileExists" => fileExists($endpoint_data['file_id']),
|
2024-04-11 10:36:40 +02:00
|
|
|
"FileExists" => fileExists($endpoint_data['file_id'], false),
|
2024-03-01 22:14:20 +01:00
|
|
|
default => ["Status" => "Fail", "message" => "Invalid action"],
|
|
|
|
};
|
|
|
|
}
|