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

This commit is contained in:
glax 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 class LunaSea : NotificationManager
{ {
public string webhook { get; } public string id { get; }
private readonly HttpClient _client = new(); 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) public override void SendNotification(string title, string notificationText)
{ {
logger?.WriteLine(this.GetType().ToString(), $"Sending notification: {title} - {notificationText}"); logger?.WriteLine(this.GetType().ToString(), $"Sending notification: {title} - {notificationText}");
MessageData message = new(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"); request.Content = new StringContent(JsonConvert.SerializeObject(message, Formatting.None), Encoding.UTF8, "application/json");
HttpResponseMessage response = _client.Send(request); HttpResponseMessage response = _client.Send(request);
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)

View File

@ -142,7 +142,7 @@
<div> <div>
<span class="title">LunaSea</span> <span class="title">LunaSea</span>
<div>Configured: <span id="lunaseaConfigured">✅❌</span></div> <div>Configured: <span id="lunaseaConfigured">✅❌</span></div>
<label for="lunaseaWebhook"></label><input placeholder="Webhook-Url" id="lunaseaWebhook" type="text"> <label for="lunaseaWebhook"></label><input placeholder="device/:id or user/:id" id="lunaseaWebhook" type="text">
</div> </div>
<div> <div>
<label for="libraryUpdateTime" style="margin-right: 5px;">Update Time</label><input id="libraryUpdateTime" type="time" value="00:01:00" step="10"> <label for="libraryUpdateTime" style="margin-right: 5px;">Update Time</label><input id="libraryUpdateTime" type="time" value="00:01:00" step="10">