mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
moved static resource to basic nancy module.
cache and gzip piplelines are missing
This commit is contained in:
parent
93b0cf4be9
commit
24ba4390a1
12 changed files with 185 additions and 145 deletions
29
NzbDrone.Api/Frontend/Mappers/LogFileMapper.cs
Normal file
29
NzbDrone.Api/Frontend/Mappers/LogFileMapper.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System.IO;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
||||
namespace NzbDrone.Api.Frontend.Mappers
|
||||
{
|
||||
public class LogFileMapper : IMapHttpRequestsToDisk
|
||||
{
|
||||
private readonly IAppFolderInfo _appFolderInfo;
|
||||
|
||||
public LogFileMapper(IAppFolderInfo appFolderInfo)
|
||||
{
|
||||
_appFolderInfo = appFolderInfo;
|
||||
}
|
||||
|
||||
public string Map(string resourceUrl)
|
||||
{
|
||||
var path = resourceUrl.Replace('/', Path.DirectorySeparatorChar);
|
||||
path = Path.GetFileName(path);
|
||||
|
||||
return Path.Combine(_appFolderInfo.GetLogFolder(), path);
|
||||
}
|
||||
|
||||
public bool CanHandle(string resourceUrl)
|
||||
{
|
||||
return resourceUrl.StartsWith("/log") && resourceUrl.EndsWith(".txt");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue