https://github.com/C9Glax/tranga-website/issues/19 Send a badrequest response if not a valid libraryconnector
This commit is contained in:
parent
7c7f711bb4
commit
8caac538c9
@ -401,8 +401,7 @@ public class Server : GlobalBase
|
|||||||
break;
|
break;
|
||||||
case "LibraryConnectors/Update":
|
case "LibraryConnectors/Update":
|
||||||
if (!requestVariables.TryGetValue("libraryConnector", out string? libraryConnectorStr) ||
|
if (!requestVariables.TryGetValue("libraryConnector", out string? libraryConnectorStr) ||
|
||||||
!Enum.TryParse(libraryConnectorStr,
|
!Enum.TryParse(libraryConnectorStr, out LibraryConnector.LibraryType libraryConnectorType))
|
||||||
out LibraryConnector.LibraryType libraryConnectorType))
|
|
||||||
{
|
{
|
||||||
SendResponse(HttpStatusCode.BadRequest, response);
|
SendResponse(HttpStatusCode.BadRequest, response);
|
||||||
break;
|
break;
|
||||||
@ -419,10 +418,7 @@ public class Server : GlobalBase
|
|||||||
}
|
}
|
||||||
AddLibraryConnector(new Kavita(this, kavitaUrl, kavitaUsername, kavitaPassword));
|
AddLibraryConnector(new Kavita(this, kavitaUrl, kavitaUsername, kavitaPassword));
|
||||||
SendResponse(HttpStatusCode.Accepted, response);
|
SendResponse(HttpStatusCode.Accepted, response);
|
||||||
break;
|
}else if (libraryConnectorType is LibraryConnector.LibraryType.Komga)
|
||||||
}
|
|
||||||
|
|
||||||
if (libraryConnectorType is LibraryConnector.LibraryType.Komga)
|
|
||||||
{
|
{
|
||||||
if (!requestVariables.TryGetValue("komgaUrl", out string? komgaUrl) ||
|
if (!requestVariables.TryGetValue("komgaUrl", out string? komgaUrl) ||
|
||||||
!requestVariables.TryGetValue("komgaAuth", out string? komgaAuth))
|
!requestVariables.TryGetValue("komgaAuth", out string? komgaAuth))
|
||||||
@ -432,7 +428,10 @@ public class Server : GlobalBase
|
|||||||
}
|
}
|
||||||
AddLibraryConnector(new Komga(this, komgaUrl, komgaAuth));
|
AddLibraryConnector(new Komga(this, komgaUrl, komgaAuth));
|
||||||
SendResponse(HttpStatusCode.Accepted, response);
|
SendResponse(HttpStatusCode.Accepted, response);
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendResponse(HttpStatusCode.BadRequest, response);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "LogMessages":
|
case "LogMessages":
|
||||||
|
Loading…
Reference in New Issue
Block a user