mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
31 lines
729 B
C#
31 lines
729 B
C#
|
using Nancy;
|
||
|
using NzbDrone.Api.Extensions;
|
||
|
using NzbDrone.Common.EnvironmentInfo;
|
||
|
|
||
|
namespace NzbDrone.Api.Frontend
|
||
|
{
|
||
|
public interface IAddCacheHeaders
|
||
|
{
|
||
|
void ToResponse(Request request, Response response);
|
||
|
}
|
||
|
|
||
|
public class AddCacheHeaders : IAddCacheHeaders
|
||
|
{
|
||
|
public void ToResponse(Request request, Response response)
|
||
|
{
|
||
|
if (!RuntimeInfo.IsProduction)
|
||
|
{
|
||
|
response.Headers.DisableCache();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (request.Url.Path.ToLower() == "app.js")
|
||
|
{
|
||
|
response.Headers.DisableCache();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
response.Headers.EnableCache();
|
||
|
}
|
||
|
}
|
||
|
}
|