2013-02-18 03:04:28 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
2013-02-18 02:10:21 +00:00
|
|
|
|
using Nancy;
|
2013-02-18 03:04:28 +00:00
|
|
|
|
using Nancy.Responses.Negotiation;
|
2013-02-18 02:10:21 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.FrontendModule
|
|
|
|
|
{
|
|
|
|
|
public class IndexModule : NancyModule
|
|
|
|
|
{
|
|
|
|
|
public IndexModule()
|
|
|
|
|
{
|
2013-02-18 03:04:28 +00: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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return View["NzbDrone.Backbone/index.html"];
|
2013-02-18 02:10:21 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|