From f4db38f051e76a7974cc9345ae9d166d71efbf1c Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 25 Feb 2026 16:29:26 -0600 Subject: [PATCH] update --- lib/aprsme_web/live/map_live/index.ex | 21 +++++++++++++++------ tail_logs.sh | 4 ++++ 2 files changed, 19 insertions(+), 6 deletions(-) create mode 100755 tail_logs.sh diff --git a/lib/aprsme_web/live/map_live/index.ex b/lib/aprsme_web/live/map_live/index.ex index 49e6be2..dc714d6 100644 --- a/lib/aprsme_web/live/map_live/index.ex +++ b/lib/aprsme_web/live/map_live/index.ex @@ -308,17 +308,14 @@ defmodule AprsmeWeb.MapLive.Index do @impl true def handle_event("set_location", %{"lat" => lat, "lng" => lng}, socket) do - # Update map center and zoom when location is received - # Parse and validate coordinates - lat_float = UrlParams.parse_latitude(lat) - lng_float = UrlParams.parse_longitude(lng) + # Geolocation sends numeric values; coerce strings to floats if needed + lat_float = to_float(lat) + lng_float = to_float(lng) - # Additional validation - ensure we got valid coordinates if UrlParams.valid_coordinates?(lat_float, lng_float) do socket = Navigation.update_and_zoom_to_location(socket, lat_float, lng_float, 12) {:noreply, socket} else - # Invalid coordinates - ignore the event {:noreply, socket} end end @@ -803,6 +800,18 @@ defmodule AprsmeWeb.MapLive.Index do # Parse historical hours with validation defp parse_historical_hours(hours), do: SharedPacketUtils.parse_historical_hours(hours) + defp to_float(val) when is_float(val), do: val + defp to_float(val) when is_integer(val), do: val / 1 + + defp to_float(val) when is_binary(val) do + case Float.parse(val) do + {f, _} -> f + :error -> nil + end + end + + defp to_float(_), do: nil + @impl true def handle_info({:process_bounds_update, map_bounds}, socket), do: handle_info_process_bounds_update(map_bounds, socket) diff --git a/tail_logs.sh b/tail_logs.sh new file mode 100755 index 0000000..cf0a300 --- /dev/null +++ b/tail_logs.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +stern -n aprs -l app=aprs +