You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
783 B
32 lines
783 B
using System;
|
|
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.EndsWith("app.js", StringComparison.CurrentCultureIgnoreCase))
|
|
{
|
|
response.Headers.DisableCache();
|
|
return;
|
|
}
|
|
|
|
response.Headers.EnableCache();
|
|
}
|
|
}
|
|
} |