6.8 KiB
WebDAV Integration for Rekordbox Reader
This document describes the WebDAV integration that allows Rekordbox Reader to work with self-hosted storage solutions like Nextcloud and ownCloud.
🎯 Overview
The application now supports two storage providers:
- S3-Compatible Storage (AWS S3, MinIO, etc.)
- WebDAV (Nextcloud, ownCloud, etc.)
Users can choose between these providers in the Storage Configuration page.
🏗️ Architecture
Storage Provider Abstraction
The system uses a provider abstraction pattern:
StorageProvider Interface
├── S3Service (implements StorageProvider)
└── WebDAVService (implements StorageProvider)
Key Components
-
StorageProvider Interface (
src/services/storageProvider.ts)- Defines common operations for all storage providers
- Factory pattern for creating providers
- Configuration loading and validation
-
WebDAVService (
src/services/webdavService.ts)- Implements WebDAV operations using the
webdavnpm package - Supports Nextcloud, ownCloud, and other WebDAV-compatible servers
- Handles file upload, download, listing, and deletion
- Implements WebDAV operations using the
-
Updated Configuration System
- New
/api/config/storageendpoints - Support for both S3 and WebDAV configuration
- Backward compatibility with existing S3 configuration
- New
-
Frontend Storage Configuration
- Provider selection (S3 vs WebDAV)
- Dynamic form fields based on selected provider
- Connection testing for both providers
🚀 Setup Instructions
1. Backend Configuration
The backend automatically detects the storage provider from the configuration file:
File: storage-config.json
{
"provider": "webdav",
"url": "https://your-nextcloud.com/remote.php/dav/files/username/",
"username": "your-username",
"password": "your-password-or-app-password",
"basePath": "/music-files"
}
2. Environment Variables
You can also configure WebDAV using environment variables:
STORAGE_PROVIDER=webdav
WEBDAV_URL=https://your-nextcloud.com/remote.php/dav/files/username/
WEBDAV_USERNAME=your-username
WEBDAV_PASSWORD=your-password-or-app-password
WEBDAV_BASE_PATH=/music-files
3. Frontend Configuration
- Navigate to Configuration → Storage Configuration
- Select WebDAV as the storage provider
- Fill in your WebDAV server details:
- URL: Your Nextcloud/ownCloud WebDAV URL
- Username: Your account username
- Password: Your password or app password
- Base Path: Optional subfolder for music files
- Click Test Connection to verify
- Click Save Configuration to apply
🔧 Nextcloud Setup
1. Enable WebDAV
WebDAV is enabled by default in Nextcloud. You can verify this in:
- Settings → Administration → Basic settings
2. Create App Password (Recommended)
For better security, create an app password:
- Go to Settings → Personal → Security
- Scroll down to App passwords
- Create a new app password for "Rekordbox Reader"
- Use this password instead of your main password
3. Get WebDAV URL
Your WebDAV URL follows this pattern:
https://your-nextcloud.com/remote.php/dav/files/username/
Replace:
your-nextcloud.comwith your Nextcloud domainusernamewith your Nextcloud username
4. Create Music Folder (Optional)
You can create a dedicated folder for music files:
- In Nextcloud, create a folder called
music-files - Set this as the
basePathin the configuration
🔧 ownCloud Setup
The setup is similar to Nextcloud:
- Enable WebDAV in ownCloud settings
- Create an app password for security
- Use the WebDAV URL:
https://your-owncloud.com/remote.php/dav/files/username/ - Configure the same way as Nextcloud
🧪 Testing
Backend Test
Run the WebDAV test script:
cd packages/backend
node test-webdav.js
Make sure to update the configuration in the test file first.
Frontend Test
- Go to Configuration → Storage Configuration
- Select WebDAV provider
- Enter your WebDAV details
- Click Test Connection
- Verify the connection is successful
📁 File Operations
The WebDAV service supports all standard file operations:
- Upload: Upload music files to WebDAV storage
- Download: Download files for playback
- List: List all files and folders
- Delete: Remove files from storage
- Metadata: Get file information
- Streaming: Generate streaming URLs
🔒 Security Considerations
- Use App Passwords: Don't use your main Nextcloud/ownCloud password
- HTTPS Only: Always use HTTPS URLs for WebDAV connections
- Base Path: Use a dedicated folder for music files
- Permissions: Ensure the WebDAV user has appropriate permissions
🐛 Troubleshooting
Common Issues
-
Connection Failed
- Verify the WebDAV URL is correct
- Check username and password
- Ensure WebDAV is enabled on your server
-
Permission Denied
- Check if the user has write permissions
- Verify the base path exists and is accessible
-
SSL/TLS Errors
- Ensure you're using HTTPS
- Check if the SSL certificate is valid
-
File Upload Fails
- Check available storage space
- Verify file permissions
- Ensure the file format is supported
Debug Mode
Enable debug logging by setting:
DEBUG=webdav:*
🔄 Migration from S3
If you're migrating from S3 to WebDAV:
- Export your current configuration
- Set up WebDAV storage
- Update the configuration to use WebDAV
- The application will automatically use the new storage provider
📊 Performance
WebDAV performance depends on:
- Network latency to your server
- Server performance and storage type
- File sizes and concurrent operations
For best performance:
- Use a local or fast Nextcloud/ownCloud instance
- Consider using SSD storage
- Optimize your network connection
🎵 Supported File Formats
The WebDAV integration supports all audio formats supported by the application:
- MP3
- WAV
- FLAC
- M4A
- AAC
- OGG
- OPUS
- WMA
📝 API Endpoints
Storage Configuration
GET /api/config/storage- Get current storage configurationPOST /api/config/storage- Save storage configurationPOST /api/config/storage/test- Test storage connection
Legacy S3 Endpoints
The following endpoints are still available for backward compatibility:
GET /api/config/s3- Get S3 configurationPOST /api/config/s3- Save S3 configurationPOST /api/config/s3/test- Test S3 connection
🤝 Contributing
When adding new storage providers:
- Implement the
StorageProviderinterface - Add the provider to
StorageProviderFactory - Update the frontend configuration UI
- Add appropriate tests
- Update this documentation
📄 License
This WebDAV integration follows the same license as the main Rekordbox Reader project.