diff --git a/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/Config.kt b/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/Config.kt index 490b9ad..bae8f51 100644 --- a/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/Config.kt +++ b/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/Config.kt @@ -25,6 +25,7 @@ class Config { prop.load(it) prop.setProperty("botToken", "YourTokenHere") prop.setProperty("instance", "instance.domain") + prop.setProperty("ntfyEndpoint", "ntfy.example.com/topic") prop.setProperty("superSecret", "secretKey") } val out: OutputStream = FileOutputStream(confFile) @@ -34,5 +35,6 @@ class Config { val botToken: String = (prop.getProperty("botToken")) val instanceDomain: String = (prop.getProperty("instance")) + val ntfyEndpoint: String = (prop.getProperty("ntfyEndpoint")) val superSecret: String = (prop.getProperty("superSecret")) } diff --git a/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/plugins/Client.kt b/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/plugins/Client.kt index ce984a6..eca7989 100644 --- a/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/plugins/Client.kt +++ b/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/plugins/Client.kt @@ -35,13 +35,14 @@ suspend fun makePost( // Send a ntfy message suspend fun ntfyMsg( client: HttpClient, + endpoint: String, title: String, message: String, attach: String, click: String, ) { val message: HttpResponse = - client.post("https://ntfy.ouroboros.group/pushy") { + client.post("https://" + endpoint) { headers { append("Title", title) append("Attach", attach) diff --git a/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/plugins/Routing.kt b/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/plugins/Routing.kt index f15528e..290eedc 100644 --- a/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/plugins/Routing.kt +++ b/backend/src/main/kotlin/observer/nelle/nelleObserverBackend/plugins/Routing.kt @@ -141,7 +141,7 @@ fun Application.configureRouting(client: HttpClient) { val click = formParameters["Click"].toString() call.response.status(HttpStatusCode(201, "Received...")) call.respondText("Received:: Title: $title, Message: $message, Attachment: $attach, Click: $click") - ntfyMsg(client, title, message, attach, click) + ntfyMsg(client, Config().ntfyEndpoint, title, message, attach, click) storeMessage(title, message, attach, click) } }