2013-03-29 16:00:38 -07:00
|
|
|
using System;
|
2013-02-17 18:10:21 -08:00
|
|
|
using Nancy;
|
2013-05-21 17:58:57 -07:00
|
|
|
using Nancy.Security;
|
2013-02-17 18:10:21 -08:00
|
|
|
|
2013-03-29 16:00:38 -07:00
|
|
|
namespace NzbDrone.Api.Frontend
|
2013-02-17 18:10:21 -08:00
|
|
|
{
|
|
|
|
public class IndexModule : NancyModule
|
|
|
|
{
|
|
|
|
public IndexModule()
|
|
|
|
{
|
2013-05-21 17:58:57 -07:00
|
|
|
this.RequiresAuthentication();
|
2013-02-17 19:04:28 -08:00
|
|
|
//Serve anything that doesn't have an extension
|
|
|
|
Get[@"/(.*)"] = x => Index();
|
|
|
|
}
|
|
|
|
|
|
|
|
private object Index()
|
|
|
|
{
|
|
|
|
if(
|
|
|
|
Request.Path.Contains(".")
|
|
|
|
|| Request.Path.StartsWith("/static", StringComparison.CurrentCultureIgnoreCase)
|
2013-05-05 14:24:33 -07:00
|
|
|
|| Request.Path.StartsWith("/api", StringComparison.CurrentCultureIgnoreCase)
|
|
|
|
|| Request.Path.StartsWith("/signalr", StringComparison.CurrentCultureIgnoreCase))
|
2013-02-17 19:04:28 -08:00
|
|
|
{
|
|
|
|
return new NotFoundResponse();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-28 18:49:14 -07:00
|
|
|
return View["UI/index.html"];
|
2013-02-17 18:10:21 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|