feat: implement core backend API with data models, SSE, index management, and initial admin bootstrap.
This commit is contained in:
+7
-3
@@ -707,11 +707,15 @@ async def api_browse(vault_name: str, path: str = "", current_user=Depends(requi
|
||||
if not target.exists():
|
||||
raise HTTPException(status_code=404, detail=f"Path not found: {path}")
|
||||
|
||||
# Get vault settings for hideHiddenFiles
|
||||
settings = get_vault_setting(vault_name) or {}
|
||||
hide_hidden = settings.get("hideHiddenFiles", False)
|
||||
|
||||
items = []
|
||||
try:
|
||||
for entry in sorted(target.iterdir(), key=lambda e: (not e.is_dir(), e.name.lower())):
|
||||
# Skip hidden files/dirs
|
||||
if entry.name.startswith("."):
|
||||
# Skip hidden files/dirs if the setting is enabled
|
||||
if hide_hidden and entry.name.startswith("."):
|
||||
continue
|
||||
rel = str(entry.relative_to(vault_root)).replace("\\", "/")
|
||||
if entry.is_dir():
|
||||
@@ -719,7 +723,7 @@ async def api_browse(vault_name: str, path: str = "", current_user=Depends(requi
|
||||
try:
|
||||
file_count = sum(
|
||||
1 for child in entry.iterdir()
|
||||
if not child.name.startswith(".")
|
||||
if (not hide_hidden or not child.name.startswith("."))
|
||||
and (child.is_file() and (child.suffix.lower() in SUPPORTED_EXTENSIONS or child.name.lower() in ("dockerfile", "makefile"))
|
||||
or child.is_dir())
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user