mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
#164 has been resolved
This commit is contained in:
parent
8cce80654b
commit
5a6863456f
22 changed files with 663 additions and 8 deletions
37
PlexRequests.Core/SettingModels/SlackNotificationSettings.cs
Normal file
37
PlexRequests.Core/SettingModels/SlackNotificationSettings.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PlexRequests.Core.SettingModels
|
||||
{
|
||||
public class SlackNotificationSettings : Settings
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
public string WebhookUrl { get; set; }
|
||||
public string Channel { get; set; }
|
||||
public string Username { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string Team => SplitWebUrl(3);
|
||||
|
||||
[JsonIgnore]
|
||||
public string Service => SplitWebUrl(4);
|
||||
|
||||
[JsonIgnore]
|
||||
public string Token => SplitWebUrl(5);
|
||||
|
||||
private string SplitWebUrl(int index)
|
||||
{
|
||||
if (!WebhookUrl.StartsWith("http", StringComparison.InvariantCulture))
|
||||
{
|
||||
WebhookUrl = "https://" + WebhookUrl;
|
||||
}
|
||||
var split = WebhookUrl.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
return split.Length < index
|
||||
? string.Empty
|
||||
: split[index];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue