This commit is contained in:
KZ
2015-07-19 01:27:41 +01:00
parent 974565d907
commit 33a97b148f
79 changed files with 2205 additions and 605 deletions

View File

@@ -9,6 +9,9 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Net.Http.Headers;
using Jackett.Utils;
using Jackett.Models;
using NLog;
namespace Jackett.Indexers
{
@@ -50,11 +53,13 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
string cookieHeader;
public AlphaRatio()
public AlphaRatio(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -98,7 +103,7 @@ namespace Jackett.Indexers
configSaveData = new JObject();
if (Program.IsWindows)
if (WebServer.IsWindows)
{
// If Windows use .net http
var response = await client.SendAsync(message);
@@ -142,7 +147,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(SiteLink, jsonConfig);
cookies.FillFromJson(SiteLink, jsonConfig, logger);
cookieHeader = cookies.GetCookieHeader(SiteLink);
IsConfigured = true;
}
@@ -169,7 +174,7 @@ namespace Jackett.Indexers
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
string results;
if (Program.IsWindows)
if (WebServer.IsWindows)
{
var request = CreateHttpRequest(new Uri(episodeSearchUrl));
request.Method = HttpMethod.Get;
@@ -237,7 +242,7 @@ namespace Jackett.Indexers
public async Task<byte[]> Download(Uri link)
{
if (Program.IsWindows)
if (WebServer.IsWindows)
{
return await client.GetByteArrayAsync(link);
}