Implemented queue management calls in RESTful api
This commit is contained in:
parent
7417e3c325
commit
b44a3e9a31
@ -0,0 +1,13 @@
|
|||||||
|
import { ApiHandler } from '../../../types'
|
||||||
|
import { cancelAllDownloads } from '../../../main'
|
||||||
|
|
||||||
|
const path = '/cancelAllDownloads'
|
||||||
|
|
||||||
|
const handler: ApiHandler['handler'] = async (req, res) => {
|
||||||
|
cancelAllDownloads()
|
||||||
|
res.send({ result: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
const apiHandler = { path, handler }
|
||||||
|
|
||||||
|
export default apiHandler
|
@ -1,5 +1,15 @@
|
|||||||
import loginArl from './login-arl'
|
import loginArl from './login-arl'
|
||||||
import addToQueue from './addToQueue'
|
import addToQueue from './addToQueue'
|
||||||
import loginWithCredentials from './loginWithCredentials'
|
import loginWithCredentials from './loginWithCredentials'
|
||||||
|
import cancelAllDownloads from './cancelAllDownloads'
|
||||||
|
import removeFinishedDownloads from './removeFinishedDownloads'
|
||||||
|
import removeFromQueue from './removeFromQueue'
|
||||||
|
|
||||||
export default [loginArl, addToQueue, loginWithCredentials]
|
export default [
|
||||||
|
loginArl,
|
||||||
|
addToQueue,
|
||||||
|
loginWithCredentials,
|
||||||
|
cancelAllDownloads,
|
||||||
|
removeFinishedDownloads,
|
||||||
|
removeFromQueue
|
||||||
|
]
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
import { ApiHandler } from '../../../types'
|
||||||
|
import { clearCompletedDownloads } from '../../../main'
|
||||||
|
|
||||||
|
const path = '/removeFinishedDownloads'
|
||||||
|
|
||||||
|
const handler: ApiHandler['handler'] = async (req, res) => {
|
||||||
|
clearCompletedDownloads()
|
||||||
|
res.send({ result: true })
|
||||||
|
}
|
||||||
|
|
||||||
|
const apiHandler = { path, handler }
|
||||||
|
|
||||||
|
export default apiHandler
|
@ -0,0 +1,18 @@
|
|||||||
|
import { ApiHandler } from '../../../types'
|
||||||
|
import { cancelDownload } from '../../../main'
|
||||||
|
|
||||||
|
const path = '/removeFromQueue'
|
||||||
|
|
||||||
|
const handler: ApiHandler['handler'] = async (req, res) => {
|
||||||
|
const {uuid} = req.query
|
||||||
|
if (uuid){
|
||||||
|
cancelDownload(uuid)
|
||||||
|
res.send({ result: true })
|
||||||
|
}else{
|
||||||
|
res.send({ result: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const apiHandler = { path, handler }
|
||||||
|
|
||||||
|
export default apiHandler
|
Loading…
Reference in New Issue
Block a user