nelle-observer/astro/public/scripts/ntfy.js

15 lines
403 B
JavaScript
Raw Normal View History

2024-08-12 01:26:18 -06:00
// both
function send(message) {
2024-08-18 01:37:10 -06:00
const r = new XMLHttpRequest();
2024-08-12 01:26:18 -06:00
r.open("POST", "https://ntfy.ouroboros.group/beep", true);
r.setRequestHeader("Content-Type", "text/plain");
r.send(message);
}
// send notification
2024-08-18 01:37:10 -06:00
const ntfyInput = document.getElementById("ntfy-input");
2024-08-12 01:26:18 -06:00
function sendNotification() {
if (ntfyInput.value.length <= 0) return;
send(ntfyInput.value);
ntfyInput.value = "";
}