Compare commits

..

1 Commits

Author SHA1 Message Date
advplyr 794f0ef42a Fix server crash when transcode requests are made to the direct play endpoint #4555 2025-08-07 17:21:05 -05:00
5 changed files with 18 additions and 37 deletions
-16
View File
@@ -353,14 +353,6 @@ export default {
if (!this.userProgressLastUpdated) return '\u00A0'
return this.$getString('LabelLastProgressDate', [this.$formatDatetime(this.userProgressLastUpdated, this.dateFormat, this.timeFormat)])
}
if (this.orderBy === 'progress.createdAt') {
if (!this.userProgressStartedDate) return '\u00A0'
return this.$getString('LabelStartedDate', [this.$formatDatetime(this.userProgressStartedDate, this.dateFormat, this.timeFormat)])
}
if (this.orderBy === 'progress.finishedAt') {
if (!this.userProgressFinishedDate) return '\u00A0'
return this.$getString('LabelFinishedDate', [this.$formatDatetime(this.userProgressFinishedDate, this.dateFormat, this.timeFormat)])
}
return null
},
episodeProgress() {
@@ -397,14 +389,6 @@ export default {
if (!this.userProgress) return null
return this.userProgress.lastUpdate
},
userProgressStartedDate() {
if (!this.userProgress) return null
return this.userProgress.startedAt
},
userProgressFinishedDate() {
if (!this.userProgress) return null
return this.userProgress.finishedAt
},
itemIsFinished() {
if (this.booksInSeries) return this.seriesIsFinished
return this.userProgress ? !!this.userProgress.isFinished : false
@@ -134,14 +134,6 @@ export default {
text: this.$strings.LabelLibrarySortByProgress,
value: 'progress'
},
{
text: this.$strings.LabelLibrarySortByProgressStarted,
value: 'progress.createdAt'
},
{
text: this.$strings.LabelLibrarySortByProgressFinished,
value: 'progress.finishedAt'
},
{
text: this.$strings.LabelRandomly,
value: 'random'
@@ -208,4 +200,4 @@ export default {
.librarySortMenu {
max-height: calc(100vh - 125px);
}
</style>
</style>
-4
View File
@@ -376,7 +376,6 @@
"LabelFilterByUser": "Filter by User",
"LabelFindEpisodes": "Find Episodes",
"LabelFinished": "Finished",
"LabelFinishedDate": "Finished {0}",
"LabelFolder": "Folder",
"LabelFolders": "Folders",
"LabelFontBold": "Bold",
@@ -435,8 +434,6 @@
"LabelLibraryItem": "Library Item",
"LabelLibraryName": "Library Name",
"LabelLibrarySortByProgress": "Progress Updated",
"LabelLibrarySortByProgressFinished": "Finished Date",
"LabelLibrarySortByProgressStarted": "Started Date",
"LabelLimit": "Limit",
"LabelLineSpacing": "Line spacing",
"LabelListenAgain": "Listen Again",
@@ -634,7 +631,6 @@
"LabelStartTime": "Start Time",
"LabelStarted": "Started",
"LabelStartedAt": "Started At",
"LabelStartedDate": "Started {0}",
"LabelStatsAudioTracks": "Audio Tracks",
"LabelStatsAuthors": "Authors",
"LabelStatsBestDay": "Best Day",
+13
View File
@@ -4,6 +4,7 @@ const Logger = require('../Logger')
const Database = require('../Database')
const { toNumber, isUUID } = require('../utils/index')
const { getAudioMimeTypeFromExtname, encodeUriPath } = require('../utils/fileUtils')
const { PlayMethod } = require('../utils/constants')
const ShareManager = require('../managers/ShareManager')
@@ -299,6 +300,18 @@ class SessionController {
return res.sendStatus(404)
}
// Redirect transcode requests to the HLS router
// Handles bug introduced in android v0.10.0-beta where transcode requests are made to this endpoint
if (playbackSession.playMethod === PlayMethod.TRANSCODE && audioTrack.contentUrl) {
Logger.debug(`[SessionController] Redirecting transcode request to "${audioTrack.contentUrl}"`)
return res.redirect(audioTrack.contentUrl)
}
if (!audioTrack.metadata?.path) {
Logger.error(`[SessionController] Invalid audio track "${audioTrack.index}" for session "${req.params.id}"`)
return res.sendStatus(500)
}
const user = await Database.userModel.getUserById(playbackSession.userId)
Logger.debug(`[SessionController] Serving audio track ${audioTrack.index} for session "${req.params.id}" belonging to user "${user.username}"`)
@@ -289,11 +289,7 @@ module.exports = {
const nullDir = sortDesc ? 'DESC NULLS FIRST' : 'ASC NULLS LAST'
return [[Sequelize.literal(`CAST(\`series.bookSeries.sequence\` AS FLOAT) ${nullDir}`)]]
} else if (sortBy === 'progress') {
return [[Sequelize.literal(`mediaProgresses.updatedAt ${dir} NULLS LAST`)]]
} else if (sortBy === 'progress.createdAt') {
return [[Sequelize.literal(`mediaProgresses.createdAt ${dir} NULLS LAST`)]]
} else if (sortBy === 'progress.finishedAt') {
return [[Sequelize.literal(`mediaProgresses.finishedAt ${dir} NULLS LAST`)]]
return [[Sequelize.literal('mediaProgresses.updatedAt'), dir]]
} else if (sortBy === 'random') {
return [Database.sequelize.random()]
}
@@ -523,7 +519,7 @@ module.exports = {
}
bookIncludes.push({
model: Database.mediaProgressModel,
attributes: ['id', 'isFinished', 'currentTime', 'ebookProgress', 'updatedAt', 'createdAt', 'finishedAt'],
attributes: ['id', 'isFinished', 'currentTime', 'ebookProgress', 'updatedAt'],
where: mediaProgressWhere,
required: false
})
@@ -534,10 +530,10 @@ module.exports = {
}
// When sorting by progress but not filtering by progress, include media progresses
if (filterGroup !== 'progress' && ['progress.createdAt', 'progress.finishedAt', 'progress'].includes(sortBy)) {
if (filterGroup !== 'progress' && sortBy === 'progress') {
bookIncludes.push({
model: Database.mediaProgressModel,
attributes: ['id', 'isFinished', 'currentTime', 'ebookProgress', 'updatedAt', 'createdAt', 'finishedAt'],
attributes: ['id', 'isFinished', 'currentTime', 'ebookProgress', 'updatedAt'],
where: {
userId: user.id
},