mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-27 22:57:09 -04:00
231c6cf147
Fixed: Opening log files in the UI
32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using System;
|
|
using Nancy;
|
|
|
|
namespace NzbDrone.Api.Extensions
|
|
{
|
|
public static class RequestExtensions
|
|
{
|
|
public static bool IsApiRequest(this Request request)
|
|
{
|
|
return request.Path.StartsWith("/api/", StringComparison.InvariantCultureIgnoreCase) || request.IsLogFileRequest();
|
|
}
|
|
|
|
public static bool IsSignalRRequest(this Request request)
|
|
{
|
|
return request.Path.StartsWith("/signalr/", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
|
|
public static bool IsLocalRequest(this Request request)
|
|
{
|
|
return (request.UserHostAddress.Equals("localhost") ||
|
|
request.UserHostAddress.Equals("127.0.0.1") ||
|
|
request.UserHostAddress.Equals("::1"));
|
|
}
|
|
|
|
private static bool IsLogFileRequest(this Request request)
|
|
{
|
|
return request.Path.StartsWith("/log/", StringComparison.InvariantCultureIgnoreCase) &&
|
|
request.Path.EndsWith(".txt", StringComparison.InvariantCultureIgnoreCase);
|
|
}
|
|
}
|
|
}
|