diff options
Diffstat (limited to 'static/api/leak-files.php')
| -rw-r--r-- | static/api/leak-files.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/static/api/leak-files.php b/static/api/leak-files.php new file mode 100644 index 0000000..cd0a104 --- /dev/null +++ b/static/api/leak-files.php @@ -0,0 +1,42 @@ +<?php +// Return list of video files in Leak folder +header('Content-Type: application/json'); +header('Access-Control-Allow-Origin: *'); +header('Access-Control-Allow-Credentials: true'); + +$leakDir = '/var/www/thesiah/recordings/Leak'; +$files = []; + +try { + if (is_dir($leakDir) && is_readable($leakDir)) { + $items = scandir($leakDir); + if ($items !== false) { + foreach ($items as $item) { + if ($item === '.' || $item === '..') continue; + $path = $leakDir . '/' . $item; + if (is_file($path) && is_readable($path)) { + $ext = strtolower(pathinfo($item, PATHINFO_EXTENSION)); + if (in_array($ext, ['mp4', 'mov', 'avi', 'mkv', 'webm'])) { + $files[] = [ + 'name' => $item, + 'url' => '/recordings/Leak/' . urlencode($item), + 'size' => filesize($path), + 'modified' => filemtime($path) + ]; + } + } + } + // 최신 파일부터 정렬 + usort($files, function($a, $b) { + return $b['modified'] - $a['modified']; + }); + } + } +} catch (Exception $e) { + // 에러 발생 시 빈 배열 반환 + $files = []; +} + +echo json_encode(['files' => $files]); +?> + |
