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.
31 lines
837 B
31 lines
837 B
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Owin;
|
|
using NzbDrone.Common.EnvironmentInfo;
|
|
using Owin;
|
|
|
|
namespace NzbDrone.Host.Owin.MiddleWare
|
|
{
|
|
public class NzbDroneVersionMiddleWare : IOwinMiddleWare
|
|
{
|
|
public int Order { get { return 0; } }
|
|
|
|
public void Attach(IAppBuilder appBuilder)
|
|
{
|
|
appBuilder.Use(typeof(AddApplicationVersionHeader));
|
|
}
|
|
}
|
|
|
|
public class AddApplicationVersionHeader : OwinMiddleware
|
|
{
|
|
public AddApplicationVersionHeader(OwinMiddleware next)
|
|
: base(next)
|
|
{
|
|
}
|
|
public override Task Invoke(IOwinContext context)
|
|
{
|
|
context.Response.Headers.Add("X-ApplicationVersion", new string[] { BuildInfo.Version.ToString() });
|
|
return Next.Invoke(context);
|
|
}
|
|
}
|
|
} |