mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
Merge
This commit is contained in:
commit
bee57b46ff
24 changed files with 418 additions and 78 deletions
42
README.md
42
README.md
|
@ -1 +1,41 @@
|
||||||
# RequestPlex
|
# Request Plex!
|
||||||
|
|
||||||
|
[](https://gitter.im/tidusjar/RequestPlex?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||||
|
[](https://ci.appveyor.com/project/tidusjar/requestplex)
|
||||||
|
|
||||||
|
This is based off [Plex Requests by lokenx](https://github.com/lokenx/plexrequests-meteor) so big props to that guy!
|
||||||
|
I wanted to write a similar application in .Net!
|
||||||
|
|
||||||
|
#Features
|
||||||
|
|
||||||
|
* Integration with [TheMovieDB](https://www.themoviedb.org/) for all Movies and TV shows
|
||||||
|
* Secure authentication
|
||||||
|
* [Sonarr](https://sonarr.tv/) integration (SickRage/Sickbeard TBD)
|
||||||
|
* [CouchPotato](https://couchpota.to/) integration
|
||||||
|
* Email notifications
|
||||||
|
|
||||||
|
#Preview
|
||||||
|
|
||||||
|
TBC
|
||||||
|
|
||||||
|
#Installation
|
||||||
|
|
||||||
|
Just run the .exe! (Use mono if not on Windows `mono RequestPlex.UI.exe`)
|
||||||
|
|
||||||
|
#Configuration
|
||||||
|
|
||||||
|
TBC
|
||||||
|
|
||||||
|
# Contributors
|
||||||
|
|
||||||
|
We are looking for any contributions to the project! Just pick up a task, if you have any questions ask and i'll get straight on it!
|
||||||
|
|
||||||
|
Please feed free to submit a pull request!
|
||||||
|
|
||||||
|
|
||||||
|
# Sponsors
|
||||||
|
- [JetBrains](http://www.jetbrains.com/) for providing us with free licenses to their great tools!!!
|
||||||
|
- [ReSharper](http://www.jetbrains.com/resharper/)
|
||||||
|
- [dotTrace] (https://www.jetbrains.com/profiler/)
|
||||||
|
- [dotMemory] (https://www.jetbrains.com/dotmemory/)
|
||||||
|
- [dotCover] (https://www.jetbrains.com/dotcover/)
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace RequestPlex.Api.Models
|
|
||||||
{
|
|
||||||
public class MovieResult
|
|
||||||
{
|
|
||||||
public bool adult { get; set; }
|
|
||||||
public string backdrop_path { get; set; }
|
|
||||||
public List<object> genre_ids { get; set; }
|
|
||||||
public int id { get; set; }
|
|
||||||
public string original_language { get; set; }
|
|
||||||
public string original_title { get; set; }
|
|
||||||
public string overview { get; set; }
|
|
||||||
public string release_date { get; set; }
|
|
||||||
public string poster_path { get; set; }
|
|
||||||
public double popularity { get; set; }
|
|
||||||
public string title { get; set; }
|
|
||||||
public bool video { get; set; }
|
|
||||||
public double vote_average { get; set; }
|
|
||||||
public int vote_count { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MovieSearch
|
|
||||||
{
|
|
||||||
public int page { get; set; }
|
|
||||||
public List<MovieResult> results { get; set; }
|
|
||||||
public int total_pages { get; set; }
|
|
||||||
public int total_results { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
40
RequestPlex.Api/Models/PlexAuthentication.cs
Normal file
40
RequestPlex.Api/Models/PlexAuthentication.cs
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace RequestPlex.Api.Models
|
||||||
|
{
|
||||||
|
public class PlexAuthentication
|
||||||
|
{
|
||||||
|
public User user { get; set; }
|
||||||
|
}
|
||||||
|
public class Subscription
|
||||||
|
{
|
||||||
|
public bool active { get; set; }
|
||||||
|
public string status { get; set; }
|
||||||
|
public object plan { get; set; }
|
||||||
|
public object features { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Roles
|
||||||
|
{
|
||||||
|
public List<object> roles { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
public string email { get; set; }
|
||||||
|
public string joined_at { get; set; }
|
||||||
|
public string username { get; set; }
|
||||||
|
public string title { get; set; }
|
||||||
|
public string authentication_token { get; set; }
|
||||||
|
public Subscription subscription { get; set; }
|
||||||
|
public Roles roles { get; set; }
|
||||||
|
public List<string> entitlements { get; set; }
|
||||||
|
public object confirmed_at { get; set; }
|
||||||
|
public int forum_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
14
RequestPlex.Api/Models/PlexUserRequest.cs
Normal file
14
RequestPlex.Api/Models/PlexUserRequest.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
namespace RequestPlex.Api.Models
|
||||||
|
{
|
||||||
|
public class PlexUserRequest
|
||||||
|
{
|
||||||
|
public UserRequest user { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UserRequest
|
||||||
|
{
|
||||||
|
public string login { get; set; }
|
||||||
|
public string password { get; set; }
|
||||||
|
}
|
||||||
|
}
|
51
RequestPlex.Api/PlexApi.cs
Normal file
51
RequestPlex.Api/PlexApi.cs
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
using System;
|
||||||
|
using RequestPlex.Api.Models;
|
||||||
|
using RestSharp;
|
||||||
|
|
||||||
|
namespace RequestPlex.Api
|
||||||
|
{
|
||||||
|
public class PlexApi
|
||||||
|
{
|
||||||
|
public PlexAuthentication GetToken(string username, string password)
|
||||||
|
{
|
||||||
|
var userModel = new PlexUserRequest
|
||||||
|
{
|
||||||
|
user = new UserRequest
|
||||||
|
{
|
||||||
|
password = password,
|
||||||
|
login = username
|
||||||
|
},
|
||||||
|
};
|
||||||
|
var request = new RestRequest
|
||||||
|
{
|
||||||
|
Method = Method.POST,
|
||||||
|
};
|
||||||
|
|
||||||
|
request.AddHeader("X-Plex-Client-Identifier", "Test213");
|
||||||
|
request.AddHeader("X-Plex-Product", "Request Plex");
|
||||||
|
request.AddHeader("X-Plex-Version", "0.0.1");
|
||||||
|
request.AddHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
request.AddJsonBody(userModel);
|
||||||
|
|
||||||
|
var api = new ApiRequest();
|
||||||
|
return api.Execute<PlexAuthentication>(request, new Uri("https://plex.tv/users/sign_in.json"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetUsers(string authToken)
|
||||||
|
{
|
||||||
|
var request = new RestRequest
|
||||||
|
{
|
||||||
|
Method = Method.POST,
|
||||||
|
};
|
||||||
|
|
||||||
|
request.AddHeader("X-Plex-Client-Identifier", "Test213");
|
||||||
|
request.AddHeader("X-Plex-Product", "Request Plex");
|
||||||
|
request.AddHeader("X-Plex-Version", "0.0.1");
|
||||||
|
request.AddHeader("X-Plex-Token", authToken);
|
||||||
|
request.AddHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,14 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Dapper, Version=1.40.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Dapper.1.42\lib\net45\Dapper.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Nancy, Version=1.4.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Nancy.1.4.3\lib\net40\Nancy.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
|
@ -53,7 +61,9 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ApiRequest.cs" />
|
<Compile Include="ApiRequest.cs" />
|
||||||
<Compile Include="Models\MovieSearch.cs" />
|
<Compile Include="Models\PlexAuthentication.cs" />
|
||||||
|
<Compile Include="Models\PlexUserRequest.cs" />
|
||||||
|
<Compile Include="PlexApi.cs" />
|
||||||
<Compile Include="TheMovieDbApi.cs" />
|
<Compile Include="TheMovieDbApi.cs" />
|
||||||
<Compile Include="MovieBase.cs" />
|
<Compile Include="MovieBase.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="Dapper" version="1.42" targetFramework="net452" />
|
||||||
|
<package id="Nancy" version="1.4.3" targetFramework="net452" />
|
||||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||||
<package id="RestSharp" version="105.2.3" targetFramework="net452" />
|
<package id="RestSharp" version="105.2.3" targetFramework="net452" />
|
||||||
<package id="TMDbLib" version="0.9.0.0-alpha" targetFramework="net452" />
|
<package id="TMDbLib" version="0.9.0.0-alpha" targetFramework="net452" />
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace RequestPlex.Core
|
||||||
{
|
{
|
||||||
public class SettingsService
|
public class SettingsService
|
||||||
{
|
{
|
||||||
public void SaveSettings(int port)
|
public void SaveSettings(SettingsModel model)
|
||||||
{
|
{
|
||||||
var db = new DbConfiguration(new SqliteFactory());
|
var db = new DbConfiguration(new SqliteFactory());
|
||||||
var repo = new GenericRepository<SettingsModel>(db);
|
var repo = new GenericRepository<SettingsModel>(db);
|
||||||
|
@ -20,13 +20,12 @@ namespace RequestPlex.Core
|
||||||
var existingSettings = repo.GetAll().FirstOrDefault();
|
var existingSettings = repo.GetAll().FirstOrDefault();
|
||||||
if (existingSettings != null)
|
if (existingSettings != null)
|
||||||
{
|
{
|
||||||
existingSettings.Port = port;
|
existingSettings = model;
|
||||||
repo.Update(existingSettings);
|
repo.Update(existingSettings);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newSettings = new SettingsModel { Port = port };
|
repo.Insert(model);
|
||||||
repo.Insert(newSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingsModel GetSettings()
|
public SettingsModel GetSettings()
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace RequestPlex.Core
|
||||||
public void SetupDb()
|
public void SetupDb()
|
||||||
{
|
{
|
||||||
var db = new DbConfiguration(new SqliteFactory());
|
var db = new DbConfiguration(new SqliteFactory());
|
||||||
db.CreateDatabase();
|
db.CheckDb();
|
||||||
TableCreation.CreateTables(db.DbConnection());
|
TableCreation.CreateTables(db.DbConnection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace RequestPlex.Core
|
||||||
var db = new DbConfiguration(new SqliteFactory());
|
var db = new DbConfiguration(new SqliteFactory());
|
||||||
var repo = new UserRepository<UserModel>(db);
|
var repo = new UserRepository<UserModel>(db);
|
||||||
var users = repo.GetAll();
|
var users = repo.GetAll();
|
||||||
var userRecord = users.FirstOrDefault(u => u.UserName == username && u.Password == password); // TODO hashing
|
var userRecord = users.FirstOrDefault(u => u.UserName.Equals(username, StringComparison.InvariantCultureIgnoreCase) && u.Password.Equals(password)); // TODO hashing
|
||||||
|
|
||||||
if (userRecord == null)
|
if (userRecord == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,5 +8,7 @@ namespace RequestPlex.Store
|
||||||
public class SettingsModel : Entity
|
public class SettingsModel : Entity
|
||||||
{
|
{
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
|
public bool UserAuthentication { get; set; }
|
||||||
|
public string PlexAuthToken { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,9 @@ CREATE TABLE IF NOT EXISTS User
|
||||||
CREATE TABLE IF NOT EXISTS Settings
|
CREATE TABLE IF NOT EXISTS Settings
|
||||||
(
|
(
|
||||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
Port INTEGER NOT NULL
|
Port INTEGER NOT NULL,
|
||||||
|
UserAuthentication INTEGER NOT NULL,
|
||||||
|
PlexAuthToken varchar(50)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS Requested
|
CREATE TABLE IF NOT EXISTS Requested
|
||||||
|
|
|
@ -17,7 +17,6 @@ $("#tvSearchContent").on("keyup", function (e) {
|
||||||
tvimer = setTimeout(tvSearch(), 400);
|
tvimer = setTimeout(tvSearch(), 400);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#test").click(function (e) {
|
$("#test").click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
@ -104,14 +103,3 @@ function buildTvShowContext(result) {
|
||||||
};
|
};
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateNotify(message, type) {
|
|
||||||
// type = danger, warning, info, successs
|
|
||||||
$.notify({
|
|
||||||
// options
|
|
||||||
message: message
|
|
||||||
}, {
|
|
||||||
// settings
|
|
||||||
type: type
|
|
||||||
});
|
|
||||||
}
|
|
13
RequestPlex.UI/Content/site.js
Normal file
13
RequestPlex.UI/Content/site.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function generateNotify(message, type) {
|
||||||
|
// type = danger, warning, info, successs
|
||||||
|
$.notify({
|
||||||
|
// options
|
||||||
|
message: message
|
||||||
|
}, {
|
||||||
|
// settings
|
||||||
|
type: type
|
||||||
|
});
|
||||||
|
}
|
14
RequestPlex.UI/Models/PlexAuth.cs
Normal file
14
RequestPlex.UI/Models/PlexAuth.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace RequestPlex.UI.Models
|
||||||
|
{
|
||||||
|
public class PlexAuth
|
||||||
|
{
|
||||||
|
public string username { get; set; }
|
||||||
|
public string password { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
|
using System.Linq;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using Nancy.Extensions;
|
using Nancy.Extensions;
|
||||||
|
using Nancy.ModelBinding;
|
||||||
using Nancy.Security;
|
using Nancy.Security;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using RequestPlex.Api;
|
||||||
using RequestPlex.Core;
|
using RequestPlex.Core;
|
||||||
|
using RequestPlex.Store;
|
||||||
|
using RequestPlex.UI.Models;
|
||||||
|
|
||||||
namespace RequestPlex.UI.Modules
|
namespace RequestPlex.UI.Modules
|
||||||
{
|
{
|
||||||
|
@ -12,17 +20,20 @@ namespace RequestPlex.UI.Modules
|
||||||
{
|
{
|
||||||
public AdminModule()
|
public AdminModule()
|
||||||
{
|
{
|
||||||
|
#if !DEBUG
|
||||||
this.RequiresAuthentication();
|
this.RequiresAuthentication();
|
||||||
|
#endif
|
||||||
Get["admin/"] = _ =>
|
Get["admin/"] = _ =>
|
||||||
{
|
{
|
||||||
dynamic model = new ExpandoObject();
|
dynamic model = new ExpandoObject();
|
||||||
model.Errored = Request.Query.error.HasValue;
|
model.Errored = Request.Query.error.HasValue;
|
||||||
|
model.Port = null;
|
||||||
var s = new SettingsService();
|
var s = new SettingsService();
|
||||||
var settings = s.GetSettings();
|
var settings = s.GetSettings();
|
||||||
if (settings != null)
|
if (settings != null)
|
||||||
{
|
{
|
||||||
model.Port = settings.Port;
|
model.Port = settings.Port;
|
||||||
|
model.PlexAuthToken = settings.PlexAuthToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
return View["/Admin/Settings", model];
|
return View["/Admin/Settings", model];
|
||||||
|
@ -30,21 +41,55 @@ namespace RequestPlex.UI.Modules
|
||||||
|
|
||||||
Post["admin/"] = _ =>
|
Post["admin/"] = _ =>
|
||||||
{
|
{
|
||||||
var portString = (string)Request.Form.portNumber;
|
var model = this.Bind<SettingsModel>();
|
||||||
int port;
|
|
||||||
|
|
||||||
if (!int.TryParse(portString, out port))
|
|
||||||
{
|
|
||||||
return Context.GetRedirect("~/admin?error=true");
|
|
||||||
}
|
|
||||||
|
|
||||||
var s = new SettingsService();
|
var s = new SettingsService();
|
||||||
s.SaveSettings(port);
|
s.SaveSettings(model);
|
||||||
|
|
||||||
|
|
||||||
return Context.GetRedirect("~/admin");
|
return Context.GetRedirect("~/admin");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Post["admin/requestauth"] = _ =>
|
||||||
|
{
|
||||||
|
var user = this.Bind<PlexAuth>();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(user.username) || string.IsNullOrEmpty(user.password))
|
||||||
|
{
|
||||||
|
return Context.GetRedirect("~/admin?error=true");
|
||||||
|
}
|
||||||
|
|
||||||
|
var plex = new PlexApi();
|
||||||
|
var model = plex.GetToken(user.username, user.password);
|
||||||
|
var s = new SettingsService();
|
||||||
|
var oldSettings = s.GetSettings();
|
||||||
|
if (oldSettings != null)
|
||||||
|
{
|
||||||
|
oldSettings.PlexAuthToken = model.user.authentication_token;
|
||||||
|
s.SaveSettings(oldSettings);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var newModel = new SettingsModel
|
||||||
|
{
|
||||||
|
PlexAuthToken = model.user.authentication_token
|
||||||
|
};
|
||||||
|
s.SaveSettings(newModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return Context.GetRedirect("~/admin");
|
||||||
|
};
|
||||||
|
|
||||||
|
Get["admin/getusers"] = _ =>
|
||||||
|
{
|
||||||
|
var api = new PlexApi();
|
||||||
|
|
||||||
|
|
||||||
|
return View["/Admin/Settings"];
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,10 +12,13 @@ namespace RequestPlex.UI
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
var uri = "http://localhost:3579/";
|
||||||
|
var s = new Setup();
|
||||||
|
s.SetupDb();
|
||||||
|
|
||||||
var service = new SettingsService();
|
var service = new SettingsService();
|
||||||
var settings = service.GetSettings();
|
var settings = service.GetSettings();
|
||||||
|
|
||||||
var uri = "http://localhost:3579/";
|
|
||||||
if (settings != null)
|
if (settings != null)
|
||||||
{
|
{
|
||||||
uri = $"http://localhost:{settings.Port}";
|
uri = $"http://localhost:{settings.Port}";
|
||||||
|
|
|
@ -108,6 +108,7 @@
|
||||||
<Content Include="Content\custom.css">
|
<Content Include="Content\custom.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Compile Include="Models\PlexAuth.cs" />
|
||||||
<Compile Include="Modules\AdminModule.cs" />
|
<Compile Include="Modules\AdminModule.cs" />
|
||||||
<Compile Include="Modules\IndexModule.cs" />
|
<Compile Include="Modules\IndexModule.cs" />
|
||||||
<Compile Include="Modules\LoginModule.cs" />
|
<Compile Include="Modules\LoginModule.cs" />
|
||||||
|
@ -136,6 +137,9 @@
|
||||||
<Content Include="Content\jquery-2.2.1.min.js">
|
<Content Include="Content\jquery-2.2.1.min.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Content\site.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="icon.png" />
|
<Content Include="icon.png" />
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
<Content Include="packages.config" />
|
<Content Include="packages.config" />
|
||||||
|
@ -193,7 +197,6 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Auth\" />
|
<Folder Include="Auth\" />
|
||||||
<Folder Include="Models\" />
|
|
||||||
<Folder Include="Views\Requests\" />
|
<Folder Include="Views\Requests\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using Owin;
|
using Owin;
|
||||||
|
|
||||||
using RequestPlex.Core;
|
|
||||||
|
|
||||||
namespace RequestPlex.UI
|
namespace RequestPlex.UI
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
|
@ -9,9 +7,6 @@ namespace RequestPlex.UI
|
||||||
public void Configuration(IAppBuilder app)
|
public void Configuration(IAppBuilder app)
|
||||||
{
|
{
|
||||||
app.UseNancy();
|
app.UseNancy();
|
||||||
|
|
||||||
var s = new Setup();
|
|
||||||
s.SetupDb();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,81 @@
|
||||||
@Html.Partial("/Admin/_Sidebar")
|
@Html.Partial("/Admin/_Sidebar")
|
||||||
@{
|
@{
|
||||||
var port = Model.Port ?? 0;
|
int port;
|
||||||
|
var authToken = string.Empty;
|
||||||
|
if (Model.Port == null)
|
||||||
|
{
|
||||||
|
port = 3579;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
port = Model.Port;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Model.PlexAuthToken == null)
|
||||||
|
{
|
||||||
|
authToken = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
authToken = Model.PlexAuthToken;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<form class="form-horizontal" method="POST">
|
<form class="form-horizontal" method="POST" id="mainForm">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Request Plex Settings</legend>
|
<legend>Request Plex Settings</legend>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="portNumber" class="col-lg-2 control-label">Port</label>
|
<label for="portNumber" class="col-lg-2 control-label">Port</label>
|
||||||
<div class="col-lg-10">
|
<div class="col-lg-10">
|
||||||
<input type="text" class="form-control" id="portNumber" name="portNumber" placeholder="Port Number" value="@port">
|
<input type="text" class="form-control" id="portNumber" name="Port" placeholder="Port Number" value="@port">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="authToken" class="col-lg-2 control-label">Plex Authorization Token</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input type="text" class="form-control" id="authToken" name="PlexAuthToken" placeholder="Plex Auth Token" value="@authToken">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="userpass" class="col-lg-2 control-label">Username and Password</label>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<input type="text" class="form-control" id="username" name="Username" placeholder="Username">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 col-lg-push-1">
|
||||||
|
<input type="password" class="form-control" id="password" name="Username" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-10 col-lg-offset-2">
|
||||||
|
<button id="requestToken" class="btn btn-primary">Request Token</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="userAuth" class="col-lg-2 control-label">Enable User Authentication</label>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<input type="checkbox" class="form-control" id="userAuth" name="UserAuthentication">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<small>Current users that are allowed to authenticate: </small>
|
||||||
|
<select id="users" multiple="" class="form-control">
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-lg-10 col-lg-offset-2">
|
||||||
|
<button id="refreshUsers" class="btn btn-primary">Refresh Users</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<div>
|
||||||
|
<small class="col-lg-10 col-lg-offset-2">Please note, you will have to restart after changing these settings.</small>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-lg-10 col-lg-offset-2">
|
<div class="col-lg-10 col-lg-offset-2">
|
||||||
<button type="reset" class="btn btn-default">Cancel</button>
|
<button type="reset" class="btn btn-default">Cancel</button>
|
||||||
|
@ -30,3 +94,59 @@
|
||||||
Please enter in a correct port number
|
Please enter in a correct port number
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
|
||||||
|
loadUserList();
|
||||||
|
|
||||||
|
$('#refreshUsers').click(function() {
|
||||||
|
loadUserList();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#requestToken').click(function (e) {
|
||||||
|
var $form = $("#mainForm");
|
||||||
|
$.ajax({
|
||||||
|
type: $form.prop("method"),
|
||||||
|
url: "admin/requestauth",
|
||||||
|
data: $form.serialize(),
|
||||||
|
dataType: "json",
|
||||||
|
success: function (response) {
|
||||||
|
console.log(response);
|
||||||
|
if (response.Result === true) {
|
||||||
|
generateNotify("Success!", "success");
|
||||||
|
$('#authToken').val(response.authToken);
|
||||||
|
} else {
|
||||||
|
generateNotify(response.Message, "warning");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (e) {
|
||||||
|
console.log(e);
|
||||||
|
generateNotify("Something went wrong!", "danger");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function loadUserList() {
|
||||||
|
$.ajax({
|
||||||
|
type: "Get",
|
||||||
|
url: "admin/getusers",
|
||||||
|
dataType: "json",
|
||||||
|
success: function (response) {
|
||||||
|
response.each(function (user) {
|
||||||
|
$('#users').append("<option>" + user + "</option>");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function (e) {
|
||||||
|
console.log(e);
|
||||||
|
generateNotify("Something went wrong!", "danger");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -4,6 +4,5 @@
|
||||||
<a class="list-group-item" href="/couchpotato">CouchPotato Settings</a>
|
<a class="list-group-item" href="/couchpotato">CouchPotato Settings</a>
|
||||||
<a class="list-group-item" href="/sonarr">Sonarr Settings</a>
|
<a class="list-group-item" href="/sonarr">Sonarr Settings</a>
|
||||||
<a class="list-group-item" href="/sickbeard">Sickbeard Settings</a>
|
<a class="list-group-item" href="/sickbeard">Sickbeard Settings</a>
|
||||||
<a class="list-group-item" href="/userauth">Authentication</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -11,6 +11,7 @@
|
||||||
<script src="/Content/handlebars.js"></script>
|
<script src="/Content/handlebars.js"></script>
|
||||||
<script src="/Content/bootstrap.min.js"></script>
|
<script src="/Content/bootstrap.min.js"></script>
|
||||||
<script src="/Content/bootstrap-notify.min.js"></script>
|
<script src="/Content/bootstrap-notify.min.js"></script>
|
||||||
|
<script src="/Content/site.js"></script>
|
||||||
|
|
||||||
<nav class="navbar navbar-default">
|
<nav class="navbar navbar-default">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
|
@ -13,6 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RequestPlex.Core", "Request
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RequestPlex.Store", "RequestPlex.Store\RequestPlex.Store.csproj", "{92433867-2B7B-477B-A566-96C382427525}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RequestPlex.Store", "RequestPlex.Store\RequestPlex.Store.csproj", "{92433867-2B7B-477B-A566-96C382427525}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F4BC839C-B8FF-48BE-B22E-536A0A0A81A5}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
LICENSE = LICENSE
|
||||||
|
README.md = README.md
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RequestPlex.Helpers", "RequestPlex.Helpers\RequestPlex.Helpers.csproj", "{1252336D-42A3-482A-804C-836E60173DFA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RequestPlex.Helpers", "RequestPlex.Helpers\RequestPlex.Helpers.csproj", "{1252336D-42A3-482A-804C-836E60173DFA}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
|
27
RequestPlex.sln.DotSettings
Normal file
27
RequestPlex.sln.DotSettings
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">/************************************************************************
|
||||||
|
Copyright (c) $CURRENT_YEAR$ Jamie Rees
|
||||||
|
File: $FILENAME$
|
||||||
|
Created By: $USER_NAME$
|
||||||
|

|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|

|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|

|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
************************************************************************/
|
||||||
|
</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderRegionName/@EntryValue">Copyright</s:String></wpf:ResourceDictionary>
|
Loading…
Add table
Add a link
Reference in a new issue