mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-26 02:39:05 +02:00
Update:API endpoint for get all users to use minimal payload
This commit is contained in:
parent
d2e0844493
commit
575a162f8b
3 changed files with 11 additions and 9 deletions
|
@ -101,12 +101,12 @@ class User {
|
|||
}
|
||||
}
|
||||
|
||||
toJSONForBrowser() {
|
||||
return {
|
||||
toJSONForBrowser(hideRootToken = false, minimal = false) {
|
||||
const json = {
|
||||
id: this.id,
|
||||
username: this.username,
|
||||
type: this.type,
|
||||
token: this.token,
|
||||
token: (this.type === 'root' && hideRootToken) ? '' : this.token,
|
||||
mediaProgress: this.mediaProgress ? this.mediaProgress.map(li => li.toJSON()) : [],
|
||||
seriesHideFromContinueListening: [...this.seriesHideFromContinueListening],
|
||||
bookmarks: this.bookmarks ? this.bookmarks.map(b => b.toJSON()) : [],
|
||||
|
@ -119,6 +119,11 @@ class User {
|
|||
librariesAccessible: [...this.librariesAccessible],
|
||||
itemTagsAccessible: [...this.itemTagsAccessible]
|
||||
}
|
||||
if (minimal) {
|
||||
delete json.mediaProgress
|
||||
delete json.bookmarks
|
||||
}
|
||||
return json
|
||||
}
|
||||
|
||||
// Data broadcasted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue