From 10159f7ba7a97d6de24b922e0933c7b0d91b431e Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 7 Jul 2025 14:21:56 -0500 Subject: [PATCH] fix parser version check --- lib/aprsme/dependency_info.ex | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/aprsme/dependency_info.ex b/lib/aprsme/dependency_info.ex index e61668a..69cd2ed 100644 --- a/lib/aprsme/dependency_info.ex +++ b/lib/aprsme/dependency_info.ex @@ -30,15 +30,6 @@ defmodule Aprsme.DependencyInfo do _ -> nil end - defp fetch_aprs_sha_from_github do - resp = Req.get!("https://api.github.com/repos/aprsme/aprs/commits/main") - body = resp.body - sha = body["sha"] || body |> Jason.decode!() |> Access.get("sha") - String.slice(sha, 0, 7) - rescue - _ -> nil - end - def latest_aprs_library_sha do resp = Req.get!("https://api.github.com/repos/aprsme/aprs/commits/main") body = resp.body @@ -62,14 +53,21 @@ defmodule Aprsme.DependencyInfo do # Try to read from the file copied during build hash_file = Path.join(["/app", "parser_hash.txt"]) - if File.exists?(hash_file) do - case File.read(hash_file) do - {:ok, hash} -> String.trim(hash) - _ -> "unknown" + # Try alternative paths + alternative_paths = [ + hash_file, + Path.join([File.cwd!(), "parser_hash.txt"]), + "parser_hash.txt" + ] + + Enum.find_value(alternative_paths, "unknown", fn path -> + if File.exists?(path) do + case File.read(path) do + {:ok, hash} -> String.trim(hash) + _ -> nil + end end - else - "unknown" - end + end) hash -> hash