Book cover uploader, moving streams to /metadata/streams, adding jwt auth from query string, auth check static metadata

This commit is contained in:
advplyr 2021-09-21 20:57:33 -05:00
parent ae1b94e991
commit b23f9362ef
18 changed files with 377 additions and 36 deletions

View file

@ -18,6 +18,7 @@ class Book {
this.description = null
this.cover = null
this.genres = []
this.lastUpdate = null
if (book) {
this.construct(book)
@ -45,6 +46,7 @@ class Book {
this.description = book.description
this.cover = book.cover
this.genres = book.genres
this.lastUpdate = book.lastUpdate || Date.now()
}
toJSON() {
@ -62,7 +64,8 @@ class Book {
publisher: this.publisher,
description: this.description,
cover: this.cover,
genres: this.genres
genres: this.genres,
lastUpdate: this.lastUpdate
}
}
@ -97,6 +100,7 @@ class Book {
this.description = data.description || null
this.cover = data.cover || null
this.genres = data.genres || []
this.lastUpdate = Date.now()
if (data.author) {
this.setParseAuthor(this.author)
@ -145,9 +149,24 @@ class Book {
hasUpdates = true
}
}
if (hasUpdates) {
this.lastUpdate = Date.now()
}
return hasUpdates
}
updateCover(cover) {
if (!cover) return false
if (!cover.startsWith('http:') && !cover.startsWith('https:')) {
cover = Path.normalize(cover)
}
this.cover = cover
this.lastUpdate = Date.now()
return true
}
// If audiobook directory path was changed, check and update properties set from dirnames
// May be worthwhile checking if these were manually updated and not override manual updates
syncPathsUpdated(audiobookData) {