This commit is contained in:
Graham McIntire 2026-02-25 16:29:26 -06:00
parent d643f0a592
commit f4db38f051
No known key found for this signature in database
2 changed files with 19 additions and 6 deletions

View file

@ -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)

4
tail_logs.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
stern -n aprs -l app=aprs