Merge pull request #1105 from tidusjar/dev

Dev
pull/1186/head
Jamie 8 years ago committed by GitHub
commit e3f2daea01

@ -49,13 +49,6 @@ namespace Ombi.Api.Models.Watcher
public string requiredwords { get; set; }
}
public class Quality
{
[JsonProperty("Quality")]
public Quality2 quality { get; set; }
public Filters Filters { get; set; }
}
public class WatcherListStatusResult
{
public string status { get; set; }
@ -72,7 +65,7 @@ namespace Ombi.Api.Models.Watcher
public string dvd { get; set; }
public string tomatorating { get; set; }
public string imdbid { get; set; }
public Quality quality { get; set; }
public string quality { get; set; }
}

@ -64,7 +64,6 @@ namespace Ombi.Api
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling GetUsers for Emby, Retrying {0}", timespan), new[] {
TimeSpan.FromSeconds (1),
TimeSpan.FromSeconds(5)
});
var obj = policy.Execute(() => Api.ExecuteJson<List<EmbyUser>>(request, baseUri));
@ -199,8 +198,7 @@ namespace Ombi.Api
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling LogInfor Emby, Retrying {0}", timespan), new[] {
TimeSpan.FromSeconds (1),
TimeSpan.FromSeconds(5)
TimeSpan.FromSeconds (1)
});
var obj = policy.Execute(() => Api.Execute(request, baseUri));

@ -183,8 +183,9 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
return escapedHtml;
}
private void GenerateMovieHtml(IEnumerable<EmbyRecentlyAddedModel> movies, StringBuilder sb)
private void GenerateMovieHtml(IEnumerable<EmbyRecentlyAddedModel> recentlyAddedMovies, StringBuilder sb)
{
var movies = recentlyAddedMovies?.ToList() ?? new List<EmbyRecentlyAddedModel>();
if (!movies.Any())
{
return;
@ -241,8 +242,10 @@ namespace Ombi.Services.Jobs.RecentlyAddedNewsletter
public EmbySeriesInformation Series { get; set; }
public List<EmbyEpisodeInformation> Episodes { get; set; }
}
private void GenerateTvHtml(List<EmbyRecentlyAddedModel> tv, StringBuilder sb)
private void GenerateTvHtml(IEnumerable<EmbyRecentlyAddedModel> recenetlyAddedTv, StringBuilder sb)
{
var tv = recenetlyAddedTv?.ToList() ?? new List<EmbyRecentlyAddedModel>();
if (!tv.Any())
{
return;

@ -208,11 +208,17 @@ namespace Ombi.UI.Authentication
var plexUsers = configuration.PlexUserRepository.GetAll();
var plexUser = plexUsers.FirstOrDefault(x => Guid.Parse(x.LoginId) == userGuid);
var embyUsers = configuration.EmbyUserRepository.GetAll();
var embyUser = embyUsers.FirstOrDefault(x => Guid.Parse(x.LoginId) == userGuid);
if (plexUser != null)
{
identity.UserName = plexUser.Username;
}
if (embyUser != null)
{
identity.UserName = embyUser.Username;
}
var localUsers = configuration.LocalUserRepository.GetAll();

@ -1,13 +1,13 @@
/*!
* Font Awesome 4.5.0 by @davegandy - http://fontawesome.io - @fontawesome
* Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
/* FONT PATH
* -------------------------- */
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.5.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg');
src: url('../fonts/fontawesome-webfont.eot?v=4.7.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
@ -118,31 +118,31 @@
}
}
.fa-rotate-90 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.fa-rotate-180 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.fa-rotate-270 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
}
.fa-flip-horizontal {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
-webkit-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
transform: scale(-1, 1);
}
.fa-flip-vertical {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
-webkit-transform: scale(1, -1);
-ms-transform: scale(1, -1);
transform: scale(1, -1);
@ -1383,7 +1383,7 @@
.fa-digg:before {
content: "\f1a6";
}
.fa-pied-piper:before {
.fa-pied-piper-pp:before {
content: "\f1a7";
}
.fa-pied-piper-alt:before {
@ -1509,6 +1509,7 @@
content: "\f1ce";
}
.fa-ra:before,
.fa-resistance:before,
.fa-rebel:before {
content: "\f1d0";
}
@ -1831,6 +1832,7 @@
content: "\f23e";
}
.fa-battery-4:before,
.fa-battery:before,
.fa-battery-full:before {
content: "\f240";
}
@ -2084,3 +2086,252 @@
.fa-percent:before {
content: "\f295";
}
.fa-gitlab:before {
content: "\f296";
}
.fa-wpbeginner:before {
content: "\f297";
}
.fa-wpforms:before {
content: "\f298";
}
.fa-envira:before {
content: "\f299";
}
.fa-universal-access:before {
content: "\f29a";
}
.fa-wheelchair-alt:before {
content: "\f29b";
}
.fa-question-circle-o:before {
content: "\f29c";
}
.fa-blind:before {
content: "\f29d";
}
.fa-audio-description:before {
content: "\f29e";
}
.fa-volume-control-phone:before {
content: "\f2a0";
}
.fa-braille:before {
content: "\f2a1";
}
.fa-assistive-listening-systems:before {
content: "\f2a2";
}
.fa-asl-interpreting:before,
.fa-american-sign-language-interpreting:before {
content: "\f2a3";
}
.fa-deafness:before,
.fa-hard-of-hearing:before,
.fa-deaf:before {
content: "\f2a4";
}
.fa-glide:before {
content: "\f2a5";
}
.fa-glide-g:before {
content: "\f2a6";
}
.fa-signing:before,
.fa-sign-language:before {
content: "\f2a7";
}
.fa-low-vision:before {
content: "\f2a8";
}
.fa-viadeo:before {
content: "\f2a9";
}
.fa-viadeo-square:before {
content: "\f2aa";
}
.fa-snapchat:before {
content: "\f2ab";
}
.fa-snapchat-ghost:before {
content: "\f2ac";
}
.fa-snapchat-square:before {
content: "\f2ad";
}
.fa-pied-piper:before {
content: "\f2ae";
}
.fa-first-order:before {
content: "\f2b0";
}
.fa-yoast:before {
content: "\f2b1";
}
.fa-themeisle:before {
content: "\f2b2";
}
.fa-google-plus-circle:before,
.fa-google-plus-official:before {
content: "\f2b3";
}
.fa-fa:before,
.fa-font-awesome:before {
content: "\f2b4";
}
.fa-handshake-o:before {
content: "\f2b5";
}
.fa-envelope-open:before {
content: "\f2b6";
}
.fa-envelope-open-o:before {
content: "\f2b7";
}
.fa-linode:before {
content: "\f2b8";
}
.fa-address-book:before {
content: "\f2b9";
}
.fa-address-book-o:before {
content: "\f2ba";
}
.fa-vcard:before,
.fa-address-card:before {
content: "\f2bb";
}
.fa-vcard-o:before,
.fa-address-card-o:before {
content: "\f2bc";
}
.fa-user-circle:before {
content: "\f2bd";
}
.fa-user-circle-o:before {
content: "\f2be";
}
.fa-user-o:before {
content: "\f2c0";
}
.fa-id-badge:before {
content: "\f2c1";
}
.fa-drivers-license:before,
.fa-id-card:before {
content: "\f2c2";
}
.fa-drivers-license-o:before,
.fa-id-card-o:before {
content: "\f2c3";
}
.fa-quora:before {
content: "\f2c4";
}
.fa-free-code-camp:before {
content: "\f2c5";
}
.fa-telegram:before {
content: "\f2c6";
}
.fa-thermometer-4:before,
.fa-thermometer:before,
.fa-thermometer-full:before {
content: "\f2c7";
}
.fa-thermometer-3:before,
.fa-thermometer-three-quarters:before {
content: "\f2c8";
}
.fa-thermometer-2:before,
.fa-thermometer-half:before {
content: "\f2c9";
}
.fa-thermometer-1:before,
.fa-thermometer-quarter:before {
content: "\f2ca";
}
.fa-thermometer-0:before,
.fa-thermometer-empty:before {
content: "\f2cb";
}
.fa-shower:before {
content: "\f2cc";
}
.fa-bathtub:before,
.fa-s15:before,
.fa-bath:before {
content: "\f2cd";
}
.fa-podcast:before {
content: "\f2ce";
}
.fa-window-maximize:before {
content: "\f2d0";
}
.fa-window-minimize:before {
content: "\f2d1";
}
.fa-window-restore:before {
content: "\f2d2";
}
.fa-times-rectangle:before,
.fa-window-close:before {
content: "\f2d3";
}
.fa-times-rectangle-o:before,
.fa-window-close-o:before {
content: "\f2d4";
}
.fa-bandcamp:before {
content: "\f2d5";
}
.fa-grav:before {
content: "\f2d6";
}
.fa-etsy:before {
content: "\f2d7";
}
.fa-imdb:before {
content: "\f2d8";
}
.fa-ravelry:before {
content: "\f2d9";
}
.fa-eercast:before {
content: "\f2da";
}
.fa-microchip:before {
content: "\f2db";
}
.fa-snowflake-o:before {
content: "\f2dc";
}
.fa-superpowers:before {
content: "\f2dd";
}
.fa-wpexplorer:before {
content: "\f2de";
}
.fa-meetup:before {
content: "\f2e0";
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}

File diff suppressed because one or more lines are too long

@ -394,7 +394,7 @@ $(function () {
if (results.result) {
// It's on Netflix
$('#' + id + 'netflixTab')
.html("<a href='https://www.netflix.com/watch/"+results.netflixId+"' target='_blank'><span class='label label-success'>Avaialble on Netflix</span></a>");
.html("<a href='https://www.netflix.com/watch/"+results.netflixId+"' target='_blank'><span class='label label-success'>Available on Netflix</span></a>");
}
});

@ -226,6 +226,8 @@ namespace Ombi.UI.Modules.Admin
Get["/newsletter", true] = async (x, ct) => await Newsletter();
Post["/newsletter", true] = async (x, ct) => await SaveNewsletter();
Post["/testnewsletteradminemail"] = x => TestNewsletterAdminEmail();
Get["/massemail"] = _ => MassEmailView();
Post["/testmassadminemail"] = x => TestMassAdminEmail();
Post["/sendmassemail"] = x => SendMassEmail();
@ -930,6 +932,10 @@ namespace Ombi.UI.Modules.Admin
var settings = await NewsLetterService.GetSettingsAsync();
return View["NewsletterSettings", settings];
}
private Negotiator MassEmailView()
{
return View["MassEmail"];
}
private async Task<Response> SaveNewsletter()
{

@ -330,7 +330,15 @@ namespace Ombi.UI.Modules
if (settings.UserAuthentication) // Authenticate with Plex
{
Log.Debug("Need to auth and also provide pass");
var signedIn = (EmbyUser)EmbyApi.LogIn(username, password, embySettings.ApiKey, embySettings.FullUri);
EmbyUser signedIn = null;
try
{
signedIn = (EmbyUser)EmbyApi.LogIn(username, password, embySettings.ApiKey, embySettings.FullUri);
}
catch (Exception e)
{
Log.Error(e);
}
if (signedIn != null)
{
Log.Debug("Correct credentials, checking if the user is account owner or in the friends list");
@ -731,17 +739,34 @@ namespace Ombi.UI.Modules
}
private bool CheckIfEmbyUser(string username, EmbySettings s)
{
try
{
var users = EmbyApi.GetUsers(s.FullUri, s.ApiKey);
var allUsers = users?.Where(x => !string.IsNullOrEmpty(x.Name));
return allUsers != null && allUsers.Any(x => x.Name.Equals(username, StringComparison.CurrentCultureIgnoreCase));
}
catch (Exception e)
{
Log.Error(e);
return false;
}
}
private EmbyUser GetEmbyUser(string username, EmbySettings s)
{
try
{
var users = EmbyApi.GetUsers(s.FullUri, s.ApiKey);
var allUsers = users?.Where(x => !string.IsNullOrEmpty(x.Name));
return allUsers?.FirstOrDefault(x => x.Name.Equals(username, StringComparison.CurrentCultureIgnoreCase));
}
catch (Exception e)
{
Log.Error(e);
return null;
}
}
private string GetUserIdIsInPlexFriends(string username, string authToken)

@ -876,6 +876,9 @@
<Content Include="Views\Integration\Watcher.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Views\Admin\MassEmail.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Views\Admin\NewsletterSettings.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

@ -87,15 +87,6 @@
changeDisabledStatus($('#UsePassword'), @Model.UserAuthentication.ToString().ToLower(), $('#passLabel'));
if ($('#PlexAuthToken')) {
loadUserList();
}
$('#refreshUsers').click(function (e) {
e.preventDefault();
loadUserList();
});
$('#mainForm').on('click', '#userAuth', function () {
var checked = this.checked;
@ -112,41 +103,5 @@
$label.css("color", "grey");
}
}
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>

@ -0,0 +1,105 @@
@using System.Linq
@using Ombi.UI.Helpers
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<Ombi.Core.SettingModels.NewletterSettings>
@Html.Partial("Shared/Partial/_Sidebar")
<div class="col-sm-8 col-sm-push-1">
<form id="massemail" class="form-horizontal">
<fieldset>
<legend>Mass Email</legend>
<!-- Mass Email Section -->
<div style="padding:10px">
<div class="form-group">
<small>Note: This will require you to setup your email notifications</small>
</div>
<div class="form-group">
<label for="massEmailSubject" class="control-label">Subject</label>
<div>
<input type="text" class="form-control form-control-custom " placeholder="A Message from the Admin" id="massEmailSubject" name="massEmailSubject" value="">
</div>
</div>
<div class="form-group">
<label for="massEmailBody" class="control-label">Body</label>
<textarea id="massEmailBody" class="form-control" rows="5"></textarea>
<small>Supports HTML</small>
</div>
<div class="form-group">
<div>
<button id="testSendMassEmailBtn" class="btn btn-primary-outline">Send Test to Admin<div id="testSendMassEmailSpinner"></div></button>
</div>
</div>
<div class="form-group">
<div>
<button id="sendMassEmailBtn" class="btn btn-primary-outline">Send To All Users<div id="sendMassEmailSpinner"></div></button>
</div>
</div>
</div>
<!-- Mass Email Section -->
</fieldset>
</form>
</div>
<script>
$(function () {
$('#testSendMassEmailBtn').click(function (e) {
e.preventDefault();
var base = '@Html.GetBaseUrl()';
var url = createBaseUrl(base, '/admin/testmassadminemail');
$('#testSendMassEmailSpinner').attr("class", "fa fa-spinner fa-spin");
var data = { "Users": "", "Body": $("#massEmailBody").val(), "Subject": $("#massEmailSubject").val() };
$.ajax({
type: "post",
url: url,
data: data,
dataType: "json",
success: function (response) {
if (response.result) {
generateNotify(response.message, "success");
$('#testSendMassEmailSpinner').attr("class", "fa fa-check");
} else {
generateNotify(response.message, "danger");
$('#testSendMassEmailSpinner').attr("class", "fa fa-times");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
$('#testSendMassEmailSpinner').attr("class", "fa fa-times");
}
});
});
$('#sendMassEmailBtn').click(function (e) {
e.preventDefault();
var base = '@Html.GetBaseUrl()';
var url = createBaseUrl(base, '/admin/sendmassemail');
$('#sendMassEmailSpinner').attr("class", "fa fa-spinner fa-spin");
var data = { "Users": "", "Body": $("#massEmailBody").val(), "Subject": $("#massEmailSubject").val() };
$.ajax({
type: "post",
url: url,
data: data,
dataType: "json",
success: function (response) {
if (response.result) {
generateNotify(response.message, "success");
$('#sendMassEmailSpinner').attr("class", "fa fa-check");
} else {
generateNotify(response.message, "danger");
$('#sendMassEmailSpinner').attr("class", "fa fa-times");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
$('#sendMassEmailSpinner').attr("class", "fa fa-times");
}
});
});
});
</script>

@ -9,7 +9,7 @@
<legend>Newsletter Settings</legend>
<div style="padding:10px">
<!-- Email Nofication Section -->
<!-- Newsletter Section -->
<div class="form-group">
<div class="checkbox">
@ -51,42 +51,7 @@
</div>
</div>
</div>
<!-- Email Nofication Section -->
</fieldset>
</form>
<form id="massemail" class="form-horizontal">
<fieldset>
<legend>Mass Email</legend>
<div style="padding:10px">
<div class="form-group">
<small>Note: This will require you to setup your email notifications</small>
</div>
<div class="form-group">
<label for="massEmailSubject" class="control-label">Subject</label>
<div>
<input type="text" class="form-control form-control-custom " placeholder="A Message from the Admin" id="massEmailSubject" name="massEmailSubject" value="">
</div>
</div>
<div class="form-group">
<label for="massEmailBody" class="control-label">Body</label>
<textarea id="massEmailBody" class="form-control" rows="5"></textarea>
<small>Supports HTML</small>
</div>
<div class="form-group">
<div>
<button id="testSendMassEmailBtn" class="btn btn-primary-outline">Send Test to Admin<div id="testSendMassEmailSpinner"></div></button>
</div>
</div>
<div class="form-group">
<div>
<button id="sendMassEmailBtn" class="btn btn-primary-outline">Send To All Users<div id="sendMassEmailSpinner"></div></button>
</div>
</div>
</div>
<!-- Newsletter Section -->
</fieldset>
</form>
</div>
@ -94,8 +59,6 @@
<script>
$(function () {
var base = '@Html.GetBaseUrl()';
$('#save').click(function (e) {
e.preventDefault();
@ -149,62 +112,5 @@
});
});
$('#testSendMassEmailBtn').click(function (e) {
e.preventDefault();
var base = '@Html.GetBaseUrl()';
var url = createBaseUrl(base, '/admin/testmassadminemail');
$('#testSendMassEmailSpinner').attr("class", "fa fa-spinner fa-spin");
var data = { "Users": "", "Body": $("#massEmailBody").val(), "Subject": $("#massEmailSubject").val() };
$.ajax({
type: "post",
url: url,
data: data,
dataType: "json",
success: function (response) {
if (response.result) {
generateNotify(response.message, "success");
$('#testSendMassEmailSpinner').attr("class", "fa fa-check");
} else {
generateNotify(response.message, "danger");
$('#testSendMassEmailSpinner').attr("class", "fa fa-times");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
$('#testSendMassEmailSpinner').attr("class", "fa fa-times");
}
});
});
$('#sendMassEmailBtn').click(function (e) {
e.preventDefault();
var base = '@Html.GetBaseUrl()';
var url = createBaseUrl(base, '/admin/sendmassemail');
$('#sendMassEmailSpinner').attr("class", "fa fa-spinner fa-spin");
var data = { "Users": "", "Body": $("#massEmailBody").val(), "Subject": $("#massEmailSubject").val() };
$.ajax({
type: "post",
url: url,
data: data,
dataType: "json",
success: function (response) {
if (response.result) {
generateNotify(response.message, "success");
$('#sendMassEmailSpinner').attr("class", "fa fa-check");
} else {
generateNotify(response.message, "danger");
$('#sendMassEmailSpinner').attr("class", "fa fa-times");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
$('#sendMassEmailSpinner').attr("class", "fa fa-times");
}
});
});
});
</script>

@ -18,7 +18,7 @@
<div class="row">
<div class="col-md-3">
<img src="@Model.PosterUrl" />
<img src="https://image.tmdb.org/t/p/w150/@Model.PosterUrl" />
</div>
<div class="col-md-9">
<h4>Issues For "@Model.Title"</h4>

@ -17,6 +17,7 @@
@Html.GetSidebarUrl(Context, "/admin/sickrage", "SickRage", "fa fa-tv")
@Html.GetSidebarUrl(Context, "/admin/headphones", "Headphones (beta)", "glyphicon glyphicon-headphones")
@Html.GetSidebarUrl(Context, "/admin/newsletter", "Newsletter Settings", "fa fa-newspaper-o")
@Html.GetSidebarUrl(Context, "/admin/massemail", "Mass Email", "fa fa-reply-all")
<div id="sidebar" >
<a href="#notifications" class="list-group-item" data-parent="#sidebar">

Loading…
Cancel
Save