mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-29 05:16:34 +02:00
moved static resource to basic nancy module.
cache and gzip piplelines are missing
This commit is contained in:
28
NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs
Normal file
28
NzbDrone.Api/Frontend/Mappers/StaticResourceMapper.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.IO;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
||||
namespace NzbDrone.Api.Frontend.Mappers
|
||||
{
|
||||
public class StaticResourceMapper : IMapHttpRequestsToDisk
|
||||
{
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
|
||||
public StaticResourceMapper(IAppFolderInfo appFolderInfo)
|
||||
{
|
||||
_appFolderInfo = appFolderInfo;
|
||||
}
|
||||
|
||||
public string Map(string resourceUrl)
|
||||
{
|
||||
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
||||
path = path.Trim(Path.DirectorySeparatorChar);
|
||||
|
||||
return Path.Combine(_appFolderInfo.StartUpFolder, "UI", path);
|
||||
}
|
||||
|
||||
public bool CanHandle(string resourceUrl)
|
||||
{
|
||||
return resourceUrl.StartsWith("/Content") || resourceUrl.EndsWith(".js") || resourceUrl.EndsWith(".css");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user