From d598017a034af8da6c294824947e5e83863199ed Mon Sep 17 00:00:00 2001 From: Azerelat Date: Sun, 27 Dec 2015 21:25:54 +0000 Subject: [PATCH] Fix blackhole downloads #135 --- src/Jackett/Startup.cs | 286 ++++++++++++++++++++--------------------- 1 file changed, 143 insertions(+), 143 deletions(-) diff --git a/src/Jackett/Startup.cs b/src/Jackett/Startup.cs index 7426088f0..2f6dd6d2b 100644 --- a/src/Jackett/Startup.cs +++ b/src/Jackett/Startup.cs @@ -1,143 +1,143 @@ -using Owin; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using System.Web.Http; -using Autofac.Integration.WebApi; -using Microsoft.Owin; -using Jackett; -using Microsoft.Owin.StaticFiles; -using Microsoft.Owin.FileSystems; -using Autofac; -using Jackett.Services; -using System.Web.Http.Tracing; -using Jackett.Utils; -using Microsoft.AspNet.Identity; - -[assembly: OwinStartup(typeof(Startup))] -namespace Jackett -{ - public class Startup - { - public static bool TracingEnabled - { - get; - set; - } - - public static bool LogRequests - { - get; - set; - } - - public static string ClientOverride - { - get; - set; - } - - public static bool? DoSSLFix - { - get; - set; - } - - public static bool? IgnoreSslErrors - { - get; - set; - } - - public void Configuration(IAppBuilder appBuilder) - { - // Configure Web API for self-host. - var config = new HttpConfiguration(); - - appBuilder.Use(); - - // Setup tracing if enabled - if (TracingEnabled) - { - config.EnableSystemDiagnosticsTracing(); - config.Services.Replace(typeof(ITraceWriter), new WebAPIToNLogTracer()); - } - // Add request logging if enabled - if (LogRequests) - { - config.MessageHandlers.Add(new WebAPIRequestLogger()); - } - config.DependencyResolver = new AutofacWebApiDependencyResolver(Engine.GetContainer()); - config.MapHttpAttributeRoutes(); - - config.Routes.MapHttpRoute( - name: "Admin", - routeTemplate: "admin/{action}", - defaults: new { controller = "Admin" } - ); - - config.Routes.MapHttpRoute( - name: "apiDefault", - routeTemplate: "api/{indexerID}", - defaults: new { controller = "Torznab", action = "Call" } - ); - - config.Routes.MapHttpRoute( - name: "api", - routeTemplate: "api/{indexerID}/api", - defaults: new { controller = "Torznab", action = "Call" } - ); - - config.Routes.MapHttpRoute( - name: "torznabDefault", - routeTemplate: "torznab/{indexerID}", - defaults: new { controller = "Torznab", action = "Call" } - ); - - config.Routes.MapHttpRoute( - name: "torznab", - routeTemplate: "torznab/{indexerID}/api", - defaults: new { controller = "Torznab", action = "Call" } - ); - - config.Routes.MapHttpRoute( - name: "potatoDefault", - routeTemplate: "potato/{indexerID}", - defaults: new { controller = "Potato", action = "Call" } - ); - - config.Routes.MapHttpRoute( - name: "potato", - routeTemplate: "potato/{indexerID}/api", - defaults: new { controller = "Potato", action = "Call" } - ); - - config.Routes.MapHttpRoute( - name: "download", - routeTemplate: "dl/{indexerID}/{apiKey}", - defaults: new { controller = "Download", action = "Download" } - ); - - config.Routes.MapHttpRoute( - name: "blackhole", - routeTemplate: "bh/{indexerID}/{apikey}/{path}", - defaults: new { controller = "Blackhole", action = "Blackhole" } - ); - - appBuilder.UseWebApi(config); - - - appBuilder.UseFileServer(new FileServerOptions - { - RequestPath = new PathString(string.Empty), - FileSystem = new PhysicalFileSystem(Engine.ConfigService.GetContentFolder()), - EnableDirectoryBrowsing = false, - - }); - - } - } -} +using Owin; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; +using Autofac.Integration.WebApi; +using Microsoft.Owin; +using Jackett; +using Microsoft.Owin.StaticFiles; +using Microsoft.Owin.FileSystems; +using Autofac; +using Jackett.Services; +using System.Web.Http.Tracing; +using Jackett.Utils; +using Microsoft.AspNet.Identity; + +[assembly: OwinStartup(typeof(Startup))] +namespace Jackett +{ + public class Startup + { + public static bool TracingEnabled + { + get; + set; + } + + public static bool LogRequests + { + get; + set; + } + + public static string ClientOverride + { + get; + set; + } + + public static bool? DoSSLFix + { + get; + set; + } + + public static bool? IgnoreSslErrors + { + get; + set; + } + + public void Configuration(IAppBuilder appBuilder) + { + // Configure Web API for self-host. + var config = new HttpConfiguration(); + + appBuilder.Use(); + + // Setup tracing if enabled + if (TracingEnabled) + { + config.EnableSystemDiagnosticsTracing(); + config.Services.Replace(typeof(ITraceWriter), new WebAPIToNLogTracer()); + } + // Add request logging if enabled + if (LogRequests) + { + config.MessageHandlers.Add(new WebAPIRequestLogger()); + } + config.DependencyResolver = new AutofacWebApiDependencyResolver(Engine.GetContainer()); + config.MapHttpAttributeRoutes(); + + config.Routes.MapHttpRoute( + name: "Admin", + routeTemplate: "admin/{action}", + defaults: new { controller = "Admin" } + ); + + config.Routes.MapHttpRoute( + name: "apiDefault", + routeTemplate: "api/{indexerID}", + defaults: new { controller = "Torznab", action = "Call" } + ); + + config.Routes.MapHttpRoute( + name: "api", + routeTemplate: "api/{indexerID}/api", + defaults: new { controller = "Torznab", action = "Call" } + ); + + config.Routes.MapHttpRoute( + name: "torznabDefault", + routeTemplate: "torznab/{indexerID}", + defaults: new { controller = "Torznab", action = "Call" } + ); + + config.Routes.MapHttpRoute( + name: "torznab", + routeTemplate: "torznab/{indexerID}/api", + defaults: new { controller = "Torznab", action = "Call" } + ); + + config.Routes.MapHttpRoute( + name: "potatoDefault", + routeTemplate: "potato/{indexerID}", + defaults: new { controller = "Potato", action = "Call" } + ); + + config.Routes.MapHttpRoute( + name: "potato", + routeTemplate: "potato/{indexerID}/api", + defaults: new { controller = "Potato", action = "Call" } + ); + + config.Routes.MapHttpRoute( + name: "download", + routeTemplate: "dl/{indexerID}/{apiKey}", + defaults: new { controller = "Download", action = "Download" } + ); + + config.Routes.MapHttpRoute( + name: "blackhole", + routeTemplate: "bh/{indexerID}/{apikey}", + defaults: new { controller = "Blackhole", action = "Blackhole" } + ); + + appBuilder.UseWebApi(config); + + + appBuilder.UseFileServer(new FileServerOptions + { + RequestPath = new PathString(string.Empty), + FileSystem = new PhysicalFileSystem(Engine.ConfigService.GetContentFolder()), + EnableDirectoryBrowsing = false, + + }); + + } + } +}