mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-22 22:23:34 -07:00
Review fixes to donation work
This commit is contained in:
parent
ebfb46a904
commit
e916a8076b
4 changed files with 20 additions and 14 deletions
|
@ -28,31 +28,23 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
private async Task<Response> GetCustomDonationUrl(ISettingsService<PlexRequestSettings> pr)
|
||||
{
|
||||
PlexRequestSettings settings = pr.GetSettings();
|
||||
PlexRequestSettings settings = await pr.GetSettingsAsync();
|
||||
try
|
||||
{
|
||||
if (settings.EnableCustomDonationUrl)
|
||||
{
|
||||
JObject o = new JObject();
|
||||
o["url"] = "\""+ settings.CustomDonationUrl + "\"";
|
||||
o["message"] = "\"" + settings.CustomDonationMessage + "\"";
|
||||
return Response.AsJson(o);
|
||||
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage });
|
||||
}
|
||||
else
|
||||
{
|
||||
JObject o = new JObject();
|
||||
o["url"] = "https://www.paypal.me/PlexRequestsNet";
|
||||
return Response.AsJson(o);
|
||||
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);
|
||||
JObject o = new JObject();
|
||||
o["url"] = "donationLinkError";
|
||||
o["message"] = "\"" + "Donate to Library Maintainer" + "\"";
|
||||
return Response.AsJson(o);
|
||||
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
9
PlexRequests.UI/Resources/UI1.Designer.cs
generated
9
PlexRequests.UI/Resources/UI1.Designer.cs
generated
|
@ -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>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
{
|
||||
<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">Donate to Library Maintainer</span></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">
|
||||
|
||||
|
@ -94,8 +94,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var base = '@Html.GetBaseUrl()';
|
||||
var url = createBaseUrl(base, '/customDonation');
|
||||
$.ajax({
|
||||
url: "/customDonation",
|
||||
url: url,
|
||||
success: function (result) {
|
||||
console.log("we win + " + result.url);
|
||||
if (result.url && result.url != "donationLinkError") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue