This commit is contained in:
@@ -111,7 +111,7 @@ public class RssController : Controller
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await _deluge.LoginAsync("deluge1"))
|
||||
if (await _deluge.LoginAsync("deluge1", "http://192.168.10.7:8112"))
|
||||
{
|
||||
var success = await _deluge.AddTorrentUrlAsync(torrentUrl);
|
||||
|
||||
@@ -159,7 +159,7 @@ public class RssController : Controller
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Fel vid tillägg av torrent");
|
||||
return Json(new { success = false, message = "Ett fel uppstod vid tillägg av torrent." });
|
||||
return Json(new { success = false, message = "Ett fel uppstod vid tillägg av torrent. Meddelande: " + ex.Message });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,16 +6,15 @@ namespace Aberwyn.Data
|
||||
public class DelugeClient
|
||||
{
|
||||
private readonly HttpClient _http;
|
||||
private readonly string _url;
|
||||
private string _sessionId;
|
||||
//should fix settings passwor
|
||||
public DelugeClient(HttpClient httpClient, string baseUrl = "http://192.168.10.7:8112/json")
|
||||
private string _url;
|
||||
//should fix settings password
|
||||
public DelugeClient(HttpClient httpClient)
|
||||
{
|
||||
_http = httpClient;
|
||||
_url = baseUrl;
|
||||
}
|
||||
|
||||
public async Task<bool> LoginAsync(string password)
|
||||
public async Task<bool> LoginAsync(string password, string url)
|
||||
{
|
||||
var payload = new
|
||||
{
|
||||
@@ -23,7 +22,7 @@ namespace Aberwyn.Data
|
||||
@params = new object[] { password },
|
||||
id = 1
|
||||
};
|
||||
|
||||
_url = url + "/json";
|
||||
var response = await _http.PostAsJsonAsync(_url, payload);
|
||||
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
|
||||
|
||||
@@ -38,6 +37,7 @@ namespace Aberwyn.Data
|
||||
return json.GetProperty("result").GetBoolean();
|
||||
}
|
||||
|
||||
/*
|
||||
public async Task<bool> AddMagnetAsync(string magnetLink)
|
||||
{
|
||||
var payload = new
|
||||
@@ -50,7 +50,8 @@ namespace Aberwyn.Data
|
||||
var response = await _http.PostAsJsonAsync(_url, payload);
|
||||
var json = await response.Content.ReadFromJsonAsync<JsonElement>();
|
||||
return json.GetProperty("result").ValueKind != JsonValueKind.Null;
|
||||
}
|
||||
}*/
|
||||
|
||||
public async Task<bool> AddTorrentUrlAsync(string torrentUrl)
|
||||
{
|
||||
var payload = new
|
||||
|
||||
Reference in New Issue
Block a user