Update:API endpoint for get all users to use minimal payload

This commit is contained in:
advplyr 2023-03-29 14:56:50 -05:00
parent d2e0844493
commit 575a162f8b
3 changed files with 11 additions and 9 deletions

View file

@ -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