mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Log file requests will be authenticated when they come through with an API key
Fixed: Opening log files in the UI
This commit is contained in:
parent
b29efa5823
commit
231c6cf147
@ -7,7 +7,7 @@ public static class RequestExtensions
|
|||||||
{
|
{
|
||||||
public static bool IsApiRequest(this Request request)
|
public static bool IsApiRequest(this Request request)
|
||||||
{
|
{
|
||||||
return request.Path.StartsWith("/api/", StringComparison.InvariantCultureIgnoreCase);
|
return request.Path.StartsWith("/api/", StringComparison.InvariantCultureIgnoreCase) || request.IsLogFileRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsSignalRRequest(this Request request)
|
public static bool IsSignalRRequest(this Request request)
|
||||||
@ -21,5 +21,11 @@ public static bool IsLocalRequest(this Request request)
|
|||||||
request.UserHostAddress.Equals("127.0.0.1") ||
|
request.UserHostAddress.Equals("127.0.0.1") ||
|
||||||
request.UserHostAddress.Equals("::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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ protected override string Map(string resourceUrl)
|
|||||||
|
|
||||||
public override bool CanHandle(string resourceUrl)
|
public override bool CanHandle(string resourceUrl)
|
||||||
{
|
{
|
||||||
return resourceUrl.StartsWith("/log") && resourceUrl.EndsWith(".txt");
|
return resourceUrl.StartsWith("/log/") && resourceUrl.EndsWith(".txt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user