view settings and images
This commit is contained in:
@@ -64,8 +64,19 @@ func buildTreeRecursive(currentPath string, node *models.TreeNode, hiddenDirs []
|
||||
}
|
||||
} else {
|
||||
child.Type = models.GetFileType(filepath.Ext(entry.Name()), cfg.AllowedImageExtensions, cfg.AllowedFileExtensions)
|
||||
// Only include markdown files and allowed file types in the tree
|
||||
if child.Type != models.FileTypeMarkdown && child.Type != models.FileTypeText {
|
||||
// Apply visibility for tree (left navigation)
|
||||
switch child.Type {
|
||||
case models.FileTypeMarkdown:
|
||||
// always show
|
||||
case models.FileTypeImage:
|
||||
if !cfg.ShowImagesInTree {
|
||||
continue
|
||||
}
|
||||
case models.FileTypeText:
|
||||
if !cfg.ShowFilesInTree {
|
||||
continue
|
||||
}
|
||||
default:
|
||||
continue
|
||||
}
|
||||
}
|
||||
@@ -130,11 +141,18 @@ func GetFolderContents(folderPath string, cfg *config.Config) ([]models.FileInfo
|
||||
fileInfo.DisplayName = entry.Name()
|
||||
}
|
||||
|
||||
// Skip images if they should be hidden
|
||||
if cfg.ImagesHide && fileInfo.Type == models.FileTypeImage {
|
||||
continue
|
||||
// Visibility for folder view
|
||||
if fileInfo.Type == models.FileTypeImage {
|
||||
// prefer new flag; fallback to legacy ImagesHide (handled by default in config load)
|
||||
if !cfg.ShowImagesInFolder {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if fileInfo.Type == models.FileTypeText {
|
||||
if !cfg.ShowFilesInFolder {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Skip files that are not allowed
|
||||
if fileInfo.Type == models.FileTypeOther {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user