mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
moved logic for reading static file to mappers
This commit is contained in:
parent
290e072f2e
commit
9f0ae763ff
20 changed files with 144 additions and 209 deletions
|
@ -1,18 +1,21 @@
|
|||
using System.IO;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
||||
namespace NzbDrone.Api.Frontend.Mappers
|
||||
{
|
||||
public class StaticResourceMapper : IMapHttpRequestsToDisk
|
||||
public class StaticResourceMapper : StaticResourceMapperBase
|
||||
{
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
|
||||
public StaticResourceMapper(IAppFolderInfo appFolderInfo)
|
||||
public StaticResourceMapper(IAppFolderInfo appFolderInfo, IDiskProvider diskProvider, Logger logger)
|
||||
: base(diskProvider, logger)
|
||||
{
|
||||
_appFolderInfo = appFolderInfo;
|
||||
}
|
||||
|
||||
public string Map(string resourceUrl)
|
||||
protected override string Map(string resourceUrl)
|
||||
{
|
||||
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
||||
path = path.Trim(Path.DirectorySeparatorChar);
|
||||
|
@ -20,7 +23,7 @@ namespace NzbDrone.Api.Frontend.Mappers
|
|||
return Path.Combine(_appFolderInfo.StartUpFolder, "UI", path);
|
||||
}
|
||||
|
||||
public bool CanHandle(string resourceUrl)
|
||||
public override bool CanHandle(string resourceUrl)
|
||||
{
|
||||
return resourceUrl.StartsWith("/Content") || resourceUrl.EndsWith(".js") || resourceUrl.EndsWith(".css");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue