mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-08 21:08:43 +02:00
Update to use x-refresh-token header, update logout to clear refresh token, add AbsLogger logs for android refresh
This commit is contained in:
@@ -70,7 +70,12 @@ class AbsAudioPlayerWeb extends WebPlugin {
|
||||
const deviceInfo = {
|
||||
deviceId: this.getDeviceId()
|
||||
}
|
||||
const playbackSession = await $axios.$post(route, { deviceInfo, mediaPlayer: 'html5-mobile', forceDirectPlay: true })
|
||||
const reqBody = {
|
||||
deviceInfo,
|
||||
mediaPlayer: 'html5-mobile',
|
||||
forceDirectPlay: true
|
||||
}
|
||||
const playbackSession = await $axios.$post(route, reqBody)
|
||||
if (playbackSession) {
|
||||
if (startTime !== undefined && startTime !== null) playbackSession.currentTime = startTime
|
||||
this.setAudioPlayer(playbackSession, playWhenReady)
|
||||
@@ -245,7 +250,15 @@ class AbsAudioPlayerWeb extends WebPlugin {
|
||||
this.trackStartTime = Math.max(0, this.startTime - (this.currentTrack.startOffset || 0))
|
||||
const serverAddressUrl = new URL(vuexStore.getters['user/getServerAddress'])
|
||||
const serverHost = `${serverAddressUrl.protocol}//${serverAddressUrl.host}`
|
||||
this.player.src = `${serverHost}${this.currentTrack.contentUrl}`
|
||||
|
||||
let sessionTrackUrl = null
|
||||
if (this.currentTrack.contentUrl?.startsWith('/hls')) {
|
||||
sessionTrackUrl = this.currentTrack.contentUrl
|
||||
} else {
|
||||
sessionTrackUrl = `/public/session/${this.playbackSession.id}/track/${this.currentTrack.index}`
|
||||
}
|
||||
|
||||
this.player.src = `${serverHost}${sessionTrackUrl}`
|
||||
console.log(`[AbsAudioPlayer] Loading track src ${this.player.src}`)
|
||||
this.player.load()
|
||||
this.player.playbackRate = this.playbackRate
|
||||
|
||||
@@ -69,6 +69,11 @@ class AbsDatabaseWeb extends WebPlugin {
|
||||
return refreshToken ? { refreshToken } : null
|
||||
}
|
||||
|
||||
async clearRefreshToken({ serverConnectionConfigId }) {
|
||||
console.log('[AbsDatabase] Clearing refresh token...', serverConnectionConfigId)
|
||||
localStorage.removeItem(`refresh_token_${serverConnectionConfigId}`)
|
||||
}
|
||||
|
||||
async removeServerConnectionConfig(serverConnectionConfigCallObject) {
|
||||
var serverConnectionConfigId = serverConnectionConfigCallObject.serverConnectionConfigId
|
||||
var deviceData = await this.getDeviceData()
|
||||
@@ -77,6 +82,7 @@ class AbsDatabaseWeb extends WebPlugin {
|
||||
}
|
||||
|
||||
async logout() {
|
||||
console.log('[AbsDatabase] Logging out...')
|
||||
var deviceData = await this.getDeviceData()
|
||||
deviceData.lastServerConnectionConfigId = null
|
||||
localStorage.setItem('device', JSON.stringify(deviceData))
|
||||
|
||||
Reference in New Issue
Block a user