summaryrefslogtreecommitdiffstats
path: root/ComicRackWebViewer/Modules/IndexModule.cs
blob: 123d50bb0c26a42b354a48aa6dfe9b6d987df17a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using BCR;
using Nancy;
using Nancy.Responses;

namespace ComicRackWebViewer
{
  public class IndexModule : NancyModule
  {
    public IndexModule()
      : base("/")
    {
      Get["/"] = x => {
        var baseUrl = Database.Instance.GlobalSettings.url_base;
        if (string.IsNullOrEmpty(baseUrl))
        {
          baseUrl = "/index.html";
        }
        else
        {
          baseUrl = "/" + baseUrl + "/index.html";
        }

        return Response.AsRedirect(baseUrl, RedirectResponse.RedirectType.Permanent); 
      };
    }
  }
}