Stream snapshot file listings

This commit is contained in:
Mikei386
2026-07-10 12:41:48 +02:00
parent c2f0f0b277
commit f22c2e462d
10 changed files with 59 additions and 19 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ header('Content-Type: application/json');
$socket = '/run/urbm/urbm.sock';
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$path = $_GET['path'] ?? '/v1/health';
$isSnapshotFileRequest = preg_match('#/snapshots/[^/]+/files(?:\?|$)#', $path) === 1;
if (!preg_match('#^/v1/[A-Za-z0-9_./?=&%:-]*$#', $path) || str_contains($path, '..')) {
http_response_code(400);
@@ -26,7 +27,7 @@ curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 3,
CURLOPT_TIMEOUT => 310,
CURLOPT_TIMEOUT => $isSnapshotFileRequest ? 1250 : 310,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
]);