Core Workflow
process_and_upload
Main command that processes files and uploads them to R2 or saves locally in demo mode.Application state containing R2 config and settings
Array of file paths (as strings) to process and upload
Result<DropResult, String>
DropResult Structure
Public URL to access the uploaded file. Format:
https://your-domain.com/u/{key} for R2 uploads, or file:///path/to/file for demo modePath to the local file (only set in demo mode)
R2 object key (only set when uploaded to R2)
Total size of original file(s) in bytes
Size of processed file in bytes
File extension of the output (“webp”, “zip”, etc.)
Whether the file was processed in demo mode
- Checks if demo mode is enabled
- Determines output directory (Downloads/ZipDrop for demo, /tmp/zipdrop for production)
- Processes files (convert to WebP or ZIP)
- Either:
- Demo mode: Saves to Downloads/ZipDrop, copies local path to clipboard
- Production mode: Uploads to R2, copies public URL to clipboard
- Returns
DropResultwith all metadata
- Empty paths array:
"No files provided" - Validation failures: See File Processing errors
- R2 not configured (production mode):
"R2 not configured. Please set up your R2 credentials or enable demo mode." - Upload failures: Network or credential errors from R2
Configuration Management
set_r2_config
Saves R2 configuration to macOS Keychain and updates app state.Application state
R2 configuration object with all credentials
R2 access key ID
R2 secret access key
R2 bucket name
Cloudflare account ID
Base URL for public access (e.g.,
https://files.example.com)- Saves credentials to macOS Keychain (secure storage)
- Saves non-secret config to
~/Library/Application Support/zipdrop/config.json - Automatically disables demo mode
- Updates in-memory app state
get_r2_config
Retrieves the current R2 configuration (for populating settings forms).Option<R2Config> - Configuration if set, null if not configured
Example:
get_config_status
Returns the current configuration status (lighter weight thanget_r2_config).
Whether R2 credentials are configured
Whether demo mode is enabled
Current bucket name if configured
clear_r2_config
Deletes R2 configuration from Keychain and file system.- Removes credentials from macOS Keychain
- Deletes
~/Library/Application Support/zipdrop/config.json - Clears in-memory app state
validate_r2_config
Validates R2 credentials before saving by uploading a test object.R2 configuration to validate
- Creates S3/R2 client with provided credentials
- Uploads tiny test object (
.zipdrop-connection-test) - Deletes test object if upload succeeds
- Returns error if any step fails
"Connection timed out - please try again"- Network timeout"Connection failed - check your network"- Network unreachable"Invalid R2 credentials"- Auth failure or other error
Settings
set_demo_mode
Enables or disables demo mode.Whether to enable demo mode
- Updates
~/Library/Application Support/zipdrop/settings.json - Updates in-memory app state
Utility Commands
copy_to_clipboard
Copies text to the system clipboard.Text to copy to clipboard
reveal_in_finder
Opens Finder and selects the specified file.Absolute path to the file to reveal
open_in_browser
Opens a URL in the default browser.URL to open
delete_from_r2
Deletes an object from R2 storage.Application state containing R2 config
R2 object key to delete (e.g.,
"u/x7y8z9w0_file.zip")App State
All commands that require state access the globalAppState structure:
Thread-safe R2 configuration (None if not configured)
Thread-safe app settings (demo mode, output directory)
State is managed by Tauri and automatically injected into command handlers. Frontend code doesn’t need to pass state explicitly.