feat: Add archive extraction feature to file manager

Adds comprehensive archive extraction support to the file manager context menu:

Backend API (file-manager.ts):
- New POST /ssh/file_manager/ssh/extractArchive endpoint
- Supports multiple archive formats: .zip, .tar, .tar.gz, .tgz, .tar.bz2, .tbz2, .tar.xz, .gz, .bz2, .xz, .7z, .rar
- Automatically selects appropriate extraction command based on file extension
- Extracts to current directory by default, supports custom extraction path
- Proper error handling and logging for extraction operations

Frontend Implementation:
- Added extractSSHArchive() function in main-axios.ts for API calls
- Added handleExtractArchive() handler in FileManager.tsx
- FileManagerContextMenu displays 'Extract Archive' option for supported archive files
- FileArchive icon from lucide-react for visual clarity
- Keyboard shortcut: Ctrl+E

User Experience:
- Right-click on any supported archive file to see 'Extract Archive' option
- Toast notifications for progress and success/error states
- Automatic directory refresh after extraction to show extracted files
- Only shows extract option for recognized archive file types

i18n Support:
- English translations: extractArchive, extractingArchive, archiveExtractedSuccessfully, extractFailed
- Chinese translations: 解压文件, 正在解压, 解压成功, 解压失败

Supported Archive Formats:
- ZIP archives (.zip)
- TAR archives (.tar, .tar.gz, .tgz, .tar.bz2, .tbz2, .tar.xz)
- Compressed files (.gz, .bz2, .xz)
- 7-Zip archives (.7z)
- RAR archives (.rar)

This feature streamlines file management workflows by allowing users to extract archives directly from the file manager without switching to terminal.
This commit is contained in:
ZacharyZcR
2025-11-09 17:56:08 +08:00
parent 303386806f
commit c4c5be34f2
6 changed files with 239 additions and 0 deletions

View File

@@ -903,6 +903,10 @@
"connectToSsh": "Connect to SSH to use file operations",
"uploadFile": "Upload File",
"downloadFile": "Download",
"extractArchive": "Extract Archive",
"extractingArchive": "Extracting {{name}}...",
"archiveExtractedSuccessfully": "{{name}} extracted successfully",
"extractFailed": "Extract failed",
"edit": "Edit",
"preview": "Preview",
"previous": "Previous",