mirror of
https://github.com/C9Glax/tranga.git
synced 2025-02-23 15:50:13 +01:00
Fix JobId variable in API requests
This commit is contained in:
parent
a05e1914e3
commit
dd4d5a81ee
@ -211,9 +211,10 @@ public class Server : GlobalBase
|
|||||||
private void HandlePost(HttpListenerRequest request, HttpListenerResponse response)
|
private void HandlePost(HttpListenerRequest request, HttpListenerResponse response)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> requestVariables = GetRequestVariables(request.Url!.Query);
|
Dictionary<string, string> requestVariables = GetRequestVariables(request.Url!.Query);
|
||||||
string? connectorName, internalId;
|
string? connectorName, internalId, jobId;
|
||||||
MangaConnector connector;
|
MangaConnector connector;
|
||||||
Manga manga;
|
Manga manga;
|
||||||
|
Job? job;
|
||||||
string path = Regex.Match(request.Url!.LocalPath, @"[A-z0-9]+(\/[A-z0-9]+)*").Value;
|
string path = Regex.Match(request.Url!.LocalPath, @"[A-z0-9]+(\/[A-z0-9]+)*").Value;
|
||||||
switch (path)
|
switch (path)
|
||||||
{
|
{
|
||||||
@ -248,8 +249,8 @@ public class Server : GlobalBase
|
|||||||
SendResponse(HttpStatusCode.Accepted, response);
|
SendResponse(HttpStatusCode.Accepted, response);
|
||||||
break;
|
break;
|
||||||
case "Jobs/StartNow":
|
case "Jobs/StartNow":
|
||||||
if (!requestVariables.TryGetValue("jobId", out string? jobId) ||
|
if (!requestVariables.TryGetValue("jobId", out jobId) ||
|
||||||
!_parent.jobBoss.TryGetJobById(jobId, out Job? job))
|
!_parent.jobBoss.TryGetJobById(jobId, out job))
|
||||||
{
|
{
|
||||||
SendResponse(HttpStatusCode.BadRequest, response);
|
SendResponse(HttpStatusCode.BadRequest, response);
|
||||||
break;
|
break;
|
||||||
@ -362,7 +363,7 @@ public class Server : GlobalBase
|
|||||||
switch (path)
|
switch (path)
|
||||||
{
|
{
|
||||||
case "Jobs":
|
case "Jobs":
|
||||||
if (!requestVariables.TryGetValue("jobID", out string? jobId) ||
|
if (!requestVariables.TryGetValue("jobId", out string? jobId) ||
|
||||||
!_parent.jobBoss.TryGetJobById(jobId, out Job? job))
|
!_parent.jobBoss.TryGetJobById(jobId, out Job? job))
|
||||||
{
|
{
|
||||||
SendResponse(HttpStatusCode.BadRequest, response);
|
SendResponse(HttpStatusCode.BadRequest, response);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user