mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 00:32:57 -07:00
All Sln changes
This commit is contained in:
parent
b5855f2644
commit
796f0fc188
615 changed files with 68 additions and 747 deletions
|
@ -1,45 +0,0 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Nancy;
|
||||
using NLog;
|
||||
using Ombi.Core;
|
||||
using Ombi.Core.SettingModels;
|
||||
using Ombi.Helpers;
|
||||
using ISecurityExtensions = Ombi.Core.ISecurityExtensions;
|
||||
|
||||
namespace Ombi.UI.Modules
|
||||
{
|
||||
public class DonationLinkModule : BaseAuthModule
|
||||
{
|
||||
public DonationLinkModule(ICacheProvider provider, ISettingsService<PlexRequestSettings> pr, ISecurityExtensions security) : base("customDonation", pr, security)
|
||||
{
|
||||
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 && Security.IsLoggedIn(Context))
|
||||
{
|
||||
return Response.AsJson(new { url = settings.CustomDonationUrl, message = settings.CustomDonationMessage, enabled = true });
|
||||
}
|
||||
|
||||
return Response.AsJson(new { enabled = false });
|
||||
}
|
||||
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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue