blob: cd0a10433dd63c5848ddc960a0c4cd503ca3c353 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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]);
?>
|