mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 10:36:54 -07:00
Moved the plex auth token to the plex settings where it should belong.
This commit is contained in:
parent
ffe6bc41ac
commit
57ec940d5a
18 changed files with 2753 additions and 2837 deletions
|
@ -1,184 +1,139 @@
|
|||
@using PlexRequests.UI.Helpers
|
||||
@Html.Partial("_Sidebar")
|
||||
|
||||
@{
|
||||
var baseUrl = Html.GetBaseUrl();
|
||||
var formAction = "/admin/authentication";
|
||||
if (!string.IsNullOrEmpty(baseUrl.ToHtmlString()))
|
||||
{
|
||||
formAction = "/" + baseUrl.ToHtmlString() + formAction;
|
||||
}
|
||||
}
|
||||
<div class="col-sm-8 col-sm-push-1">
|
||||
<form class="form-horizontal" method="POST" action="@formAction" id="mainForm">
|
||||
<fieldset>
|
||||
<legend>Authentication Settings</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.UserAuthentication)
|
||||
{
|
||||
<input type="checkbox" id="userAuth" name="UserAuthentication" checked="checked">
|
||||
<label for="userAuth">Enable User Authentication</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="userAuth" name="UserAuthentication">
|
||||
<label for="userAuth">Enable User Authentication</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.UsePassword)
|
||||
{
|
||||
<input type="checkbox" id="UsePassword" name="UsePassword" checked="checked">
|
||||
<label for="UsePassword">Require users to login with their passwords</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="UsePassword" name="UsePassword">
|
||||
<label for="UsePassword">Require users to login with their passwords</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="authToken" class="control-label">Plex Authorization Token</label>
|
||||
<div class="">
|
||||
<input type="text" class="form-control-custom form-control" id="authToken" name="PlexAuthToken" placeholder="Plex Auth Token" value="@Model.PlexAuthToken">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="username" class="control-label">Username and Password</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom" id="username" name="Username" placeholder="username">
|
||||
</div>
|
||||
<br/>
|
||||
<div>
|
||||
<input type="password" class="form-control form-control-custom" id="password" name="Password" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="">
|
||||
<button id="requestToken" class="btn btn-primary-outline">Request Token <i class="fa fa-key"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<p class="form-group">Current users that are allowed to authenticate: </p>
|
||||
|
||||
<div class="form-group">
|
||||
<select id="users" multiple="" class="form-control-custom" style="height: 180px;"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
<div>
|
||||
<button id="refreshUsers" class="btn btn-primary-outline">Refresh Users</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="form-group">A comma separated list of users that you do not want to login.</p>
|
||||
<div class="form-group">
|
||||
<label for="deniedUsers" class="control-label">Denied Users</label>
|
||||
<div >
|
||||
<input type="text" class="form-control-custom form-control " id="DeniedUsers" name="DeniedUsers" placeholder="e.g. John, Bobby" value="@Model.DeniedUsers">
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary-outline">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
|
||||
if ($('#PlexAuthToken')) {
|
||||
loadUserList();
|
||||
}
|
||||
|
||||
$('#refreshUsers').click(function (e) {
|
||||
e.preventDefault();
|
||||
loadUserList();
|
||||
});
|
||||
|
||||
$('#requestToken').click(function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: "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() {
|
||||
$('#users').html("");
|
||||
var url = "getusers";
|
||||
$.ajax({
|
||||
type: "Get",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
|
||||
$('#users').html("");
|
||||
if(!response.result){
|
||||
generateNotify(response.message,"danger");
|
||||
$('#users').append("<option>Error!</option>");
|
||||
return;
|
||||
}
|
||||
if (response.users.length > 0) {
|
||||
$(response.users).each(function () {
|
||||
$('#users').append("<option>" + this + "</option>");
|
||||
});
|
||||
} else {
|
||||
$('#users').append("<option>No Users, Please refresh!</option>");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
$('#users').html("");
|
||||
$('#users').append("<option>Error!</option>");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
@using PlexRequests.UI.Helpers
|
||||
@Html.Partial("_Sidebar")
|
||||
|
||||
@{
|
||||
var baseUrl = Html.GetBaseUrl();
|
||||
var formAction = "/admin/authentication";
|
||||
if (!string.IsNullOrEmpty(baseUrl.ToHtmlString()))
|
||||
{
|
||||
formAction = "/" + baseUrl.ToHtmlString() + formAction;
|
||||
}
|
||||
}
|
||||
<div class="col-sm-8 col-sm-push-1">
|
||||
<form class="form-horizontal" method="POST" action="@formAction" id="mainForm">
|
||||
<fieldset>
|
||||
<legend>Authentication Settings</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.UserAuthentication)
|
||||
{
|
||||
<input type="checkbox" id="userAuth" name="UserAuthentication" checked="checked">
|
||||
<label for="userAuth">Enable User Authentication</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="userAuth" name="UserAuthentication">
|
||||
<label for="userAuth">Enable User Authentication</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.UsePassword)
|
||||
{
|
||||
<input type="checkbox" id="UsePassword" name="UsePassword" checked="checked">
|
||||
<label for="UsePassword">Require users to login with their passwords</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="UsePassword" name="UsePassword">
|
||||
<label for="UsePassword">Require users to login with their passwords</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<p class="form-group">Current users that are allowed to authenticate: </p>
|
||||
|
||||
<div class="form-group">
|
||||
<select id="users" multiple="" class="form-control-custom" style="height: 180px;"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
<div>
|
||||
<button id="refreshUsers" class="btn btn-primary-outline">Refresh Users</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="form-group">A comma separated list of users that you do not want to login.</p>
|
||||
<div class="form-group">
|
||||
<label for="deniedUsers" class="control-label">Denied Users</label>
|
||||
<div >
|
||||
<input type="text" class="form-control-custom form-control " id="DeniedUsers" name="DeniedUsers" placeholder="e.g. John, Bobby" value="@Model.DeniedUsers">
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary-outline">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
|
||||
if ($('#PlexAuthToken')) {
|
||||
loadUserList();
|
||||
}
|
||||
|
||||
$('#refreshUsers').click(function (e) {
|
||||
e.preventDefault();
|
||||
loadUserList();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function loadUserList() {
|
||||
$('#users').html("");
|
||||
var url = "getusers";
|
||||
$.ajax({
|
||||
type: "Get",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
|
||||
$('#users').html("");
|
||||
if(!response.result){
|
||||
generateNotify(response.message,"danger");
|
||||
$('#users').append("<option>Error!</option>");
|
||||
return;
|
||||
}
|
||||
if (response.users.length > 0) {
|
||||
$(response.users).each(function () {
|
||||
$('#users').append("<option>" + this + "</option>");
|
||||
});
|
||||
} else {
|
||||
$('#users').append("<option>No Users, Please refresh!</option>");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
$('#users').html("");
|
||||
$('#users').append("<option>Error!</option>");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
</script>
|
|
@ -1,153 +1,201 @@
|
|||
@using PlexRequests.UI.Helpers
|
||||
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<PlexRequests.Core.SettingModels.PlexSettings>
|
||||
@Html.Partial("_Sidebar")
|
||||
@{
|
||||
int port;
|
||||
if (Model.Port == 0)
|
||||
{
|
||||
port = 32400;
|
||||
}
|
||||
else
|
||||
{
|
||||
port = Model.Port;
|
||||
}
|
||||
}
|
||||
<div class="col-sm-8 col-sm-push-1">
|
||||
<form class="form-horizontal" method="POST" id="mainForm">
|
||||
<fieldset>
|
||||
<legend>Plex Settings</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="Ip" class="control-label">Plex Hostname or IP</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="Ip" name="Ip" placeholder="localhost" value="@Model.Ip">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="portNumber" class="control-label">Port</label>
|
||||
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="portNumber" name="Port" placeholder="Port Number" value="@port">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.Ssl)
|
||||
{
|
||||
<input type="checkbox" id="Ssl" name="Ssl" checked="checked"><label for="Ssl">SSL</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="Ssl" name="Ssl"><label for="Ssl">SSL</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.AdvancedSearch)
|
||||
{
|
||||
<input type="checkbox" id="AdvancedSearch" name="AdvancedSearch" checked="checked"><label for="AdvancedSearch">Use Advanced Search</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="AdvancedSearch" name="AdvancedSearch"><label for="AdvancedSearch">Use Advanced Search</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
<small>If enabled we will be able to have a 100% accurate match, but we will be querying Plex for every single item in your library. So if you have a big library then this could take some time.</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="SubDir" class="control-label">Plex SubDirectory</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="SubDir" name="SubDir" value="@Model.SubDir">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button id="testPlex" type="submit" class="btn btn-primary-outline">Test Connectivity <div id="spinner"></div></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button id="save" type="submit" class="btn btn-primary-outline">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
|
||||
$('#testPlex').click(function (e) {
|
||||
e.preventDefault();
|
||||
var url = createBaseUrl(base, '/test/plex');
|
||||
var $form = $("#mainForm");
|
||||
|
||||
$('#spinner').attr("class", "fa fa-spinner fa-spin");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
$('#spinner').attr("class", "");
|
||||
console.log(response);
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message, "success");
|
||||
|
||||
$('#spinner').attr("class", "fa fa-check");
|
||||
$('#authToken').val(response.authToken);
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#save').click(function (e) {
|
||||
e.preventDefault();
|
||||
var port = $('#portNumber').val();
|
||||
if (isNaN(port)) {
|
||||
generateNotify("You must specify a Port.", "warning");
|
||||
return;
|
||||
}
|
||||
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
data: $form.serialize(),
|
||||
url: $form.prop("action"),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message, "success");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@using PlexRequests.UI.Helpers
|
||||
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<PlexRequests.Core.SettingModels.PlexSettings>
|
||||
@Html.Partial("_Sidebar")
|
||||
@{
|
||||
int port;
|
||||
if (Model.Port == 0)
|
||||
{
|
||||
port = 32400;
|
||||
}
|
||||
else
|
||||
{
|
||||
port = Model.Port;
|
||||
}
|
||||
}
|
||||
<div class="col-sm-8 col-sm-push-1">
|
||||
<form class="form-horizontal" method="POST" id="mainForm">
|
||||
<fieldset>
|
||||
<legend>Plex Settings</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="Ip" class="control-label">Plex Hostname or IP</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="Ip" name="Ip" placeholder="localhost" value="@Model.Ip">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="portNumber" class="control-label">Port</label>
|
||||
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="portNumber" name="Port" placeholder="Port Number" value="@port">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.Ssl)
|
||||
{
|
||||
<input type="checkbox" id="Ssl" name="Ssl" checked="checked"><label for="Ssl">SSL</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="Ssl" name="Ssl"><label for="Ssl">SSL</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
|
||||
@if (Model.AdvancedSearch)
|
||||
{
|
||||
<input type="checkbox" id="AdvancedSearch" name="AdvancedSearch" checked="checked"><label for="AdvancedSearch">Use Advanced Search</label>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="checkbox" id="AdvancedSearch" name="AdvancedSearch"><label for="AdvancedSearch">Use Advanced Search</label>
|
||||
}
|
||||
|
||||
</div>
|
||||
<small>If enabled we will be able to have a 100% accurate match, but we will be querying Plex for every single item in your library. So if you have a big library then this could take some time.</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="SubDir" class="control-label">Plex SubDirectory</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="SubDir" name="SubDir" value="@Model.SubDir">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="authToken" class="control-label">Plex Authorization Token</label>
|
||||
<div class="">
|
||||
<input type="text" class="form-control-custom form-control" id="authToken" name="PlexAuthToken" placeholder="Plex Auth Token" value="@Model.PlexAuthToken">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="username" class="control-label">Username and Password</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom" id="username" name="Username" placeholder="username">
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<input type="password" class="form-control form-control-custom" id="password" name="Password" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="">
|
||||
<button id="requestToken" class="btn btn-primary-outline">Request Token <i class="fa fa-key"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button id="testPlex" type="submit" class="btn btn-primary-outline">Test Connectivity <div id="spinner"></div></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<button id="save" type="submit" class="btn btn-primary-outline">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
|
||||
$('#testPlex').click(function (e) {
|
||||
e.preventDefault();
|
||||
var url = createBaseUrl(base, '/test/plex');
|
||||
var $form = $("#mainForm");
|
||||
|
||||
$('#spinner').attr("class", "fa fa-spinner fa-spin");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
$('#spinner').attr("class", "");
|
||||
console.log(response);
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message, "success");
|
||||
|
||||
$('#spinner').attr("class", "fa fa-check");
|
||||
$('#authToken').val(response.authToken);
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
|
||||
$('#spinner').attr("class", "fa fa-times");
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#requestToken').click(function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
url: "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");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#save').click(function (e) {
|
||||
e.preventDefault();
|
||||
var port = $('#portNumber').val();
|
||||
if (isNaN(port)) {
|
||||
generateNotify("You must specify a Port.", "warning");
|
||||
return;
|
||||
}
|
||||
|
||||
var $form = $("#mainForm");
|
||||
$.ajax({
|
||||
type: $form.prop("method"),
|
||||
data: $form.serialize(),
|
||||
url: $form.prop("action"),
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message, "success");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue