Fix use first accessible library depending on display order, default library id checked on server when authenticating

This commit is contained in:
advplyr 2022-03-27 09:45:28 -05:00
parent 0dd219f303
commit 08e1782253
7 changed files with 22 additions and 24 deletions

View file

@ -381,9 +381,10 @@ class LibraryController {
}
if (hasUpdates) {
Logger.info(`[LibraryController] Updated library display orders`)
this.db.libraries.sort((a, b) => a.displayOrder - b.displayOrder)
Logger.debug(`[LibraryController] Updated library display orders`)
} else {
Logger.info(`[LibraryController] Library orders were up to date`)
Logger.debug(`[LibraryController] Library orders were up to date`)
}
var libraries = this.db.libraries.map(lib => lib.toJSON())

View file

@ -168,7 +168,7 @@ class MiscController {
Logger.error('Invalid user in authorize')
return res.sendStatus(401)
}
res.json({ user: req.user })
res.json({ user: req.user, userDefaultLibraryId: req.user.getDefaultLibraryId(this.db.libraries) })
}
getAllTags(req, res) {