mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-21 08:36:03 +02:00
Add:API endpoint to get users online and open listening sessions #1125
This commit is contained in:
parent
abb4137d4c
commit
fdf67e17a0
3 changed files with 19 additions and 5 deletions
|
@ -183,6 +183,19 @@ class UserController {
|
|||
res.json(this.userJsonWithItemProgressDetails(user, !req.user.isRoot))
|
||||
}
|
||||
|
||||
// POST: api/users/online (admin)
|
||||
async getOnlineUsers(req, res) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
const usersOnline = this.getUsersOnline()
|
||||
|
||||
res.json({
|
||||
usersOnline,
|
||||
openSessions: this.playbackSessionManager.sessions
|
||||
})
|
||||
}
|
||||
|
||||
middleware(req, res, next) {
|
||||
if (!req.user.isAdminOrUp && req.user.id !== req.params.id) {
|
||||
return res.sendStatus(403)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue