mirror of
https://github.com/Jackett/Jackett
synced 2025-02-24 15:21:06 +00:00
Assign webroot for static files
Removes the need for PhysicalFileProvider
This commit is contained in:
parent
db39b6afd9
commit
052e382d93
3 changed files with 3 additions and 11 deletions
|
@ -33,7 +33,6 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="2.1.1" />
|
<PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="2.1.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
|
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="2.1.1" />
|
|
||||||
<PackageReference Include="NLog" Version="4.5.6" />
|
<PackageReference Include="NLog" Version="4.5.6" />
|
||||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.5.4" />
|
<PackageReference Include="NLog.Web.AspNetCore" Version="4.5.4" />
|
||||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.5.0" />
|
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.5.0" />
|
||||||
|
|
|
@ -14,7 +14,6 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Jackett.Server
|
namespace Jackett.Server
|
||||||
|
@ -50,7 +49,7 @@ namespace Jackett.Server
|
||||||
{
|
{
|
||||||
//TODO: Remove libcurl once off owin
|
//TODO: Remove libcurl once off owin
|
||||||
bool runningOnDotNetCore = RuntimeInformation.FrameworkDescription.IndexOf("Core", StringComparison.OrdinalIgnoreCase) >= 0;
|
bool runningOnDotNetCore = RuntimeInformation.FrameworkDescription.IndexOf("Core", StringComparison.OrdinalIgnoreCase) >= 0;
|
||||||
|
|
||||||
if (runningOnDotNetCore)
|
if (runningOnDotNetCore)
|
||||||
{
|
{
|
||||||
options.Client = "httpclientnetcore";
|
options.Client = "httpclientnetcore";
|
||||||
|
@ -182,6 +181,7 @@ namespace Jackett.Server
|
||||||
WebHost.CreateDefaultBuilder(args)
|
WebHost.CreateDefaultBuilder(args)
|
||||||
.UseConfiguration(Configuration)
|
.UseConfiguration(Configuration)
|
||||||
.UseContentRoot(contentRoot)
|
.UseContentRoot(contentRoot)
|
||||||
|
.UseWebRoot(contentRoot)
|
||||||
.UseUrls(urls)
|
.UseUrls(urls)
|
||||||
.PreferHostingUrls(true)
|
.PreferHostingUrls(true)
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
|
|
|
@ -18,7 +18,6 @@ using Microsoft.AspNetCore.Mvc.Authorization;
|
||||||
using Microsoft.AspNetCore.Rewrite;
|
using Microsoft.AspNetCore.Rewrite;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.FileProviders;
|
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -128,13 +127,7 @@ namespace Jackett.Server
|
||||||
|
|
||||||
app.UseRewriter(rewriteOptions);
|
app.UseRewriter(rewriteOptions);
|
||||||
|
|
||||||
app.UseFileServer(new FileServerOptions
|
app.UseStaticFiles();
|
||||||
{
|
|
||||||
FileProvider = new PhysicalFileProvider(Helper.ConfigService.GetContentFolder()),
|
|
||||||
RequestPath = "",
|
|
||||||
EnableDefaultFiles = true,
|
|
||||||
EnableDirectoryBrowsing = false
|
|
||||||
});
|
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue