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)
|
private async Task<Response> GetCustomDonationUrl(ISettingsService<PlexRequestSettings> pr)
|
||||||
{
|
{
|
||||||
PlexRequestSettings settings = pr.GetSettings();
|
PlexRequestSettings settings = await pr.GetSettingsAsync();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (settings.EnableCustomDonationUrl)
|
if (settings.EnableCustomDonationUrl)
|
||||||
{
|
{
|
||||||
JObject o = new JObject();
|
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage });
|
||||||
o["url"] = "\""+ settings.CustomDonationUrl + "\"";
|
|
||||||
o["message"] = "\"" + settings.CustomDonationMessage + "\"";
|
|
||||||
return Response.AsJson(o);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JObject o = new JObject();
|
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage });
|
||||||
o["url"] = "https://www.paypal.me/PlexRequestsNet";
|
|
||||||
return Response.AsJson(o);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.Warn("Exception Thrown when attempting to check the custom donation url");
|
Log.Warn("Exception Thrown when attempting to check the custom donation url");
|
||||||
Log.Warn(e);
|
Log.Warn(e);
|
||||||
JObject o = new JObject();
|
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage });
|
||||||
o["url"] = "donationLinkError";
|
|
||||||
o["message"] = "\"" + "Donate to Library Maintainer" + "\"";
|
|
||||||
return Response.AsJson(o);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -443,4 +443,7 @@
|
||||||
<data name="Search_ViewInPlex" xml:space="preserve">
|
<data name="Search_ViewInPlex" xml:space="preserve">
|
||||||
<value>View In Plex</value>
|
<value>View In Plex</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Custom_Donation_Default" xml:space="preserve">
|
||||||
|
<value>Donate to Library Maintainer</value>
|
||||||
|
</data>
|
||||||
</root>
|
</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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Issue.
|
/// Looks up a localized string similar to Issue.
|
||||||
/// </summary>
|
/// </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><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>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
|
||||||
|
@ -94,8 +94,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
var base = '@Html.GetBaseUrl()';
|
||||||
|
var url = createBaseUrl(base, '/customDonation');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/customDonation",
|
url: url,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
console.log("we win + " + result.url);
|
console.log("we win + " + result.url);
|
||||||
if (result.url && result.url != "donationLinkError") {
|
if (result.url && result.url != "donationLinkError") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue