diff --git a/src/library/TrackContextMenu.vue b/src/library/TrackContextMenu.vue
index b5ee790..4e2b8a4 100644
--- a/src/library/TrackContextMenu.vue
+++ b/src/library/TrackContextMenu.vue
@@ -12,6 +12,9 @@
{{ starred ? 'Unstar' : 'Star' }}
+
+ Download
+
@@ -35,6 +38,9 @@
}
return this.$api.star('track', this.track.id)
},
+ download() {
+ window.location.href = this.$api.getDownloadUrl(this.track.id)
+ },
setNextInQueue() {
return this.$store.dispatch('player/setNextInQueue', [this.track])
},
diff --git a/src/shared/api.ts b/src/shared/api.ts
index aca7a1b..5c308cd 100644
--- a/src/shared/api.ts
+++ b/src/shared/api.ts
@@ -428,6 +428,17 @@ export class API {
}
}
+ getDownloadUrl(id: any) {
+ const { server, username, salt, hash } = this.auth
+ return `${server}/rest/download` +
+ `?id=${id}` +
+ '&v=1.15.0' +
+ `&u=${username}` +
+ `&s=${salt}` +
+ `&t=${hash}` +
+ `&c=${this.clientName}`
+ }
+
private getCoverArtUrl(item: any) {
if (!item.coverArt) {
return undefined