Some plex work

This commit is contained in:
Jamie Rees 2016-02-27 20:21:08 +00:00
commit 10b22cc7ab
8 changed files with 183 additions and 83 deletions

View file

@ -1,6 +1,7 @@
@Html.Partial("/Admin/_Sidebar")
@{
int port;
var authToken = string.Empty;
if (Model.Port == null)
{
port = 3579;
@ -10,10 +11,14 @@
port = Model.Port;
}
//if (string.IsNullOrEmpty(Model.PlexAuthToken))
//{
// Model.PlexAuthToken = string.Empty;
//}
if (Model.PlexAuthToken == null)
{
authToken = string.Empty;
}
else
{
authToken = Model.PlexAuthToken;
}
}
<div class="col-sm-8">
<form class="form-horizontal" method="POST" id="mainForm">
@ -22,24 +27,24 @@
<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="portNumber" placeholder="Port Number" value="@port">
<input type="text" class="form-control" id="portNumber" name="Port" placeholder="Port Number" value="@port">
</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="authToken" placeholder="Plex Auth Token" value="@*@Model.PlexAuthToken*@">
<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">
<input type="text" class="form-control" id="username" name="Username" placeholder="Username">
</div>
<div class="col-lg-4 col-lg-push-1">
<input type="text" class="form-control" id="password" name="password" placeholder="Password">
<input type="password" class="form-control" id="password" name="Username" placeholder="Password">
</div>
</div>
<div class="form-group">
@ -48,8 +53,28 @@
</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>Please note, you will have to restart after changing these settings.</small>
<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">
@ -73,6 +98,12 @@
<script>
$(function () {
loadUserList();
$('#refreshUsers').click(function() {
loadUserList();
});
$('#requestToken').click(function (e) {
var $form = $("#mainForm");
$.ajax({
@ -96,5 +127,26 @@
});
});
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>