LunaSea changed to id device/id or user/id instead of full url

This commit is contained in:
2023-06-21 18:03:48 +02:00
parent 6508055b43
commit 0f0902c932
2 changed files with 5 additions and 5 deletions

View File

@ -6,18 +6,18 @@ namespace Tranga.NotificationManagers;
public class LunaSea : NotificationManager
{
public string webhook { get; }
public string id { get; }
private readonly HttpClient _client = new();
public LunaSea(string webhook, Logger? logger = null) : base(NotificationManagerType.LunaSea, logger)
public LunaSea(string id, Logger? logger = null) : base(NotificationManagerType.LunaSea, logger)
{
this.webhook = webhook;
this.id = id;
}
public override void SendNotification(string title, string notificationText)
{
logger?.WriteLine(this.GetType().ToString(), $"Sending notification: {title} - {notificationText}");
MessageData message = new(title, notificationText);
HttpRequestMessage request = new(HttpMethod.Post, webhook);
HttpRequestMessage request = new(HttpMethod.Post, $"https://notify.lunasea.app/v1/custom/{id}");
request.Content = new StringContent(JsonConvert.SerializeObject(message, Formatting.None), Encoding.UTF8, "application/json");
HttpResponseMessage response = _client.Send(request);
if (!response.IsSuccessStatusCode)