mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
Log files are viewable in the UI
This commit is contained in:
parent
a9ac2500d5
commit
4c536a077f
21 changed files with 325 additions and 40 deletions
29
NzbDrone.Api/Frontend/LogFileMapper.cs
Normal file
29
NzbDrone.Api/Frontend/LogFileMapper.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue