mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 14:10: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 =
|
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", 80, new Uri("http://www.google.com:80/"), },
|
||||||
new object[] {"www.google.com", 443, new Uri("http://www.google.com:443/") },
|
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/") },
|
new object[] {"http://www.google.com", 443, new Uri("http://www.google.com:443/") },
|
||||||
|
|
|
@ -119,6 +119,6 @@
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<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">
|
<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>
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -29,6 +29,7 @@ using Mono.Data.Sqlite;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using Nancy.Authentication.Forms;
|
using Nancy.Authentication.Forms;
|
||||||
using Nancy.Bootstrapper;
|
using Nancy.Bootstrapper;
|
||||||
|
using Nancy.Cryptography;
|
||||||
using Nancy.Diagnostics;
|
using Nancy.Diagnostics;
|
||||||
using Nancy.Session;
|
using Nancy.Session;
|
||||||
using Nancy.TinyIoc;
|
using Nancy.TinyIoc;
|
||||||
|
@ -66,7 +67,9 @@ namespace PlexRequests.UI
|
||||||
|
|
||||||
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
|
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
|
||||||
{
|
{
|
||||||
CookieBasedSessions.Enable(pipelines);
|
|
||||||
|
CookieBasedSessions.Enable(pipelines, CryptographyConfiguration.Default);
|
||||||
|
|
||||||
StaticConfiguration.DisableErrorTraces = false;
|
StaticConfiguration.DisableErrorTraces = false;
|
||||||
|
|
||||||
base.ApplicationStartup(container, pipelines);
|
base.ApplicationStartup(container, pipelines);
|
||||||
|
|
|
@ -33,25 +33,24 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class BaseModule : NancyModule
|
public class BaseModule : NancyModule
|
||||||
{
|
{
|
||||||
// TODO get this working
|
|
||||||
public BaseModule()
|
public BaseModule()
|
||||||
{
|
{
|
||||||
//CheckAuth();
|
Before += (ctx)=> CheckAuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseModule(string modulePath) : base(modulePath)
|
public BaseModule(string modulePath) : base(modulePath)
|
||||||
{
|
{
|
||||||
//CheckAuth();
|
Before += (ctx) => CheckAuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CheckAuth()
|
private Response CheckAuth()
|
||||||
{
|
{
|
||||||
|
if (Session[SessionKeys.UsernameKey] == null)
|
||||||
if (Request?.Session?[SessionKeys.UsernameKey] == null)
|
|
||||||
{
|
{
|
||||||
Context.GetRedirect("~/userlogin");
|
return Context.GetRedirect("~/userlogin");
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ using Nancy.Extensions;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Modules
|
namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class IndexModule : NancyModule
|
public class IndexModule : BaseModule
|
||||||
{
|
{
|
||||||
public IndexModule()
|
public IndexModule()
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ using PlexRequests.Core;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Modules
|
namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class LoginModule : NancyModule
|
public class LoginModule : BaseModule
|
||||||
{
|
{
|
||||||
public LoginModule()
|
public LoginModule()
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ using PlexRequests.UI.Models;
|
||||||
|
|
||||||
namespace PlexRequests.UI.Modules
|
namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class RequestsModule : NancyModule
|
public class RequestsModule : BaseModule
|
||||||
{
|
{
|
||||||
private IRepository<RequestedModel> Service { get; set; }
|
private IRepository<RequestedModel> Service { get; set; }
|
||||||
public RequestsModule(IRepository<RequestedModel> service) : base("requests")
|
public RequestsModule(IRepository<RequestedModel> service) : base("requests")
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace PlexRequests.UI.Modules
|
||||||
var username = Request.Form.username;
|
var username = Request.Form.username;
|
||||||
|
|
||||||
// Add to the session
|
// Add to the session
|
||||||
Request.Session[SessionKeys.UsernameKey] = username;
|
Session[SessionKeys.UsernameKey] = username;
|
||||||
|
|
||||||
return Response.AsJson(new { Result = true });
|
return Response.AsJson(new { Result = true });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue