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 string Enabled { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public string Ip { get; set; }
|
||||
public int Port { get; set; }
|
||||
public int ApiKey { get; set; }
|
||||
|
|
|
@ -36,8 +36,10 @@ namespace PlexRequests.Core.SettingModels
|
|||
|
||||
public bool SearchForMovies { get; set; }
|
||||
public bool SearchForTvShows { get; set; }
|
||||
public bool SearchForMusic { get; set; }
|
||||
public bool RequireMovieApproval { get; set; }
|
||||
public bool RequireTvShowApproval { get; set; }
|
||||
public bool RequireMusicApproval { get; set; }
|
||||
public bool UsersCanViewOnlyOwnRequests { get; set; }
|
||||
public int WeeklyRequestLimit { get; set; }
|
||||
public string NoApprovalUsers { get; set; }
|
||||
|
|
|
@ -10,6 +10,11 @@ namespace PlexRequests.Store
|
|||
[Table("Requested")]
|
||||
public class RequestedModel : Entity
|
||||
{
|
||||
public RequestedModel()
|
||||
{
|
||||
RequestedUsers = new List<string>();
|
||||
}
|
||||
|
||||
// ReSharper disable once IdentifierTypo
|
||||
public int ProviderId { get; set; }
|
||||
public string ImdbId { get; set; }
|
||||
|
@ -48,7 +53,8 @@ namespace PlexRequests.Store
|
|||
public enum RequestType
|
||||
{
|
||||
Movie,
|
||||
TvShow
|
||||
TvShow,
|
||||
Album
|
||||
}
|
||||
|
||||
public enum IssueState
|
||||
|
|
|
@ -140,6 +140,42 @@ label {
|
|||
#tvList .mix {
|
||||
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 {
|
||||
text-align: center; }
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
$form-color: #4e5d6c;
|
||||
$form-color-lighter: #637689;
|
||||
$primary-colour: #df691a;
|
||||
$primary-colour-outline: #ff761b;
|
||||
$info-colour: #5bc0de;
|
||||
|
@ -182,6 +183,46 @@ label {
|
|||
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 {
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
public class AdminModule : NancyModule
|
||||
{
|
||||
private ISettingsService<PlexRequestSettings> RpService { get; }
|
||||
private ISettingsService<PlexRequestSettings> PrService { get; }
|
||||
private ISettingsService<CouchPotatoSettings> CpService { get; }
|
||||
private ISettingsService<AuthenticationSettings> AuthService { get; }
|
||||
private ISettingsService<PlexSettings> PlexService { get; }
|
||||
|
@ -78,7 +78,7 @@ namespace PlexRequests.UI.Modules
|
|||
private INotificationService NotificationService { get; }
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
public AdminModule(ISettingsService<PlexRequestSettings> rpService,
|
||||
public AdminModule(ISettingsService<PlexRequestSettings> prService,
|
||||
ISettingsService<CouchPotatoSettings> cpService,
|
||||
ISettingsService<AuthenticationSettings> auth,
|
||||
ISettingsService<PlexSettings> plex,
|
||||
|
@ -96,7 +96,7 @@ namespace PlexRequests.UI.Modules
|
|||
INotificationService notify,
|
||||
ISettingsService<HeadphonesSettings> headphones) : base("admin")
|
||||
{
|
||||
RpService = rpService;
|
||||
PrService = prService;
|
||||
CpService = cpService;
|
||||
AuthService = auth;
|
||||
PlexService = plex;
|
||||
|
@ -186,7 +186,7 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
private Negotiator Admin()
|
||||
{
|
||||
var settings = RpService.GetSettings();
|
||||
var settings = PrService.GetSettings();
|
||||
Log.Trace("Getting Settings:");
|
||||
Log.Trace(settings.DumpJson());
|
||||
|
||||
|
@ -197,7 +197,7 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
var model = this.Bind<PlexRequestSettings>();
|
||||
|
||||
RpService.SaveSettings(model);
|
||||
PrService.SaveSettings(model);
|
||||
|
||||
|
||||
return Context.GetRedirect("~/admin");
|
||||
|
|
|
@ -131,7 +131,8 @@ namespace PlexRequests.UI.Modules
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ namespace PlexRequests.UI.Modules
|
|||
var users = Api.GetUsers(authToken);
|
||||
Log.Debug("Plex Users: ");
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace PlexRequests.UI
|
|||
if (port == -1)
|
||||
port = GetStartupPort();
|
||||
|
||||
var options = new StartOptions(Debugger.IsAttached ? $"http://localhost:{port}" : $"http://+:{port}")
|
||||
var options = new StartOptions( $"http://+:{port}")
|
||||
{
|
||||
ServerFactory = "Microsoft.Owin.Host.HttpListener"
|
||||
};
|
||||
|
|
|
@ -52,6 +52,20 @@
|
|||
</label>
|
||||
</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="checkbox">
|
||||
<label>
|
||||
|
@ -82,6 +96,21 @@
|
|||
|
||||
</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>
|
||||
<div class="form-group">
|
||||
|
|
|
@ -90,5 +90,34 @@
|
|||
<div class="container">
|
||||
@RenderBody()
|
||||
</div>
|
||||
<div class="scroll-top-wrapper ">
|
||||
<span class="scroll-top-inner">
|
||||
<i class="fa fa-2x fa-arrow-circle-up"></i>
|
||||
</span>
|
||||
</div>
|
||||
</body>
|
||||
</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