2013-07-15 20:25:16 +02:00
|
|
|
using System;
|
2013-07-14 06:19:36 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-07-15 20:25:16 +02:00
|
|
|
if (request.Url.Path.EndsWith("app.js", StringComparison.CurrentCultureIgnoreCase))
|
2013-07-14 06:19:36 +02:00
|
|
|
{
|
|
|
|
response.Headers.DisableCache();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
response.Headers.EnableCache();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|