feat: Implement offline library synchronization with IndexedDB

- Added `useOfflineLibrarySync` hook for managing offline library sync operations.
- Created `OfflineLibrarySync` component for UI integration.
- Developed `offlineLibraryDB` for IndexedDB interactions, including storing and retrieving albums, artists, songs, and playlists.
- Implemented sync operations for starred items, playlists, and scrobbling.
- Added auto-sync functionality when coming back online.
- Included metadata management for sync settings and statistics.
- Enhanced error handling and user feedback through toasts.
This commit is contained in:
2025-08-08 20:04:06 +00:00
committed by GitHub
parent 0a0feb3748
commit 3839a1be2d
13 changed files with 2102 additions and 113 deletions

View File

@@ -330,6 +330,23 @@ class NavidromeAPI {
return `${this.config.serverUrl}/rest/stream?${params.toString()}`;
}
// Direct download URL (original file). Useful for offline caching where the browser can handle transcoding.
getDownloadUrl(songId: string): string {
const salt = this.generateSalt();
const token = this.generateToken(this.config.password, salt);
const params = new URLSearchParams({
u: this.config.username,
t: token,
s: salt,
v: this.version,
c: this.clientName,
id: songId
});
return `${this.config.serverUrl}/rest/download?${params.toString()}`;
}
getCoverArtUrl(coverArtId: string, size?: number): string {
const salt = this.generateSalt();
const token = this.generateToken(this.config.password, salt);