diff --git a/Tranga-API/Program.cs b/Tranga-API/Program.cs index 80d1307..d862432 100644 --- a/Tranga-API/Program.cs +++ b/Tranga-API/Program.cs @@ -244,7 +244,7 @@ app.MapGet("/Settings/Get", () => taskManager.settings); app.MapPost("/Settings/Update", (string? downloadLocation, string? komgaUrl, string? komgaAuth, string? kavitaUrl, string? kavitaUsername, - string? kavitaPassword, string? gotifyUrl, string? gotifyAppToken) => + string? kavitaPassword, string? gotifyUrl, string? gotifyAppToken, string? lunaseaWebhook) => { if (downloadLocation is not null && downloadLocation.Length > 0) taskManager.settings.UpdateSettings(TrangaSettings.UpdateField.DownloadLocation, logger, downloadLocation); @@ -256,6 +256,8 @@ app.MapPost("/Settings/Update", kavitaPassword); if (gotifyUrl is not null && gotifyAppToken is not null && gotifyUrl.Length > 5 && gotifyAppToken.Length > 0) taskManager.settings.UpdateSettings(TrangaSettings.UpdateField.Gotify, logger, gotifyUrl, gotifyAppToken); + if(lunaseaWebhook is not null && lunaseaWebhook.Length > 5) + taskManager.settings.UpdateSettings(TrangaSettings.UpdateField.LunaSea, logger, lunaseaWebhook); }); app.Run(); \ No newline at end of file diff --git a/Tranga/TrangaSettings.cs b/Tranga/TrangaSettings.cs index 02de48d..8273eb4 100644 --- a/Tranga/TrangaSettings.cs +++ b/Tranga/TrangaSettings.cs @@ -70,8 +70,14 @@ public class TrangaSettings notificationManagers.RemoveWhere(nm => nm.GetType() == typeof(Gotify)); notificationManagers.Add(new Gotify(values[0], values[1], logger)); break; + case UpdateField.LunaSea: + if(values.Length != 1) + return; + notificationManagers.RemoveWhere(nm => nm.GetType() == typeof(LunaSea)); + notificationManagers.Add(new LunaSea(values[0], logger)); + break; } } - public enum UpdateField { DownloadLocation, Komga, Kavita, Gotify} + public enum UpdateField { DownloadLocation, Komga, Kavita, Gotify, LunaSea} } \ No newline at end of file diff --git a/Website/apiConnector.js b/Website/apiConnector.js index ebeb640..e859229 100644 --- a/Website/apiConnector.js +++ b/Website/apiConnector.js @@ -150,6 +150,12 @@ function UpdateGotify(gotifyUrl, gotifyAppToken){ PostData(uri); } +function UpdateLunaSea(lunaseaWebhook){ + var uri = apiUri + "/Settings/Update?" + uri += `&lunaseaWebhook=${lunaseaWebhook}`; + PostData(uri); +} + function DeleteTask(taskType, connectorName, publicationId){ var uri = apiUri + `/Tasks/Delete?taskType=${taskType}&connectorName=${connectorName}&publicationId=${publicationId}`; DeleteData(uri); diff --git a/Website/index.html b/Website/index.html index 5b3db59..8182f64 100644 --- a/Website/index.html +++ b/Website/index.html @@ -139,6 +139,11 @@ +