diff --git a/admin/dashboard/blueprints/file_browser.py b/admin/dashboard/blueprints/file_browser.py index 9adb6f6..6e3e562 100644 --- a/admin/dashboard/blueprints/file_browser.py +++ b/admin/dashboard/blueprints/file_browser.py @@ -26,10 +26,38 @@ def list_files(): if not os.path.exists(full_path): return jsonify({"success": False, "message": "目录不存在"}) + # 需要隐藏的目录列表 + hidden_dirs = { + '__pycache__', + '.git', + '.idea', + '.venv', + 'venv', + 'env', + 'node_modules', + '.vscode', + '.pytest_cache', + '.coverage', + 'htmlcov', + 'dist', + 'build', + '.eggs', + '*.egg-info' + } + items = [] for item in os.listdir(full_path): + # 跳过隐藏文件和目录 + if item.startswith('.'): + continue + item_path = os.path.join(full_path, item) is_dir = os.path.isdir(item_path) + + # 跳过隐藏目录 + if is_dir and item in hidden_dirs: + continue + items.append({ "name": item, "is_dir": is_dir,