mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Implement server backhole downloading
This commit is contained in:
@@ -286,6 +286,7 @@ namespace Jackett.Controllers
|
||||
cfg["port"] = serverService.Config.Port;
|
||||
cfg["external"] = serverService.Config.AllowExternal;
|
||||
cfg["api_key"] = serverService.Config.APIKey;
|
||||
cfg["blackholedir"] = serverService.Config.BlackholeDir;
|
||||
cfg["password"] = string.IsNullOrEmpty(serverService.Config.AdminPassword )? string.Empty:serverService.Config.AdminPassword.Substring(0,10);
|
||||
|
||||
jsonReply["config"] = cfg;
|
||||
@@ -300,7 +301,7 @@ namespace Jackett.Controllers
|
||||
return Json(jsonReply);
|
||||
}
|
||||
|
||||
[Route("set_port")]
|
||||
[Route("set_config")]
|
||||
[HttpPost]
|
||||
public async Task<IHttpActionResult> SetConfig()
|
||||
{
|
||||
@@ -312,6 +313,7 @@ namespace Jackett.Controllers
|
||||
var postData = await ReadPostDataJson();
|
||||
int port = (int)postData["port"];
|
||||
bool external = (bool)postData["external"];
|
||||
string saveDir = (string)postData["blackholedir"];
|
||||
|
||||
if (port != Engine.Server.Config.Port || external != Engine.Server.Config.AllowExternal)
|
||||
{
|
||||
@@ -361,6 +363,21 @@ namespace Jackett.Controllers
|
||||
})).Start();
|
||||
}
|
||||
|
||||
|
||||
if(saveDir != Engine.Server.Config.BlackholeDir)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(saveDir))
|
||||
{
|
||||
if (!Directory.Exists(saveDir))
|
||||
{
|
||||
throw new Exception("Blackhole directory does not exist");
|
||||
}
|
||||
}
|
||||
|
||||
Engine.Server.Config.BlackholeDir = saveDir;
|
||||
Engine.Server.SaveConfig();
|
||||
}
|
||||
|
||||
jsonReply["result"] = "success";
|
||||
jsonReply["port"] = port;
|
||||
jsonReply["external"] = external;
|
||||
|
Reference in New Issue
Block a user