Improve ntfy

This commit is contained in:
pancakes 2024-12-03 20:56:27 +10:00
parent f2cfca2f1b
commit 487b026a06
No known key found for this signature in database
GPG key ID: ED53D426432B861B
2 changed files with 4 additions and 2 deletions

View file

@ -5,13 +5,13 @@
const pages = getPages(); const pages = getPages();
function sendNtfyMessage() { async function sendNtfyMessage() {
const message = document.getElementById("ntfy-message").value; const message = document.getElementById("ntfy-message").value;
if (message.length < 15) if (message.length < 15)
return alert( return alert(
`Message must be 15 to 128 characters. Current length is ${message.length}`, `Message must be 15 to 128 characters. Current length is ${message.length}`,
); );
fetch("https://ntfy.meow.company/pancakes", { var resp = await fetch("https://ntfy.meow.company/pancakes", {
method: "POST", method: "POST",
body: message, body: message,
headers: { headers: {
@ -20,6 +20,7 @@
Tags: "black_cat", Tags: "black_cat",
}, },
}); });
if (resp.ok) alert(`Sent: ${message}`);
} }
function updateNtfyCharCount(_) { function updateNtfyCharCount(_) {

View file

@ -406,6 +406,7 @@ input[type="submit"] {
border-radius: var(--radius); border-radius: var(--radius);
font-weight: bold; font-weight: bold;
text-transform: uppercase; text-transform: uppercase;
cursor: pointer;
} }
input[type="text"] { input[type="text"] {