Log files are viewable in the UI

This commit is contained in:
Mark McDowall 2013-07-28 16:13:14 -07:00
commit 4c536a077f
21 changed files with 325 additions and 40 deletions

View file

@ -0,0 +1,29 @@
using System.IO;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Api.Frontend
{
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");
}
}
}