add download button. fixes #23
This commit is contained in:
parent
4e71857e2a
commit
325f642d72
@ -12,6 +12,9 @@
|
||||
<b-dropdown-item-button @click="toggleStarred()">
|
||||
{{ starred ? 'Unstar' : 'Star' }}
|
||||
</b-dropdown-item-button>
|
||||
<b-dropdown-item-button @click="download()">
|
||||
Download
|
||||
</b-dropdown-item-button>
|
||||
<slot :item="track" />
|
||||
</b-dropdown>
|
||||
</template>
|
||||
@ -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])
|
||||
},
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user