mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-05-22 01:18:13 +02:00
Update watcher function calls, add js docs
This commit is contained in:
parent
3bccd52196
commit
f9c4dd2457
@ -533,8 +533,10 @@ class MiscController {
|
|||||||
* Req.body { libraryId, path, type, [oldPath] }
|
* Req.body { libraryId, path, type, [oldPath] }
|
||||||
* type = add, unlink, rename
|
* type = add, unlink, rename
|
||||||
* oldPath = required only for rename
|
* oldPath = required only for rename
|
||||||
* @param {*} req
|
* @this import('../routers/ApiRouter')
|
||||||
* @param {*} res
|
*
|
||||||
|
* @param {import('express').Request} req
|
||||||
|
* @param {import('express').Response} res
|
||||||
*/
|
*/
|
||||||
updateWatchedPath(req, res) {
|
updateWatchedPath(req, res) {
|
||||||
if (!req.user.isAdminOrUp) {
|
if (!req.user.isAdminOrUp) {
|
||||||
@ -552,7 +554,7 @@ class MiscController {
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'add':
|
case 'add':
|
||||||
this.watcher.onNewFile(libraryId, path)
|
this.watcher.onFileAdded(libraryId, path)
|
||||||
break;
|
break;
|
||||||
case 'unlink':
|
case 'unlink':
|
||||||
this.watcher.onFileRemoved(libraryId, path)
|
this.watcher.onFileRemoved(libraryId, path)
|
||||||
@ -563,7 +565,7 @@ class MiscController {
|
|||||||
Logger.error(`[MiscController] Invalid request body for updateWatchedPath. oldPath is required for rename.`)
|
Logger.error(`[MiscController] Invalid request body for updateWatchedPath. oldPath is required for rename.`)
|
||||||
return res.sendStatus(400)
|
return res.sendStatus(400)
|
||||||
}
|
}
|
||||||
this.watcher.onRename(libraryId, oldPath, path)
|
this.watcher.onFileRename(libraryId, oldPath, path)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Logger.error(`[MiscController] Invalid type for updateWatchedPath. type: "${type}"`)
|
Logger.error(`[MiscController] Invalid type for updateWatchedPath. type: "${type}"`)
|
||||||
@ -571,10 +573,8 @@ class MiscController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.sendStatus(200)
|
res.sendStatus(200)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
validateCronExpression(req, res) {
|
validateCronExpression(req, res) {
|
||||||
const expression = req.body.expression
|
const expression = req.body.expression
|
||||||
if (!expression) {
|
if (!expression) {
|
||||||
|
@ -39,6 +39,7 @@ class ApiRouter {
|
|||||||
this.playbackSessionManager = Server.playbackSessionManager
|
this.playbackSessionManager = Server.playbackSessionManager
|
||||||
this.abMergeManager = Server.abMergeManager
|
this.abMergeManager = Server.abMergeManager
|
||||||
this.backupManager = Server.backupManager
|
this.backupManager = Server.backupManager
|
||||||
|
/** @type {import('../Watcher')} */
|
||||||
this.watcher = Server.watcher
|
this.watcher = Server.watcher
|
||||||
this.podcastManager = Server.podcastManager
|
this.podcastManager = Server.podcastManager
|
||||||
this.audioMetadataManager = Server.audioMetadataManager
|
this.audioMetadataManager = Server.audioMetadataManager
|
||||||
|
Loading…
Reference in New Issue
Block a user