2013-03-30 02:00:38 +03:00
|
|
|
using System;
|
2013-02-18 05:10:21 +03:00
|
|
|
using Nancy;
|
|
|
|
|
2013-03-30 02:00:38 +03:00
|
|
|
namespace NzbDrone.Api.Frontend
|
2013-02-18 05:10:21 +03:00
|
|
|
{
|
|
|
|
public class IndexModule : NancyModule
|
|
|
|
{
|
|
|
|
public IndexModule()
|
|
|
|
{
|
2013-02-18 06:04:28 +03: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)
|
|
|
|
|| Request.Path.StartsWith("/api", StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
{
|
|
|
|
return new NotFoundResponse();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-29 04:49:14 +03:00
|
|
|
return View["UI/index.html"];
|
2013-02-18 05:10:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|