mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-28 01:29:27 +01:00
Server socket event fixes
This commit is contained in:
parent
a9ee9031c3
commit
2cba83f1dd
@ -41,7 +41,7 @@ class SeriesController {
|
||||
const hasUpdated = req.series.update(req.body)
|
||||
if (hasUpdated) {
|
||||
await this.db.updateEntity('series', req.series)
|
||||
SocketAuthority.emitter('series_updated', req.series)
|
||||
SocketAuthority.emitter('series_updated', req.series.toJSON())
|
||||
}
|
||||
res.json(req.series)
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class UserController {
|
||||
var newUser = new User(account)
|
||||
var success = await this.db.insertEntity('user', newUser)
|
||||
if (success) {
|
||||
SocketAuthority.adminEmitter('user_added', newUser)
|
||||
SocketAuthority.adminEmitter('user_added', newUser.toJSONForBrowser())
|
||||
res.json({
|
||||
user: newUser.toJSONForBrowser()
|
||||
})
|
||||
|
@ -58,7 +58,7 @@ class NotificationManager {
|
||||
}
|
||||
|
||||
await this.db.updateEntity('settings', this.db.notificationSettings)
|
||||
SocketAuthority.emitter('notifications_updated', this.db.notificationSettings)
|
||||
SocketAuthority.emitter('notifications_updated', this.db.notificationSettings.toJSON())
|
||||
|
||||
this.notificationFinished()
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ class RssFeedManager {
|
||||
|
||||
Logger.debug(`[RssFeedManager] Opened RSS feed ${feed.feedUrl}`)
|
||||
await this.db.insertEntity('feed', feed)
|
||||
SocketAuthority.emitter('rss_feed_open', { id: feed.id, entityType: feed.entityType, entityId: feed.entityId, feedUrl: feed.feedUrl })
|
||||
SocketAuthority.emitter('rss_feed_open', feed.toJSONMinified())
|
||||
return feed
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ class RssFeedManager {
|
||||
if (!this.feeds[id]) return
|
||||
var feed = this.feeds[id]
|
||||
await this.db.removeEntity('feed', id)
|
||||
SocketAuthority.emitter('rss_feed_closed', { id: feed.id, entityType: feed.entityType, entityId: feed.entityId, feedUrl: feed.feedUrl })
|
||||
SocketAuthority.emitter('rss_feed_closed', feed.toJSONMinified())
|
||||
delete this.feeds[id]
|
||||
Logger.info(`[RssFeedManager] Closed RSS feed "${feed.feedUrl}"`)
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ class ApiRouter {
|
||||
}
|
||||
if (newAuthors.length) {
|
||||
await this.db.insertEntities('author', newAuthors)
|
||||
SocketAuthority.emitter('authors_added', newAuthors)
|
||||
SocketAuthority.emitter('authors_added', newAuthors.map(au => au.toJSON()))
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ class ApiRouter {
|
||||
}
|
||||
if (newSeries.length) {
|
||||
await this.db.insertEntities('series', newSeries)
|
||||
SocketAuthority.emitter('authors_added', newSeries)
|
||||
SocketAuthority.emitter('multiple_series_added', newSeries.map(se => se.toJSON()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ class Scanner {
|
||||
})
|
||||
if (newSeries.length) {
|
||||
await this.db.insertEntities('series', newSeries)
|
||||
SocketAuthority.emitter('series_added', newSeries.map(se => se.toJSON()))
|
||||
SocketAuthority.emitter('multiple_series_added', newSeries.map(se => se.toJSON()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -844,7 +844,7 @@ class Scanner {
|
||||
author = new Author()
|
||||
author.setData({ name: authorName })
|
||||
await this.db.insertEntity('author', author)
|
||||
SocketAuthority.emitter('author_added', author)
|
||||
SocketAuthority.emitter('author_added', author.toJSON())
|
||||
}
|
||||
authorPayload.push(author.toJSONMinimal())
|
||||
}
|
||||
@ -862,7 +862,7 @@ class Scanner {
|
||||
seriesItem = new Series()
|
||||
seriesItem.setData({ name: seriesMatchItem.series })
|
||||
await this.db.insertEntity('series', seriesItem)
|
||||
SocketAuthority.emitter('series_added', seriesItem)
|
||||
SocketAuthority.emitter('series_added', seriesItem.toJSON())
|
||||
}
|
||||
seriesPayload.push(seriesItem.toJSONMinimal(seriesMatchItem.sequence))
|
||||
}
|
||||
@ -984,7 +984,7 @@ class Scanner {
|
||||
Logger.info(`[Scanner] matchLibraryItems: Library match scan canceled for "${libraryScan.libraryName}"`)
|
||||
delete this.cancelLibraryScan[libraryScan.libraryId]
|
||||
var scanData = libraryScan.getScanEmitData
|
||||
scanData.results = false
|
||||
scanData.results = null
|
||||
SocketAuthority.emitter('scan_complete', scanData)
|
||||
this.librariesScanning = this.librariesScanning.filter(ls => ls.id !== library.id)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user