mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
Some styling
This commit is contained in:
parent
725678779a
commit
37aa6b938d
9 changed files with 102 additions and 37 deletions
|
@ -75,7 +75,8 @@ namespace PlexRequests.Api
|
||||||
throw new ApplicationException(message, response.ErrorException);
|
throw new ApplicationException(message, response.ErrorException);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Deserialize<T>(response.Content);
|
var result = Deserialize<T>(response.Content);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Deserialize<T>(string input)
|
public T Deserialize<T>(string input)
|
||||||
|
@ -83,8 +84,15 @@ namespace PlexRequests.Api
|
||||||
{
|
{
|
||||||
var ser = new XmlSerializer(typeof(T));
|
var ser = new XmlSerializer(typeof(T));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
using (var sr = new StringReader(input))
|
using (var sr = new StringReader(input))
|
||||||
return (T)ser.Deserialize(sr);
|
return (T)ser.Deserialize(sr);
|
||||||
}
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
38
PlexRequests.Api/Models/PlexError.cs
Normal file
38
PlexRequests.Api/Models/PlexError.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: PlexError.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace PlexRequests.Api.Models
|
||||||
|
{
|
||||||
|
[XmlRoot(ElementName = "errors")]
|
||||||
|
public class PlexError
|
||||||
|
{
|
||||||
|
[XmlElement(ElementName = "error")]
|
||||||
|
public string Error { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -62,6 +62,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ApiRequest.cs" />
|
<Compile Include="ApiRequest.cs" />
|
||||||
<Compile Include="Models\PlexAuthentication.cs" />
|
<Compile Include="Models\PlexAuthentication.cs" />
|
||||||
|
<Compile Include="Models\PlexError.cs" />
|
||||||
<Compile Include="Models\PlexFriends.cs" />
|
<Compile Include="Models\PlexFriends.cs" />
|
||||||
<Compile Include="Models\PlexUserRequest.cs" />
|
<Compile Include="Models\PlexUserRequest.cs" />
|
||||||
<Compile Include="Models\Tv\Authentication.cs" />
|
<Compile Include="Models\Tv\Authentication.cs" />
|
||||||
|
|
|
@ -9,3 +9,12 @@
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.multiSelect {
|
||||||
|
background-color: #4e5d6c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control-custom {
|
||||||
|
background-color: #4e5d6c !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
|
|
@ -117,6 +117,12 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
var plex = new PlexApi();
|
var plex = new PlexApi();
|
||||||
var model = plex.GetToken(user.username, user.password);
|
var model = plex.GetToken(user.username, user.password);
|
||||||
|
|
||||||
|
if (model.user == null)
|
||||||
|
{
|
||||||
|
return Response.AsJson(new { Result = false, Message = "Incorrect username or password!" });
|
||||||
|
}
|
||||||
|
|
||||||
var oldSettings = AuthService.GetSettings();
|
var oldSettings = AuthService.GetSettings();
|
||||||
if (oldSettings != null)
|
if (oldSettings != null)
|
||||||
{
|
{
|
||||||
|
@ -139,8 +145,15 @@ namespace PlexRequests.UI.Modules
|
||||||
private Response GetUsers()
|
private Response GetUsers()
|
||||||
{
|
{
|
||||||
var token = AuthService.GetSettings().PlexAuthToken;
|
var token = AuthService.GetSettings().PlexAuthToken;
|
||||||
|
if (token == null)
|
||||||
|
{
|
||||||
|
return Response.AsJson(string.Empty);
|
||||||
|
}
|
||||||
var api = new PlexApi();
|
var api = new PlexApi();
|
||||||
var users = api.GetUsers(token);
|
var users = api.GetUsers(token);
|
||||||
|
if (users == null)
|
||||||
|
{ return Response.AsJson(string.Empty); }
|
||||||
|
|
||||||
var usernames = users.User.Select(x => x.Username);
|
var usernames = users.User.Select(x => x.Username);
|
||||||
return Response.AsJson(usernames); //TODO usernames are not populated.
|
return Response.AsJson(usernames); //TODO usernames are not populated.
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace PlexRequests.UI
|
||||||
// Step 5. Activate the configuration
|
// Step 5. Activate the configuration
|
||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception )
|
||||||
{
|
{
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@Html.Partial("/Admin/_Sidebar")
|
@Html.Partial("/Admin/_Sidebar")
|
||||||
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<form class="form-horizontal" method="POST" action="/admin/SaveAuthentication" id="mainForm">
|
<form class="form-horizontal" method="POST" action="/admin/authentication" id="mainForm">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Authentication Settings</legend>
|
<legend>Authentication Settings</legend>
|
||||||
|
|
||||||
|
@ -40,17 +40,17 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="authToken" class="col-lg-2 control-label">Plex Authorization Token</label>
|
<label for="authToken" class="col-lg-2 control-label">Plex Authorization Token</label>
|
||||||
<div class="col-lg-10">
|
<div class="col-lg-10">
|
||||||
<input type="text" class="form-control" id="authToken" name="PlexAuthToken" placeholder="Plex Auth Token" value="@Model.PlexAuthToken">
|
<input type="text" class="form-control-custom form-control " id="authToken" name="PlexAuthToken" placeholder="Plex Auth Token" value="@Model.PlexAuthToken">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="username" 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">
|
<div class="col-lg-4">
|
||||||
<input type="text" class="form-control" id="username" name="Username" placeholder="Username">
|
<input type="text" class="form-control form-control-custom" id="username" name="Username" placeholder="Username">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4 col-lg-push-1">
|
<div class="col-lg-4 col-lg-push-2">
|
||||||
<input type="password" class="form-control" id="password" name="Password" placeholder="Password">
|
<input type="password" class="form-control form-control-custom" id="password" name="Password" placeholder="Password">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -66,20 +66,16 @@
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<select id="users" multiple="" class="col-lg-10 col-lg-offset-2"></select>
|
<select id="users" multiple="" class="col-lg-10 col-lg-offset-2 form-control-custom "></select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<div class="col-lg-10 col-lg-offset-2">
|
<div class="col-lg-10 col-lg-offset-2">
|
||||||
<button id="refreshUsers" class="btn btn-primary">Refresh Users</button>
|
<button id="refreshUsers" class="btn btn-primary">Refresh Users</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<div>
|
<div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -137,7 +133,7 @@
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (response.length > 1) {
|
if (response.length > 1) {
|
||||||
$(response).each(function(user) {
|
$(response).each(function() {
|
||||||
$('#users').append("<option>" + this + "</option>");
|
$('#users').append("<option>" + this + "</option>");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Ip" class="col-lg-2 control-label">CouchPotato Hostname or IP</label>
|
<label for="Ip" class="col-lg-2 control-label">CouchPotato Hostname or IP</label>
|
||||||
<div class="col-lg-10">
|
<div class="col-lg-10">
|
||||||
<input type="text" class="form-control" id="Ip" name="Ip" placeholder="localhost" value="@Model.Ip">
|
<input type="text" class="form-control form-control-custom " id="Ip" name="Ip" placeholder="localhost" value="@Model.Ip">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
<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="Port" placeholder="Port Number" value="@port">
|
<input type="text" class="form-control form-control-custom " id="portNumber" name="Port" placeholder="Port Number" value="@port">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="ApiKey" class="col-lg-2 control-label">CouchPotato API Key</label>
|
<label for="ApiKey" class="col-lg-2 control-label">CouchPotato API Key</label>
|
||||||
<div class="col-lg-10">
|
<div class="col-lg-10">
|
||||||
<input type="text" class="form-control" id="ApiKey" name="ApiKey" value="@Model.ApiKey">
|
<input type="text" class="form-control form-control-custom " id="ApiKey" name="ApiKey" value="@Model.ApiKey">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<form class="form-horizontal" method="POST" action="/admin/couchpotato" id="mainForm">
|
<form class="form-horizontal" method="POST" action="/admin" 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="Port" placeholder="Port Number" value="@port">
|
<input type="text" class="form-control form-control-custom " id="portNumber" name="Port" placeholder="Port Number" value="@port">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<small class="col-lg-10 col-lg-offset-2">You will have to restart after changing the port.</small>
|
<small class="col-lg-10 col-lg-offset-2">You will have to restart after changing the port.</small>
|
||||||
|
@ -58,9 +58,9 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="WeeklyRequestLimit" class="col-lg-2 control-label">Weekly Request Limit</label>
|
<label for="WeeklyRequestLimit" class="col-lg-2 control-label">Weekly Request Limit</label>
|
||||||
<div class="col-lg-10 checkbox">
|
<div class="col-lg-10">
|
||||||
<label>
|
<label>
|
||||||
<input type="number" id="WeeklyRequestLimit" name="WeeklyRequestLimit" value="@Model.WeeklyRequestLimit">
|
<input type="number" id="WeeklyRequestLimit" name="WeeklyRequestLimit" class="form-control form-control-custom " value="@Model.WeeklyRequestLimit">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue