mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 06:49:24 +02:00
Fixed #15 again, now check authorization also using query param
This commit is contained in:
parent
795cd7beb9
commit
3ccb70d0a8
9 changed files with 98 additions and 8 deletions
|
@ -5,6 +5,8 @@ import Audio from '@/audio'
|
|||
import backend from '@/audio/backend'
|
||||
import radios from '@/radios'
|
||||
import Vue from 'vue'
|
||||
import url from '@/utils/url'
|
||||
import auth from '@/auth'
|
||||
|
||||
class Queue {
|
||||
constructor (options = {}) {
|
||||
|
@ -181,7 +183,17 @@ class Queue {
|
|||
if (!file) {
|
||||
return this.next()
|
||||
}
|
||||
this.audio = new Audio(backend.absoluteUrl(file.path), {
|
||||
let path = backend.absoluteUrl(file.path)
|
||||
|
||||
if (auth.user.authenticated) {
|
||||
// we need to send the token directly in url
|
||||
// so authentication can be checked by the backend
|
||||
// because for audio files we cannot use the regular Authentication
|
||||
// header
|
||||
path = url.updateQueryString(path, 'jwt', auth.getAuthToken())
|
||||
}
|
||||
|
||||
this.audio = new Audio(path, {
|
||||
preload: true,
|
||||
autoplay: true,
|
||||
rate: 1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue