From 50ce8cb96b2b218751c2fc2a6b19372f51846acc Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Mon, 14 Jul 2025 19:34:59 +0300 Subject: feat: rewrite in rust --- lib/silmataivas/ntfy_notifier.ex | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 lib/silmataivas/ntfy_notifier.ex (limited to 'lib/silmataivas/ntfy_notifier.ex') diff --git a/lib/silmataivas/ntfy_notifier.ex b/lib/silmataivas/ntfy_notifier.ex deleted file mode 100644 index 26815db..0000000 --- a/lib/silmataivas/ntfy_notifier.ex +++ /dev/null @@ -1,35 +0,0 @@ -defmodule Silmataivas.Notifications.NtfyNotifier do - @moduledoc """ - Sends push notifications using ntfy.sh. - """ - - @ntfy_url System.get_env("NTFY_URL") || "https://ntfy.sh" - - def send_alert( - topic, - %{ - "main" => %{"temp" => temp}, - "wind" => %{"speed" => speed}, - "dt_txt" => time_str - } = entry - ) do - rain_mm = get_in(entry, ["rain", "3h"]) || 0.0 - wind_kmh = speed * 3.6 - - message = """ - 🚨 Weather alert for your location (#{time_str}): - - 🌬️ Wind: #{Float.round(wind_kmh, 1)} km/h - 🌧️ Rain: #{rain_mm} mm - 🌡️ Temperature: #{temp} °C - - Stay safe, - — Silmätaivas - """ - - Req.post("#{@ntfy_url}/#{topic}", - headers: [{"Priority", "5"}], - body: message - ) - end -end -- cgit v1.2.3