tidusjar 9 years ago
commit a89e1110db

@ -16,7 +16,7 @@ I wanted to write a similar application in .Net!
#Preview
TBC
![Preview](http://i.imgur.com/Q8iRI43.gif)
#Installation

@ -28,8 +28,6 @@ namespace RequestPlex.Api
if (response.ErrorException != null)
{
var message = "Error retrieving response. Check inner details for more info.";
throw new ApplicationException(message, response.ErrorException);
}

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using RestSharp.Deserializers;
namespace RequestPlex.Api.Models
{
[XmlRoot(ElementName = "Server")]
public class Server
{
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "serverId")]
public string ServerId { get; set; }
[XmlAttribute(AttributeName = "machineIdentifier")]
public string MachineIdentifier { get; set; }
[XmlAttribute(AttributeName = "name")]
public string Name { get; set; }
[XmlAttribute(AttributeName = "lastSeenAt")]
public string LastSeenAt { get; set; }
[XmlAttribute(AttributeName = "numLibraries")]
public string NumLibraries { get; set; }
[XmlAttribute(AttributeName = "owned")]
public string Owned { get; set; }
}
[XmlRoot(ElementName = "User")]
public class UserFriends
{
[XmlElement(ElementName = "Server")]
public Server Server { get; set; }
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "title")]
public string Title { get; set; }
[XmlAttribute(AttributeName = "username")]
public string Username { get; set; }
[XmlAttribute(AttributeName = "email")]
public string Email { get; set; }
[XmlAttribute(AttributeName = "recommendationsPlaylistId")]
public string RecommendationsPlaylistId { get; set; }
[XmlAttribute(AttributeName = "thumb")]
public string Thumb { get; set; }
}
[XmlRoot(ElementName = "MediaContainer")]
public class PlexFriends
{
[XmlElement(ElementName = "User")]
public List<UserFriends> User { get; set; }
[XmlAttribute(AttributeName = "friendlyName")]
public string FriendlyName { get; set; }
[XmlAttribute(AttributeName = "identifier")]
public string Identifier { get; set; }
[XmlAttribute(AttributeName = "machineIdentifier")]
public string MachineIdentifier { get; set; }
[XmlAttribute(AttributeName = "totalSize")]
public string TotalSize { get; set; }
[XmlAttribute(AttributeName = "size")]
public string Size { get; set; }
}
}

@ -1,6 +1,10 @@
using System;
using System.IO;
using System.Runtime.Remoting.Messaging;
using RequestPlex.Api.Models;
using RestSharp;
using RestSharp.Deserializers;
using RestSharp.Serializers;
namespace RequestPlex.Api
{
@ -32,19 +36,23 @@ namespace RequestPlex.Api
return api.Execute<PlexAuthentication>(request, new Uri("https://plex.tv/users/sign_in.json"));
}
public void GetUsers(string authToken)
public PlexFriends GetUsers(string authToken)
{
var request = new RestRequest
{
Method = Method.POST,
Method = Method.GET,
};
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");
request.AddHeader("Content-Type", "application/xml");
var api = new ApiRequest();
var users = api.Execute<PlexFriends>(request, new Uri("https://plex.tv/pms/friends/all"));
return users;
}
}
}

@ -38,8 +38,8 @@
<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">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
@ -62,6 +62,7 @@
<ItemGroup>
<Compile Include="ApiRequest.cs" />
<Compile Include="Models\PlexAuthentication.cs" />
<Compile Include="Models\PlexFriends.cs" />
<Compile Include="Models\PlexUserRequest.cs" />
<Compile Include="PlexApi.cs" />
<Compile Include="TheMovieDbApi.cs" />
@ -69,6 +70,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -2,7 +2,7 @@
<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="8.0.2" targetFramework="net452" />
<package id="RestSharp" version="105.2.3" targetFramework="net452" />
<package id="TMDbLib" version="0.9.0.0-alpha" targetFramework="net452" />
</packages>

@ -64,6 +64,9 @@
<ItemGroup>
<Compile Include="ISettingsService.cs" />
<Compile Include="RequestService.cs" />
<Compile Include="SettingModels\SonarrSettings.cs" />
<Compile Include="SettingModels\SickRageSettings.cs" />
<Compile Include="SettingModels\CouchPotatoSettings.cs" />
<Compile Include="SettingModels\RequestPlexSettings.cs" />
<Compile Include="SettingModels\Settings.cs" />
<Compile Include="SettingsService.cs" />
@ -74,6 +77,7 @@
<Compile Include="UserMapper.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>

@ -0,0 +1,10 @@
namespace RequestPlex.Core.SettingModels
{
public class CouchPotatoSettings : Settings
{
public string Ip { get; set; }
public int Port { get; set; }
public string ApiKey { get; set; }
public bool Enabled { get; set; }
}
}

@ -31,5 +31,9 @@ namespace RequestPlex.Core.SettingModels
public int Port { get; set; }
public bool UserAuthentication { get; set; }
public string PlexAuthToken { get; set; }
public bool SearchForMovies { get; set; }
public bool SearchForTvShows { get; set; }
public bool RequireApprovial { get; set; }
public int WeeklyRequestLimit { get; set; }
}
}

@ -0,0 +1,10 @@
namespace RequestPlex.Core.SettingModels
{
public class SickRageSettings : Settings
{
public string Ip { get; set; }
public int Port { get; set; }
public string ApiKey { get; set; }
public bool Enabled { get; set; }
}
}

@ -0,0 +1,10 @@
namespace RequestPlex.Core.SettingModels
{
public class SonarrSettings : Settings
{
public string Ip { get; set; }
public int Port { get; set; }
public string ApiKey { get; set; }
public bool Enabled { get; set; }
}
}

@ -64,7 +64,9 @@ namespace RequestPlex.Core
PosterPath = "http://image.tmdb.org/t/p/w150/" + movieInfo.PosterPath,
Title = movieInfo.Title,
ReleaseDate = movieInfo.ReleaseDate ?? DateTime.MinValue,
Status = movieInfo.Status
Status = movieInfo.Status,
RequestedDate = DateTime.Now,
Approved = false
};
}
else
@ -79,7 +81,9 @@ namespace RequestPlex.Core
PosterPath = "http://image.tmdb.org/t/p/w150/" + showInfo.PosterPath,
Title = showInfo.Name,
ReleaseDate = showInfo.FirstAirDate ?? DateTime.MinValue,
Status = showInfo.Status
Status = showInfo.Status,
RequestedDate = DateTime.Now,
Approved = false
};
}
var db = new DbConfiguration(new SqliteFactory());

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -0,0 +1,15 @@
using System.Diagnostics;
using System.Reflection;
namespace RequestPlex.Helpers
{
public class AssemblyHelper
{
public static string GetAssemblyVersion()
{
var assembly = Assembly.GetExecutingAssembly();
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
return fvi.FileVersion;
}
}
}

@ -45,6 +45,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyHelper.cs" />
<Compile Include="ICacheProvider.cs" />
<Compile Include="MemoryCacheProvider.cs" />
<Compile Include="ObjectCopier.cs" />

@ -16,6 +16,10 @@ namespace RequestPlex.Store
public DateTime ReleaseDate { get; set; }
public RequestType Type { get; set; }
public string Status { get; set; }
public bool Approved { get; set; }
public string RequestedBy { get; set; }
public DateTime RequestedDate { get; set; }
}
public enum RequestType

@ -21,12 +21,17 @@ CREATE TABLE IF NOT EXISTS Requested
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Type INTEGER NOT NULL,
Tmdbid INTEGER NOT NULL,
ImdbId varchar(50) NOT NULL,
ImdbId varchar(50),
Overview varchar(50) NOT NULL,
Title varchar(50) NOT NULL,
PosterPath varchar(50) NOT NULL,
ReleaseDate varchar(50) NOT NULL,
Status varchar(50) NOT NULL
Status varchar(50) NOT NULL,
Approved INTEGER NOT NULL,
RequestedBy varchar(50),
RequestedDate varchar(50) NOT NULL,
Available varchar(50)
);
CREATE TABLE IF NOT EXISTS GlobalSettings

@ -35,6 +35,7 @@ namespace RequestPlex.UI
container.Register<ISettingsService<RequestPlexSettings>, SettingsServiceV2<RequestPlexSettings>>();
container.Register<ISettingsService<CouchPotatoSettings>, SettingsServiceV2<CouchPotatoSettings>>();
container.Register<IRepository<RequestedModel>, GenericRepository<RequestedModel>>();
}

@ -61,7 +61,7 @@ function buildTvShowRequestContext(result) {
var context = {
posterPath: result.posterPath,
id: result.tmdbid,
title: result.name,
title: result.title,
overview: result.overview,
year: year,
type: "tv",

@ -25,10 +25,12 @@
// ************************************************************************/
#endregion
using System.Dynamic;
using System.Linq;
using System.Web.UI;
using Nancy;
using Nancy.Extensions;
using Nancy.ModelBinding;
using Nancy.Responses.Negotiation;
using Nancy.Security;
using RequestPlex.Api;
@ -40,38 +42,48 @@ namespace RequestPlex.UI.Modules
{
public class AdminModule : NancyModule
{
public AdminModule(ISettingsService<RequestPlexSettings> service)
private ISettingsService<RequestPlexSettings> RpService { get; set; }
private ISettingsService<CouchPotatoSettings> CpService { get; set; }
public AdminModule(ISettingsService<RequestPlexSettings> rpService, ISettingsService<CouchPotatoSettings> cpService ) : base("admin")
{
RpService = rpService;
CpService = cpService;
#if !DEBUG
this.RequiresAuthentication();
#endif
Get["admin/"] = _ =>
{
dynamic model = new ExpandoObject();
model.Errored = Request.Query.error.HasValue;
model.Port = null;
Get["/"] = _ => Admin();
var settings = service.GetSettings();
if (settings != null)
{
model.Port = settings.Port;
model.PlexAuthToken = settings.PlexAuthToken;
Post["/"] = _ => SaveAdmin();
Post["/requestauth"] = _ => RequestAuthToken();
Get["/getusers"] = _ => GetUsers();
Get["/couchpotato"] = _ => CouchPotato();
Post["/couchpotato"] = _ => SaveCouchPotato();
}
private Negotiator Admin()
{
dynamic model = new ExpandoObject();
var settings = RpService.GetSettings();
model = settings;
return View["/Admin/Settings", model];
};
}
Post["admin/"] = _ =>
private Response SaveAdmin()
{
var model = this.Bind<RequestPlexSettings>();
service.SaveSettings(model);
RpService.SaveSettings(model);
return Context.GetRedirect("~/admin");
};
}
Post["admin/requestauth"] = _ =>
private Response RequestAuthToken()
{
var user = this.Bind<PlexAuth>();
@ -82,11 +94,11 @@ namespace RequestPlex.UI.Modules
var plex = new PlexApi();
var model = plex.GetToken(user.username, user.password);
var oldSettings = service.GetSettings();
var oldSettings = RpService.GetSettings();
if (oldSettings != null)
{
oldSettings.PlexAuthToken = model.user.authentication_token;
service.SaveSettings(oldSettings);
RpService.SaveSettings(oldSettings);
}
else
{
@ -94,22 +106,38 @@ namespace RequestPlex.UI.Modules
{
PlexAuthToken = model.user.authentication_token
};
service.SaveSettings(newModel);
RpService.SaveSettings(newModel);
}
return Response.AsJson(new {Result = true, AuthToken = model.user.authentication_token});
}
return Context.GetRedirect("~/admin");
};
Get["admin/getusers"] = _ =>
private Response GetUsers()
{
var token = RpService.GetSettings().PlexAuthToken;
var api = new PlexApi();
var users = api.GetUsers(token);
var usernames = users.User.Select(x => x.Username);
return Response.AsJson(usernames); //TODO usernames are not populated.
}
private Negotiator CouchPotato()
{
dynamic model = new ExpandoObject();
var settings = CpService.GetSettings();
model = settings;
return View["/Admin/Settings"];
};
return View["/Admin/CouchPotato", model];
}
private Response SaveCouchPotato()
{
var couchPotatoSettings = this.Bind<CouchPotatoSettings>();
CpService.SaveSettings(couchPotatoSettings);
return Context.GetRedirect("~/admin/couchpotato");
}
}
}

@ -1,11 +1,9 @@
using System;
using System.Diagnostics;
using Microsoft.Owin.Hosting;
using Mono.Data.Sqlite;
using Nancy.Hosting.Self;
using RequestPlex.Core;
using RequestPlex.Core.SettingModels;
using RequestPlex.Helpers;
@ -18,6 +16,8 @@ namespace RequestPlex.UI
{
static void Main(string[] args)
{
var assemblyVer = AssemblyHelper.GetAssemblyVersion();
Console.WriteLine($"Version: {assemblyVer}");
var uri = "http://localhost:3579/";
var s = new Setup();
s.SetupDb();
@ -32,8 +32,8 @@ namespace RequestPlex.UI
using (WebApp.Start<Startup>(uri))
{
Console.WriteLine("Running on {0}", uri);
Console.WriteLine("Press enter to exit");
Console.WriteLine($"Request Plex is running on {uri}");
Console.WriteLine("Press any key to exit");
Console.ReadLine();
}
}

@ -38,7 +38,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -70,8 +70,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Assemblies\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="Nancy">
<HintPath>..\packages\Nancy.1.4.1\lib\net40\Nancy.dll</HintPath>
<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="Nancy.Authentication.Basic, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Authentication.Basic.1.4.1\lib\net40\Nancy.Authentication.Basic.dll</HintPath>
@ -213,6 +214,9 @@
<Content Include="Views\Requests\Index.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Views\Admin\CouchPotato.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Web.Debug.config">
<DependentUpon>web.config</DependentUpon>
</None>
@ -220,9 +224,7 @@
<DependentUpon>web.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Auth\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\RequestPlex.Api\RequestPlex.Api.csproj">
<Project>{8cb8d235-2674-442d-9c6a-35fcaeeb160d}</Project>

@ -0,0 +1,69 @@
@Html.Partial("/Admin/_Sidebar")
@{
int port;
if (Model.Port == 0)
{
port = 5050;
}
else
{
port = Model.Port;
}
}
<div class="col-sm-8">
<form class="form-horizontal" method="POST" id="mainForm">
<fieldset>
<legend>CouchPotato Settings</legend>
<div class="form-group">
<label for="Enabled" class="col-lg-2 control-label">Enable CouchPotato</label>
<div class="col-lg-10 checkbox">
<label>
@if (Model.Enabled)
{
<input type="checkbox" id="Enabled" name="Enabled" checked="checked">
}
else
{
<input type="checkbox" id="Enabled" name="Enabled">
}
</label>
</div>
</div>
<div class="form-group">
<label for="Ip" class="col-lg-2 control-label">CouchPotato Hostname or IP</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="Ip" name="Ip" placeholder="localhost" value="@Model.Ip">
</div>
</div>
<div class="form-group">
<label for="portNumber" class="col-lg-2 control-label">Port</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="portNumber" name="Port" placeholder="Port Number" value="@port">
</div>
</div>
<div class="form-group">
<label for="ApiKey" class="col-lg-2 control-label">CouchPotato API Key</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="ApiKey" name="ApiKey" value="@Model.ApiKey">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</fieldset>
</form>
</div>

@ -11,35 +11,69 @@
port = Model.Port;
}
if (Model.PlexAuthToken == null)
{
authToken = string.Empty;
}
else
{
authToken = Model.PlexAuthToken;
}
}
<div class="col-sm-8">
<form class="form-horizontal" method="POST" id="mainForm">
<form class="form-horizontal" method="POST" action="/admin/couchpotato" id="mainForm">
<fieldset>
<legend>Request Plex Settings</legend>
<div class="form-group">
<label for="portNumber" class="col-lg-2 control-label">Port</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="portNumber" name="Port" placeholder="Port Number" value="@port">
</div>
</div>
<small class="col-lg-10 col-lg-offset-2">You will have to restart after changing the port.</small>
<div class="form-group">
<label for="SearchForMovies" class="col-lg-2 control-label">Search for Movies</label>
<div class="col-lg-10 checkbox">
<label>
@if (Model.SearchForMovies)
{
<input type="checkbox" id="SearchForMovies" name="SearchForMovies" checked="checked">
}
else
{
<input type="checkbox" id="SearchForMovies" name="SearchForMovies">
}
</label>
</div>
</div>
<div class="form-group">
<label for="SearchForTvShows" class="col-lg-2 control-label">Search for TV Shows</label>
<div class="col-lg-10 checkbox">
<label>
@if (Model.SearchForTvShows)
{
<input type="checkbox" id="SearchForTvShows" name="SearchForTvShows" checked="checked">
}
else
{
<input type="checkbox" id="SearchForTvShows" name="SearchForTvShows">
}
</label>
</div>
</div>
<div class="form-group">
<label for="WeeklyRequestLimit" class="col-lg-2 control-label">Weekly Request Limit</label>
<div class="col-lg-10 checkbox">
<label>
<input type="number" id="WeeklyRequestLimit" name="WeeklyRequestLimit" value="@Model.WeeklyRequestLimit">
</label>
</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">
<input type="text" class="form-control" id="authToken" name="PlexAuthToken" placeholder="Plex Auth Token" value="@Model.PlexAuthToken">
</div>
</div>
<div class="form-group">
<label for="userpass" class="col-lg-2 control-label">Username and Password</label>
<label for="username" 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>
@ -55,14 +89,30 @@
<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 class="col-lg-4 checkbox">
<label>
@if (Model.UserAuthentication)
{
<input type="checkbox" id="userAuth" name="UserAuthentication" checked="checked">
}
else
{
<input type="checkbox" id="userAuth" name="UserAuthentication">
}
</label>
</div>
</div>
<small>Current users that are allowed to authenticate: </small>
<select id="users" multiple="" class="form-control"></select>
<br />
<br />
<small class="col-lg-offset-2">Current users that are allowed to authenticate: </small>
<br />
<br />
<div class="form-group">
<select id="users" multiple="" class="col-lg-10 col-lg-offset-2"></select>
</div>
<div class="form-group">
<br />
<br />
<div class="col-lg-10 col-lg-offset-2">
<button id="refreshUsers" class="btn btn-primary">Refresh Users</button>
</div>
@ -73,11 +123,9 @@
<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="col-lg-10 col-lg-offset-2">
<button type="reset" class="btn btn-default">Cancel</button>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
@ -86,14 +134,6 @@
</div>
@if (Model.Errored)
{
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert"><i class="fa fa-times"></i></button>
Please enter in a correct port number
</div>
}
<script>
$(function () {
@ -106,6 +146,7 @@
});
$('#requestToken').click(function (e) {
e.preventDefault();
var $form = $("#mainForm");
$.ajax({
type: $form.prop("method"),
@ -114,11 +155,11 @@
dataType: "json",
success: function (response) {
console.log(response);
if (response.Result === true) {
if (response.result === true) {
generateNotify("Success!", "success");
$('#authToken').val(response.authToken);
} else {
generateNotify(response.Message, "warning");
generateNotify(response.message, "warning");
}
},
error: function (e) {
@ -136,9 +177,13 @@
url: "admin/getusers",
dataType: "json",
success: function (response) {
response.each(function (user) {
if (response.length > 1) {
response.each(function(user) {
$('#users').append("<option>" + user + "</option>");
});
} else {
$('#users').append("<option>No Users!</option>");
}
},
error: function (e) {
console.log(e);

@ -1,8 +1,8 @@
<div class="col-lg-3 col-md-3 col-sm-4">
<div class="list-group table-of-contents">
<a class="list-group-item" href="/admin">Request Plex 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="/sickbeard">Sickbeard Settings</a>
<a class="list-group-item" href="/admin/couchpotato">CouchPotato Settings</a>
<a class="list-group-item" href="/admin/sonarr">Sonarr Settings</a>
<a class="list-group-item" href="/admin/sickbeard">Sickbeard Settings</a>
</div>
</div>

@ -49,9 +49,11 @@
</div>
<div class="col-sm-2 col-sm-push-3">
<span class="label label-success">{{status}}</span>
<br />
<br />
<form method="POST" action="/search/request/{{type}}" id="form{{id}}">
<input name="{{type}}Id" type="text" value="{{id}}" hidden="hidden" />
<button id="{{id}}" style="text-align: right" class="btn btn-primary requestMovie" type="submit"><i class="fa fa-plus"></i> TestBtn</button>
<button id="{{id}}" style="text-align: right" class="btn btn-danger" type="submit"><i class="fa fa-plus"></i> Remove</button>
</form>
</div>

@ -1,5 +1,6 @@
<div>
<h2>Search</h2>
<h4>Want to wacth something that is not currently on Plex?! No problem! Just search for it below and request it!</h4>
<!-- Nav tabs -->
<ul id="nav-tabs" class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#MoviesTab" aria-controls="home" role="tab" data-toggle="tab">Movies</a></li>

@ -28,4 +28,12 @@
</providers>
</roleManager>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -4,7 +4,7 @@
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net452" />
<package id="Nancy" version="1.4.1" requireReinstallation="true" />
<package id="Nancy" version="1.4.3" targetFramework="net452" />
<package id="Nancy.Authentication.Basic" version="1.4.1" targetFramework="net452" />
<package id="Nancy.Authentication.Forms" version="1.4.1" targetFramework="net452" />
<package id="Nancy.Hosting.Self" version="1.4.1" requireReinstallation="true" />

Loading…
Cancel
Save