mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-08 06:00:50 -07:00
merge changes from main dev branch. fix up requestedmodel users null issue.
This commit is contained in:
commit
a028a68a08
11 changed files with 167 additions and 23 deletions
|
@ -33,7 +33,7 @@ namespace PlexRequests.Core.SettingModels
|
||||||
{
|
{
|
||||||
public class HeadphonesSettings : Settings
|
public class HeadphonesSettings : Settings
|
||||||
{
|
{
|
||||||
public string Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public string Ip { get; set; }
|
public string Ip { get; set; }
|
||||||
public int Port { get; set; }
|
public int Port { get; set; }
|
||||||
public int ApiKey { get; set; }
|
public int ApiKey { get; set; }
|
||||||
|
|
|
@ -36,8 +36,10 @@ namespace PlexRequests.Core.SettingModels
|
||||||
|
|
||||||
public bool SearchForMovies { get; set; }
|
public bool SearchForMovies { get; set; }
|
||||||
public bool SearchForTvShows { get; set; }
|
public bool SearchForTvShows { get; set; }
|
||||||
|
public bool SearchForMusic { get; set; }
|
||||||
public bool RequireMovieApproval { get; set; }
|
public bool RequireMovieApproval { get; set; }
|
||||||
public bool RequireTvShowApproval { get; set; }
|
public bool RequireTvShowApproval { get; set; }
|
||||||
|
public bool RequireMusicApproval { get; set; }
|
||||||
public bool UsersCanViewOnlyOwnRequests { get; set; }
|
public bool UsersCanViewOnlyOwnRequests { get; set; }
|
||||||
public int WeeklyRequestLimit { get; set; }
|
public int WeeklyRequestLimit { get; set; }
|
||||||
public string NoApprovalUsers { get; set; }
|
public string NoApprovalUsers { get; set; }
|
||||||
|
|
|
@ -10,6 +10,11 @@ namespace PlexRequests.Store
|
||||||
[Table("Requested")]
|
[Table("Requested")]
|
||||||
public class RequestedModel : Entity
|
public class RequestedModel : Entity
|
||||||
{
|
{
|
||||||
|
public RequestedModel()
|
||||||
|
{
|
||||||
|
RequestedUsers = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
// ReSharper disable once IdentifierTypo
|
// ReSharper disable once IdentifierTypo
|
||||||
public int ProviderId { get; set; }
|
public int ProviderId { get; set; }
|
||||||
public string ImdbId { get; set; }
|
public string ImdbId { get; set; }
|
||||||
|
@ -48,7 +53,8 @@ namespace PlexRequests.Store
|
||||||
public enum RequestType
|
public enum RequestType
|
||||||
{
|
{
|
||||||
Movie,
|
Movie,
|
||||||
TvShow
|
TvShow,
|
||||||
|
Album
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum IssueState
|
public enum IssueState
|
||||||
|
|
|
@ -140,6 +140,42 @@ label {
|
||||||
#tvList .mix {
|
#tvList .mix {
|
||||||
display: none; }
|
display: none; }
|
||||||
|
|
||||||
|
.scroll-top-wrapper {
|
||||||
|
position: fixed;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: center;
|
||||||
|
z-index: 99999999;
|
||||||
|
background-color: #4e5d6c;
|
||||||
|
color: #eeeeee;
|
||||||
|
width: 50px;
|
||||||
|
height: 48px;
|
||||||
|
line-height: 48px;
|
||||||
|
right: 30px;
|
||||||
|
bottom: 30px;
|
||||||
|
padding-top: 2px;
|
||||||
|
border-top-left-radius: 10px;
|
||||||
|
border-top-right-radius: 10px;
|
||||||
|
border-bottom-right-radius: 10px;
|
||||||
|
border-bottom-left-radius: 10px;
|
||||||
|
-webkit-transition: all 0.5s ease-in-out;
|
||||||
|
-moz-transition: all 0.5s ease-in-out;
|
||||||
|
-ms-transition: all 0.5s ease-in-out;
|
||||||
|
-o-transition: all 0.5s ease-in-out;
|
||||||
|
transition: all 0.5s ease-in-out; }
|
||||||
|
|
||||||
|
.scroll-top-wrapper:hover {
|
||||||
|
background-color: #637689; }
|
||||||
|
|
||||||
|
.scroll-top-wrapper.show {
|
||||||
|
visibility: visible;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 1.0; }
|
||||||
|
|
||||||
|
.scroll-top-wrapper i.fa {
|
||||||
|
line-height: inherit; }
|
||||||
|
|
||||||
.no-search-results {
|
.no-search-results {
|
||||||
text-align: center; }
|
text-align: center; }
|
||||||
|
|
||||||
|
@ -150,4 +186,4 @@ label {
|
||||||
.no-search-results .no-search-results-text {
|
.no-search-results .no-search-results-text {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
color: #ccc; }
|
color: #ccc; }
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
$form-color: #4e5d6c;
|
$form-color: #4e5d6c;
|
||||||
|
$form-color-lighter: #637689;
|
||||||
$primary-colour: #df691a;
|
$primary-colour: #df691a;
|
||||||
$primary-colour-outline: #ff761b;
|
$primary-colour-outline: #ff761b;
|
||||||
$info-colour: #5bc0de;
|
$info-colour: #5bc0de;
|
||||||
|
@ -175,13 +176,53 @@ label {
|
||||||
}
|
}
|
||||||
|
|
||||||
#movieList .mix {
|
#movieList .mix {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tvList .mix {
|
#tvList .mix {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$border-radius: 10px;
|
||||||
|
|
||||||
|
.scroll-top-wrapper {
|
||||||
|
position: fixed;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: center;
|
||||||
|
z-index: 99999999;
|
||||||
|
background-color: $form-color;
|
||||||
|
color: #eeeeee;
|
||||||
|
width: 50px;
|
||||||
|
height: 48px;
|
||||||
|
line-height: 48px;
|
||||||
|
right: 30px;
|
||||||
|
bottom: 30px;
|
||||||
|
padding-top: 2px;
|
||||||
|
border-top-left-radius: $border-radius;
|
||||||
|
border-top-right-radius: $border-radius;
|
||||||
|
border-bottom-right-radius: $border-radius;
|
||||||
|
border-bottom-left-radius: $border-radius;
|
||||||
|
-webkit-transition: all 0.5s ease-in-out;
|
||||||
|
-moz-transition: all 0.5s ease-in-out;
|
||||||
|
-ms-transition: all 0.5s ease-in-out;
|
||||||
|
-o-transition: all 0.5s ease-in-out;
|
||||||
|
transition: all 0.5s ease-in-out;
|
||||||
|
}
|
||||||
|
.scroll-top-wrapper:hover {
|
||||||
|
background-color: $form-color-lighter;
|
||||||
|
}
|
||||||
|
.scroll-top-wrapper.show {
|
||||||
|
visibility:visible;
|
||||||
|
cursor:pointer;
|
||||||
|
opacity: 1.0;
|
||||||
|
}
|
||||||
|
.scroll-top-wrapper i.fa {
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.no-search-results {
|
.no-search-results {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
@ -194,4 +235,4 @@ label {
|
||||||
.no-search-results .no-search-results-text {
|
.no-search-results .no-search-results-text {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
}
|
}
|
|
@ -59,7 +59,7 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
public class AdminModule : NancyModule
|
public class AdminModule : NancyModule
|
||||||
{
|
{
|
||||||
private ISettingsService<PlexRequestSettings> RpService { get; }
|
private ISettingsService<PlexRequestSettings> PrService { get; }
|
||||||
private ISettingsService<CouchPotatoSettings> CpService { get; }
|
private ISettingsService<CouchPotatoSettings> CpService { get; }
|
||||||
private ISettingsService<AuthenticationSettings> AuthService { get; }
|
private ISettingsService<AuthenticationSettings> AuthService { get; }
|
||||||
private ISettingsService<PlexSettings> PlexService { get; }
|
private ISettingsService<PlexSettings> PlexService { get; }
|
||||||
|
@ -78,7 +78,7 @@ namespace PlexRequests.UI.Modules
|
||||||
private INotificationService NotificationService { get; }
|
private INotificationService NotificationService { get; }
|
||||||
|
|
||||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||||
public AdminModule(ISettingsService<PlexRequestSettings> rpService,
|
public AdminModule(ISettingsService<PlexRequestSettings> prService,
|
||||||
ISettingsService<CouchPotatoSettings> cpService,
|
ISettingsService<CouchPotatoSettings> cpService,
|
||||||
ISettingsService<AuthenticationSettings> auth,
|
ISettingsService<AuthenticationSettings> auth,
|
||||||
ISettingsService<PlexSettings> plex,
|
ISettingsService<PlexSettings> plex,
|
||||||
|
@ -96,7 +96,7 @@ namespace PlexRequests.UI.Modules
|
||||||
INotificationService notify,
|
INotificationService notify,
|
||||||
ISettingsService<HeadphonesSettings> headphones) : base("admin")
|
ISettingsService<HeadphonesSettings> headphones) : base("admin")
|
||||||
{
|
{
|
||||||
RpService = rpService;
|
PrService = prService;
|
||||||
CpService = cpService;
|
CpService = cpService;
|
||||||
AuthService = auth;
|
AuthService = auth;
|
||||||
PlexService = plex;
|
PlexService = plex;
|
||||||
|
@ -186,7 +186,7 @@ namespace PlexRequests.UI.Modules
|
||||||
|
|
||||||
private Negotiator Admin()
|
private Negotiator Admin()
|
||||||
{
|
{
|
||||||
var settings = RpService.GetSettings();
|
var settings = PrService.GetSettings();
|
||||||
Log.Trace("Getting Settings:");
|
Log.Trace("Getting Settings:");
|
||||||
Log.Trace(settings.DumpJson());
|
Log.Trace(settings.DumpJson());
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
var model = this.Bind<PlexRequestSettings>();
|
var model = this.Bind<PlexRequestSettings>();
|
||||||
|
|
||||||
RpService.SaveSettings(model);
|
PrService.SaveSettings(model);
|
||||||
|
|
||||||
|
|
||||||
return Context.GetRedirect("~/admin");
|
return Context.GetRedirect("~/admin");
|
||||||
|
|
|
@ -131,7 +131,8 @@ namespace PlexRequests.UI.Modules
|
||||||
}
|
}
|
||||||
|
|
||||||
var viewModel = dbTv.Select(tv => {
|
var viewModel = dbTv.Select(tv => {
|
||||||
if (!string.IsNullOrEmpty(tv.RequestedBy) && !tv.RequestedUsers.Any(x => x.Equals(tv.RequestedBy, StringComparison.OrdinalIgnoreCase)))
|
if (!string.IsNullOrEmpty(tv.RequestedBy) &&
|
||||||
|
!tv.RequestedUsers.Any(x => x.Equals(tv.RequestedBy, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
tv.RequestedUsers.Add(tv.RequestedBy);
|
tv.RequestedUsers.Add(tv.RequestedBy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,7 +170,7 @@ namespace PlexRequests.UI.Modules
|
||||||
var users = Api.GetUsers(authToken);
|
var users = Api.GetUsers(authToken);
|
||||||
Log.Debug("Plex Users: ");
|
Log.Debug("Plex Users: ");
|
||||||
Log.Debug(users.DumpJson());
|
Log.Debug(users.DumpJson());
|
||||||
var allUsers = users.User?.Where(x => !string.IsNullOrEmpty(x.Username));
|
var allUsers = users?.User?.Where(x => !string.IsNullOrEmpty(x.Username));
|
||||||
return allUsers != null && allUsers.Any(x => x.Username.Equals(username, StringComparison.CurrentCultureIgnoreCase));
|
return allUsers != null && allUsers.Any(x => x.Username.Equals(username, StringComparison.CurrentCultureIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace PlexRequests.UI
|
||||||
if (port == -1)
|
if (port == -1)
|
||||||
port = GetStartupPort();
|
port = GetStartupPort();
|
||||||
|
|
||||||
var options = new StartOptions(Debugger.IsAttached ? $"http://localhost:{port}" : $"http://+:{port}")
|
var options = new StartOptions( $"http://+:{port}")
|
||||||
{
|
{
|
||||||
ServerFactory = "Microsoft.Owin.Host.HttpListener"
|
ServerFactory = "Microsoft.Owin.Host.HttpListener"
|
||||||
};
|
};
|
||||||
|
|
|
@ -52,6 +52,20 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
@if (Model.SearchForMusic)
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="SearchForMusic" name="SearchForMusic" checked="checked"><text>Search for Music</text>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="SearchForMusic" name="SearchForMusic"><text>Search for Music</text>
|
||||||
|
}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
|
@ -82,6 +96,21 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
@if (Model.RequireMusicApproval)
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="RequireMusicApproval" name="RequireMusicApproval" checked="checked"><text>Require approval of Music requests</text>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="checkbox" id="RequireMusicApproval" name="RequireMusicApproval"><text>Require approval of Music requests</text>
|
||||||
|
}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="form-group">A comma separated list of users whose requests do not require approval.</p>
|
<p class="form-group">A comma separated list of users whose requests do not require approval.</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -108,13 +137,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@*<div class="form-group">
|
@*<div class="form-group">
|
||||||
<label for="WeeklyRequestLimit" class="control-label">Weekly Request Limit</label>
|
<label for="WeeklyRequestLimit" class="control-label">Weekly Request Limit</label>
|
||||||
<div>
|
<div>
|
||||||
<label>
|
<label>
|
||||||
<input type="number" id="WeeklyRequestLimit" name="WeeklyRequestLimit" class="form-control form-control-custom " value="@Model.WeeklyRequestLimit">
|
<input type="number" id="WeeklyRequestLimit" name="WeeklyRequestLimit" class="form-control form-control-custom " value="@Model.WeeklyRequestLimit">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div> //TODO: Need to implement this*@
|
</div> //TODO: Need to implement this*@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -87,8 +87,37 @@
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@RenderBody()
|
@RenderBody()
|
||||||
|
</div>
|
||||||
|
<div class="scroll-top-wrapper ">
|
||||||
|
<span class="scroll-top-inner">
|
||||||
|
<i class="fa fa-2x fa-arrow-circle-up"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
|
||||||
|
$(document).on('scroll', function () {
|
||||||
|
|
||||||
|
if ($(window).scrollTop() > 100) {
|
||||||
|
$('.scroll-top-wrapper').addClass('show');
|
||||||
|
} else {
|
||||||
|
$('.scroll-top-wrapper').removeClass('show');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.scroll-top-wrapper').on('click', scrollToTop);
|
||||||
|
});
|
||||||
|
|
||||||
|
function scrollToTop() {
|
||||||
|
verticalOffset = typeof (verticalOffset) != 'undefined' ? verticalOffset : 0;
|
||||||
|
element = $('body');
|
||||||
|
offset = element.offset();
|
||||||
|
offsetTop = offset.top;
|
||||||
|
$('html, body').animate({ scrollTop: offsetTop }, 500, 'linear');
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue