Finish the download manager page

This commit is contained in:
Alex Ling
2020-03-02 01:50:04 +00:00
parent 1ce553f541
commit f13f7989d5
4 changed files with 158 additions and 12 deletions

View File

@@ -131,5 +131,56 @@ class APIRouter < Router
jobs = @context.queue.get_all
send_json env, jobs.to_json
end
post "/api/admin/mangadex/queue/delete/:id" do |env|
begin
id = env.params.url["id"]
@context.queue.delete id
send_json env, {"success" => true}.to_json
rescue e
send_json env, {
"success" => false,
"error" => e.message
}.to_json
end
end
# Delete all completed tasks from the queue
post "/api/admin/mangadex/queue/delete" do |env|
begin
@context.queue.delete_status MangaDex::JobStatus::Completed
send_json env, {"success" => true}.to_json
rescue e
send_json env, {
"success" => false,
"error" => e.message
}.to_json
end
end
post "/api/admin/mangadex/queue/retry/:id" do |env|
begin
id = env.params.url["id"]
@context.queue.reset id
send_json env, {"success" => true}.to_json
rescue e
send_json env, {
"success" => false,
"error" => e.message
}.to_json
end
end
post "/api/admin/mangadex/queue/retry" do |env|
begin
@context.queue.reset
send_json env, {"success" => true}.to_json
rescue e
send_json env, {
"success" => false,
"error" => e.message
}.to_json
end
end
end
end