- Lazy folder tree via /api/folder/listChildren.php with cursor pagination - ACL-safe chevrons using hasSubfolders from server; no file-count leaks - BFS smart initial folder selection + respect lastOpenedFolder - Locked nodes are expandable but not selectable - “Load more” UX (light & dark) for huge directories Closes #66
28 lines
1.2 KiB
PHP
28 lines
1.2 KiB
PHP
<?php
|
|
// Fast ACL-aware peek for tree icons/chevrons
|
|
declare(strict_types=1);
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
header('Cache-Control: no-store');
|
|
header('X-Content-Type-Options: nosniff');
|
|
|
|
require_once __DIR__ . '/../../../config/config.php';
|
|
require_once PROJECT_ROOT . '/src/controllers/FolderController.php';
|
|
|
|
if (session_status() !== PHP_SESSION_ACTIVE) session_start();
|
|
if (empty($_SESSION['authenticated'])) { http_response_code(401); echo json_encode(['error'=>'Unauthorized']); exit; }
|
|
|
|
$username = (string)($_SESSION['username'] ?? '');
|
|
$perms = [
|
|
'role' => $_SESSION['role'] ?? null,
|
|
'admin' => $_SESSION['admin'] ?? null,
|
|
'isAdmin' => $_SESSION['isAdmin'] ?? null,
|
|
'folderOnly' => $_SESSION['folderOnly'] ?? null,
|
|
'readOnly' => $_SESSION['readOnly'] ?? null,
|
|
];
|
|
@session_write_close();
|
|
|
|
$folder = isset($_GET['folder']) ? (string)$_GET['folder'] : 'root';
|
|
$folder = str_replace('\\', '/', trim($folder));
|
|
$folder = ($folder === '' || strcasecmp($folder, 'root') === 0) ? 'root' : trim($folder, '/');
|
|
|
|
echo json_encode(FolderController::stats($folder, $username, $perms), JSON_UNESCAPED_SLASHES); |