From 42e9dffbed2ee4bb9e51b743d9f7ccf9ed02ba6c Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Sun, 21 Jan 2024 15:55:31 +1100 Subject: [PATCH] tastytrade: add livecheck --- Casks/t/tastytrade.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Casks/t/tastytrade.rb b/Casks/t/tastytrade.rb index 79a66ee6de..12003fb915 100644 --- a/Casks/t/tastytrade.rb +++ b/Casks/t/tastytrade.rb @@ -11,7 +11,19 @@ cask "tastytrade" do homepage "https://tastytrade.com/technology/" livecheck do - skip "No version information available" + url "https://tastytrade.com/page-data/technology/page-data.json" + strategy :json do |json| + static_hashes = json["staticQueryHashes"] + + version = static_hashes.map do |static_hash| + content = Homebrew::Livecheck::Strategy.page_content("https://tastytrade.com/page-data/sq/d/#{static_hash}.json") + next if content.blank? || content[:content].blank? + + hash_json = JSON.parse(content[:content]) + version = hash_json.dig("data", "contentstackGlobalSettings", "tastyworksSoftware", "desktopVersion") + break version if version.present? + end + end end auto_updates true