From 6e6db6d109a2df399e2318b06595b578a2db1ecd Mon Sep 17 00:00:00 2001
From: pancakes
Date: Tue, 3 Dec 2024 20:24:03 +1000
Subject: [PATCH] Use named function to submit ntfy message
---
src/routes/+page.svelte | 43 +++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 23 deletions(-)
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 8a61a44..615efe4 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -5,7 +5,24 @@
const pages = getPages();
- function updateCharCount(_) {
+ function sendNtfyMessage() {
+ const message = document.getElementById("ntfy-message").value;
+ if (message.length < 15)
+ return alert(
+ `Message must be 15 to 128 characters. Current length is ${message.length}`,
+ );
+ fetch("https://ntfy.meow.company/pancakes", {
+ method: "POST",
+ body: message,
+ headers: {
+ Title: "pancakes.gay",
+ Priority: "min",
+ Tags: "black_cat",
+ },
+ });
+ }
+
+ function updateNtfyCharCount(_) {
const message = document.getElementById("ntfy-message").value;
const el = document.getElementById("ntfy-char-count");
@@ -354,7 +371,7 @@
-
+