1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Api/Frontend/IndexModule.cs

31 lines
855 B
C#
Raw Normal View History

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