tidusjar 8 years ago
commit 087d825665

@ -60,6 +60,9 @@ namespace PlexRequests.Core.SettingModels
public bool DisableTvRequestsBySeason { get; set; }
public bool SendRecentlyAddedEmail { get; set; }
public string CustomDonationUrl { get; set; }
public bool EnableCustomDonationUrl { get; set; }
public string CustomDonationMessage { get; set; }
/// <summary>
/// The CSS name of the theme we want
/// </summary>

@ -197,10 +197,10 @@ namespace PlexRequests.Services.Jobs
string.IsNullOrEmpty(parentMetaData.Directory.Summary) ? info.summary : parentMetaData.Directory.Summary); // Episode Summary
sb.Append("<td");
sb.Append("</tr>");
sb.Append("<hr>");
sb.Append("<br>");
sb.Append("<br>");
sb.Append("</tr>");
}
sb.Append("</table><br/><br/>");
}

@ -0,0 +1,52 @@
using System;
using System.Threading.Tasks;
using Nancy;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NLog;
using PlexRequests.Core;
using PlexRequests.Core.SettingModels;
using PlexRequests.Helpers;
using PlexRequests.UI.Models;
namespace PlexRequests.UI.Modules
{
public class DonationLinkModule : BaseAuthModule
{
public DonationLinkModule(ICacheProvider provider, ISettingsService<PlexRequestSettings> pr) : base("customDonation", pr)
{
Cache = provider;
Get["/", true] = async (x, ct) => await GetCustomDonationUrl(pr);
}
private ICacheProvider Cache { get; }
private static Logger Log = LogManager.GetCurrentClassLogger();
private async Task<Response> GetCustomDonationUrl(ISettingsService<PlexRequestSettings> pr)
{
PlexRequestSettings settings = await pr.GetSettingsAsync();
try
{
if (settings.EnableCustomDonationUrl)
{
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage });
}
else
{
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage });
}
}
catch (Exception e)
{
Log.Warn("Exception Thrown when attempting to check the custom donation url");
Log.Warn(e);
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage });
}
}
}
}

@ -248,6 +248,7 @@
<Compile Include="Modules\BaseModule.cs" />
<Compile Include="Modules\BetaModule.cs" />
<Compile Include="Modules\CultureModule.cs" />
<Compile Include="Modules\DonationLinkModule.cs" />
<Compile Include="Modules\IssuesModule.cs" />
<Compile Include="Modules\LandingPageModule.cs" />
<Compile Include="Modules\RequestsBetaModule.cs" />

@ -443,4 +443,7 @@
<data name="Search_ViewInPlex" xml:space="preserve">
<value>View In Plex</value>
</data>
<data name="Custom_Donation_Default" xml:space="preserve">
<value>Donate to Library Maintainer</value>
</data>
</root>

@ -114,6 +114,15 @@ namespace PlexRequests.UI.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Donate to Library Maintainer.
/// </summary>
public static string Custom_Donation_Default {
get {
return ResourceManager.GetString("Custom_Donation_Default", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Issue.
/// </summary>

@ -273,10 +273,38 @@
}
</div>
</div>
<div class="form-group">
<div class="checkbox">
@if (Model.EnableCustomDonationUrl)
{
<input type="checkbox" id="EnableCustomDonationUrl" name="EnableCustomDonationUrl" checked="checked">
<label for="EnableCustomDonationUrl">Enable custom donation link</label>
}
else
{
<input type="checkbox" id="EnableCustomDonationUrl" name="EnableCustomDonationUrl"><label for="EnableCustomDonationUrl">Enable custom donation link</label>
}
</div>
</div>
<div class="form-group">
<label for="CustomDonationUrl" class="control-label">Custom Donation URL</label>
<div>
<input type="text" class="form-control-custom form-control " id="CustomDonationUrl" name="CustomDonationUrl" placeholder="http://example.com" value="@Model.CustomDonationUrl">
</div>
</div>
<div class="form-group">
<label for="CustomDonationMessage" class="control-label">Donation Button Message</label>
<div>
<input type="text" class="form-control-custom form-control " id="CustomDonationMessage" name="CustomDonationMessage" placeholder="Donation button message" value="@Model.CustomDonationMessage">
</div>
</div>
<p class="form-group">A comma separated list of users whose requests do not require approval (These users also do not have a request limit).</p>
<p class="form-group">A comma separated list of users whose requests do not require approval (These users also do not have a request limit).</p>
<div class="form-group">
<label for="NoApprovalUsers" class="control-label">Approval White listed Users</label>
<div>

@ -1,6 +1,7 @@
@using Nancy.Security
@using Nancy.Session
@using Nancy;
@using PlexRequests.Core.SettingModels
@using PlexRequests.UI.Helpers
@using PlexRequests.UI.Models
@using PlexRequests.UI.Resources
@ -38,10 +39,11 @@
{
<li><a id="donate" href="https://www.paypal.me/PlexRequestsNet" target="_blank"><i class="fa fa-heart" style="color: red"></i> @UI.Layout_Donate</a></li>
}
<li id="customDonate" style="display: none"><a id="customDonateHref" href="https://www.paypal.me/PlexRequestsNet" target="_blank"><i class="fa fa-heart" style="color: yellow;"></i> <span id="donationText">@UI.Custom_Donation_Default</span></a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
@if (!Context.CurrentUser.IsAuthenticated() && Context.Request.Session[SessionKeys.UsernameKey] == null) // TODO replace with IsAdmin
{
@ -91,5 +93,28 @@
</ul>
</div>
</div>
<script>
var base = '@Html.GetBaseUrl()';
var url = createBaseUrl(base, '/customDonation');
$.ajax({
url: url,
success: function (result) {
console.log("we win + " + result.url);
if (result.url && result.url != "donationLinkError") {
$("#customDonate").show();
var donateLink = $("#customDonateHref");
var donationText = $("#donationText");
donateLink.attr("href", result.url);
if(result.message) {
donationText.text(result.message);
}
}
},
error: function(xhr, status, error) {
console.log("error " + error);
$("#customDonate").hide();
}
});
</script>
<div id="updateAvailable" hidden="hidden"></div>
</nav>

@ -40,6 +40,7 @@ Supported notifications:
* Pushbullet
* Pushover
* Slack
* Weekly Recently Added email notification to all of your Plex Users!
# Preview

@ -3,9 +3,9 @@ configuration: Release
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
assembly_version: '1.9.2'
assembly_version: '1.9.3'
assembly_file_version: '{version}'
assembly_informational_version: '1.9.2'
assembly_informational_version: '1.9.3'
before_build:
- cmd: appveyor-retry nuget restore
build:

Loading…
Cancel
Save