mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
Small changes
This commit is contained in:
parent
2f5db03815
commit
93c5cf6eb6
8 changed files with 16 additions and 25 deletions
|
@ -66,18 +66,7 @@ namespace PlexRequests.Helpers.Tests
|
|||
};
|
||||
|
||||
static readonly object[] UriDataWithPort =
|
||||
{
|
||||
new object[] { "google.com", new Uri("http://google.com/"), },
|
||||
new object[] { "http://google.com", new Uri("http://google.com/"), },
|
||||
new object[] { "https://google.com", new Uri("https://google.com/"), },
|
||||
new object[] { "192.168.1.1", new Uri("http://192.168.1.1")},
|
||||
new object[] { "0.0.0.0:5533", new Uri("http://0.0.0.0:5533")},
|
||||
new object[] {"www.google.com", new Uri("http://www.google.com/")},
|
||||
new object[] {"http://www.google.com/", new Uri("http://www.google.com/") },
|
||||
new object[] {"https://www.google.com", new Uri("https://www.google.com/") },
|
||||
new object[] {"www.google.com:443", new Uri("http://www.google.com:443/") },
|
||||
new object[] {"https://www.google.com:443", new Uri("https://www.google.com:443/") },
|
||||
new object[] {"http://www.google.com:443/id=2", new Uri("http://www.google.com:443/id=2") },
|
||||
{
|
||||
new object[] {"www.google.com", 80, new Uri("http://www.google.com:80/"), },
|
||||
new object[] {"www.google.com", 443, new Uri("http://www.google.com:443/") },
|
||||
new object[] {"http://www.google.com", 443, new Uri("http://www.google.com:443/") },
|
||||
|
|
|
@ -119,6 +119,6 @@
|
|||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="SqlTables" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>sqltables.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
<value>SqlTables.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||
</data>
|
||||
</root>
|
|
@ -29,6 +29,7 @@ using Mono.Data.Sqlite;
|
|||
using Nancy;
|
||||
using Nancy.Authentication.Forms;
|
||||
using Nancy.Bootstrapper;
|
||||
using Nancy.Cryptography;
|
||||
using Nancy.Diagnostics;
|
||||
using Nancy.Session;
|
||||
using Nancy.TinyIoc;
|
||||
|
@ -66,7 +67,9 @@ namespace PlexRequests.UI
|
|||
|
||||
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
|
||||
{
|
||||
CookieBasedSessions.Enable(pipelines);
|
||||
|
||||
CookieBasedSessions.Enable(pipelines, CryptographyConfiguration.Default);
|
||||
|
||||
StaticConfiguration.DisableErrorTraces = false;
|
||||
|
||||
base.ApplicationStartup(container, pipelines);
|
||||
|
|
|
@ -33,25 +33,24 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
public class BaseModule : NancyModule
|
||||
{
|
||||
// TODO get this working
|
||||
public BaseModule()
|
||||
{
|
||||
//CheckAuth();
|
||||
Before += (ctx)=> CheckAuth();
|
||||
}
|
||||
|
||||
public BaseModule(string modulePath) : base(modulePath)
|
||||
{
|
||||
//CheckAuth();
|
||||
Before += (ctx) => CheckAuth();
|
||||
}
|
||||
|
||||
|
||||
private void CheckAuth()
|
||||
private Response CheckAuth()
|
||||
{
|
||||
|
||||
if (Request?.Session?[SessionKeys.UsernameKey] == null)
|
||||
if (Session[SessionKeys.UsernameKey] == null)
|
||||
{
|
||||
Context.GetRedirect("~/userlogin");
|
||||
return Context.GetRedirect("~/userlogin");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ using Nancy.Extensions;
|
|||
|
||||
namespace PlexRequests.UI.Modules
|
||||
{
|
||||
public class IndexModule : NancyModule
|
||||
public class IndexModule : BaseModule
|
||||
{
|
||||
public IndexModule()
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ using PlexRequests.Core;
|
|||
|
||||
namespace PlexRequests.UI.Modules
|
||||
{
|
||||
public class LoginModule : NancyModule
|
||||
public class LoginModule : BaseModule
|
||||
{
|
||||
public LoginModule()
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ using PlexRequests.UI.Models;
|
|||
|
||||
namespace PlexRequests.UI.Modules
|
||||
{
|
||||
public class RequestsModule : NancyModule
|
||||
public class RequestsModule : BaseModule
|
||||
{
|
||||
private IRepository<RequestedModel> Service { get; set; }
|
||||
public RequestsModule(IRepository<RequestedModel> service) : base("requests")
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace PlexRequests.UI.Modules
|
|||
var username = Request.Form.username;
|
||||
|
||||
// Add to the session
|
||||
Request.Session[SessionKeys.UsernameKey] = username;
|
||||
Session[SessionKeys.UsernameKey] = username;
|
||||
|
||||
return Response.AsJson(new { Result = true });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue