mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-10 19:31:39 +00:00
Merge branch 'advplyr:master' into feature/user-ereader-creation
This commit is contained in:
commit
c43783a2ca
23 changed files with 288 additions and 116 deletions
|
|
@ -243,6 +243,15 @@ class Server {
|
|||
await this.auth.initPassportJs()
|
||||
|
||||
const router = express.Router()
|
||||
// if RouterBasePath is set, modify all requests to include the base path
|
||||
if (global.RouterBasePath) {
|
||||
app.use((req, res, next) => {
|
||||
if (!req.url.startsWith(global.RouterBasePath)) {
|
||||
req.url = `${global.RouterBasePath}${req.url}`
|
||||
}
|
||||
next()
|
||||
})
|
||||
}
|
||||
app.use(global.RouterBasePath, router)
|
||||
app.disable('x-powered-by')
|
||||
|
||||
|
|
@ -340,7 +349,7 @@ class Server {
|
|||
Logger.info('Received ping')
|
||||
res.json({ success: true })
|
||||
})
|
||||
app.get('/healthcheck', (req, res) => res.sendStatus(200))
|
||||
router.get('/healthcheck', (req, res) => res.sendStatus(200))
|
||||
|
||||
this.server.listen(this.Port, this.Host, () => {
|
||||
if (this.Host) Logger.info(`Listening on http://${this.Host}:${this.Port}`)
|
||||
|
|
|
|||
|
|
@ -103,7 +103,8 @@ class SocketAuthority {
|
|||
cors: {
|
||||
origin: '*',
|
||||
methods: ['GET', 'POST']
|
||||
}
|
||||
},
|
||||
path: `${global.RouterBasePath}/socket.io`
|
||||
})
|
||||
|
||||
this.io.on('connection', (socket) => {
|
||||
|
|
|
|||
|
|
@ -508,9 +508,9 @@ module.exports = {
|
|||
}
|
||||
if (book.publisher) data.publishers.add(book.publisher)
|
||||
// Check if published year exists and is valid
|
||||
if (book.publishedYear && !isNaN(book.publishedYear) && book.publishedYear > 0 && book.publishedYear < 3000 && book.publishedYear.toString().length === 4) {
|
||||
const decade = Math.floor(book.publishedYear / 10) * 10
|
||||
data.publishedDecades.add(decade.toString())
|
||||
if (book.publishedYear && !isNaN(book.publishedYear) && book.publishedYear > 0 && book.publishedYear < 3000) {
|
||||
const decade = (Math.floor(book.publishedYear / 10) * 10).toString()
|
||||
data.publishedDecades.add(decade)
|
||||
}
|
||||
if (book.language) data.languages.add(book.language)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,10 +229,11 @@ module.exports = {
|
|||
mediaWhere['$series.id$'] = null
|
||||
}
|
||||
} else if (group === 'publishedDecades') {
|
||||
const year = parseInt(value, 10)
|
||||
mediaWhere['publishedYear'] = {
|
||||
[Sequelize.Op.between]: year >= 1000 ? [year, year + 9] : [year * 10, (year + 1) * 10 - 1]
|
||||
}
|
||||
const startYear = parseInt(value)
|
||||
const endYear = parseInt(value, 10) + 9
|
||||
mediaWhere = Sequelize.where(Sequelize.literal('CAST(`book`.`publishedYear` AS INTEGER)'), {
|
||||
[Sequelize.Op.between]: [startYear, endYear]
|
||||
})
|
||||
}
|
||||
|
||||
return { mediaWhere, replacements }
|
||||
|
|
@ -504,7 +505,6 @@ module.exports = {
|
|||
}
|
||||
|
||||
let { mediaWhere, replacements } = this.getMediaGroupQuery(filterGroup, filterValue)
|
||||
|
||||
let bookWhere = Array.isArray(mediaWhere) ? mediaWhere : [mediaWhere]
|
||||
|
||||
// User permissions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue