feat: Add comprehensive batch upload and context menu enhancements#48
feat: Add comprehensive batch upload and context menu enhancements#48LazyZane wants to merge 2 commits into
Conversation
This commit introduces several major features and bug fixes to improve the plugin's functionality:
## New Features
### 1. Batch Upload Capabilities
- Add "Batch upload all local images in vault" command
- Add "Batch upload local images in current folder" command
- Add right-click context menu on folders to batch upload images
- Add "Upload all local images in this file" in editor context menu
- Implement deduplication using file hash to skip already uploaded files
- Generate detailed batch upload logs in markdown format
### 2. Enhanced Context Menu
- Add "Upload to cloud" option for local images
- Add "Download to local" option for remote S3 images
- Add "Delete from cloud" option for S3 images (with confirmation)
- Add "Delete local file" option for local images (with confirmation)
- Add "Rename description" option to edit image alt text
### 3. Upload Failure Handling
- Implement fallback to local save when S3 upload fails
- Use hash-based filenames for unique naming
- Respect Obsidian's attachment folder settings
### 4. New Settings
- Fallback to local on upload failure (default: enabled)
- Delete local file after successful upload (default: disabled)
- Enable batch upload logs (default: enabled)
- Batch log folder configuration (default: .s3-logs)
## Bug Fixes
### 1. Fix Auto-Upload Trigger on Download
- Prevent downloaded files from triggering auto-upload
- Add skipAutoUploadPaths tracking to exclude internal operations
- Apply same logic to fallback local saves
### 2. Fix Batch Upload Path Variables
- Implement variable replacement in batch upload (${year}, ${month}, ${day}, ${basename})
- Extract note basename for proper path generation
- Ensure consistency with single file upload behavior
### 3. Fix Download Path Handling
- Pass current note path to getAttachmentFolder for proper relative path resolution
- Support "./" prefix for same-folder and relative subfolder attachments
## Technical Improvements
- Add TypeScript interfaces: BatchTask, LogEntry, MediaLink
- Import additional Obsidian types: TFolder, Menu, Modal
- Import AWS SDK commands: DeleteObjectCommand, HeadObjectCommand
- Add helper methods: parseMediaLink, s3ObjectExists, deleteS3Object, extractS3KeyFromUrl
- Add modal components: BatchConfirmModal, RenameAltModal, DeleteConfirmModal
- Implement comprehensive error handling with user-friendly notices
Co-Authored-By: Claude <noreply@anthropic.com>
- Add i18n framework with $() translation function - Create English (en.ts) and Simplified Chinese (zh-cn.ts) locale files - Translate all UI text: settings, commands, context menus, notices, modals - Add URL encoding for Chinese characters in S3 path segments Co-Authored-By: Claude <noreply@anthropic.com>
|
hey, thanks for stopping, using the plugin, and contributing. could you explain what is the use case and motivation for this feature? also the solution - thanks |
|
Thanks for your feedback! Here are the primary use cases and motivations for this PR:
Upload/Batch Upload: For converting existing local attachments to S3 links. |
|
Thanks for the contribution — the use cases make sense and the code is generally well-structured. Here's my review: ScopeThis PR bundles 5-6 distinct features (batch upload, context menus, local fallback, i18n, new settings, bug fixes). Splitting into smaller PRs would make review and potential reverts much easier. Consider starting with bug fixes and local fallback, then building up to batch upload, context menus, and i18n separately. Key ConcernsData Safety
Race Condition in
|
This commit introduces several major features and bug fixes to improve the plugin's functionality:
New Features
1. Batch Upload Capabilities
2. Enhanced Context Menu
3. Upload Failure Handling
4. New Settings
Bug Fixes
1. Fix Auto-Upload Trigger on Download
2. Fix Batch Upload Path Variables
3. Fix Download Path Handling
Technical Improvements