From e642e9dd16d5cbd14315ba4afea2fedbcf0c11b6 Mon Sep 17 00:00:00 2001 From: limepotato Date: Mon, 12 Aug 2024 01:26:18 -0600 Subject: [PATCH] add ntfy box --- astro/public/scripts/ntfy.js | 14 ++++++++++++++ astro/src/layouts/Layout.astro | 1 + astro/src/pages/index.astro | 12 ++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 astro/public/scripts/ntfy.js diff --git a/astro/public/scripts/ntfy.js b/astro/public/scripts/ntfy.js new file mode 100644 index 0000000..49aabde --- /dev/null +++ b/astro/public/scripts/ntfy.js @@ -0,0 +1,14 @@ +// both +function send(message) { + let r = new XMLHttpRequest(); + r.open("POST", "https://ntfy.ouroboros.group/beep", true); + r.setRequestHeader("Content-Type", "text/plain"); + r.send(message); +} +// send notification +let ntfyInput = document.getElementById("ntfy-input"); +function sendNotification() { + if (ntfyInput.value.length <= 0) return; + send(ntfyInput.value); + ntfyInput.value = ""; +} diff --git a/astro/src/layouts/Layout.astro b/astro/src/layouts/Layout.astro index fae285f..b3ecfbf 100755 --- a/astro/src/layouts/Layout.astro +++ b/astro/src/layouts/Layout.astro @@ -25,6 +25,7 @@ const { title } = Astro.props; +