mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-22 00:07:52 +01:00
Fix sync request responding with 500 status code
This commit is contained in:
parent
57d742b862
commit
a1ec10bd0d
@ -343,20 +343,20 @@ class PlaybackSessionManager {
|
|||||||
* @param {import('../models/User')} user
|
* @param {import('../models/User')} user
|
||||||
* @param {*} session
|
* @param {*} session
|
||||||
* @param {*} syncData
|
* @param {*} syncData
|
||||||
* @returns
|
* @returns {Promise<boolean>}
|
||||||
*/
|
*/
|
||||||
async syncSession(user, session, syncData) {
|
async syncSession(user, session, syncData) {
|
||||||
// TODO: Combine libraryItem query with library query
|
// TODO: Combine libraryItem query with library query
|
||||||
const libraryItem = await Database.libraryItemModel.getExpandedById(session.libraryItemId)
|
const libraryItem = await Database.libraryItemModel.getExpandedById(session.libraryItemId)
|
||||||
if (!libraryItem) {
|
if (!libraryItem) {
|
||||||
Logger.error(`[PlaybackSessionManager] syncSession Library Item not found "${session.libraryItemId}"`)
|
Logger.error(`[PlaybackSessionManager] syncSession Library Item not found "${session.libraryItemId}"`)
|
||||||
return null
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const library = await Database.libraryModel.findByPk(libraryItem.libraryId)
|
const library = await Database.libraryModel.findByPk(libraryItem.libraryId)
|
||||||
if (!library) {
|
if (!library) {
|
||||||
Logger.error(`[PlaybackSessionManager] syncSession Library not found "${libraryItem.libraryId}"`)
|
Logger.error(`[PlaybackSessionManager] syncSession Library not found "${libraryItem.libraryId}"`)
|
||||||
return null
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
session.currentTime = syncData.currentTime
|
session.currentTime = syncData.currentTime
|
||||||
@ -382,6 +382,8 @@ class PlaybackSessionManager {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.saveSession(session)
|
this.saveSession(session)
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user