diff --git a/Casks/d/deepl.rb b/Casks/d/deepl.rb index d79932ebb3424..40570879cf302 100644 --- a/Casks/d/deepl.rb +++ b/Casks/d/deepl.rb @@ -3,27 +3,43 @@ version "3.7.292629" sha256 "efcac4988a606d9793a3bdb8e7e73dce8e3d06ed2249a4434eb54c1624b40b87" - url "https://www.deepl.com/macos/download/#{version}/DeepL_#{version}.zip" + url "https://www.deepl.com/macos/download/old/#{version.major_minor}/#{version.patch}/DeepL.zip" livecheck do - url "https://appdownload.deepl.com/macos/update.json" - strategy :json do |json| - json["currentRelease"] + url "https://appdownload.deepl.com/macos/" + regex(%r{^old/v?(\d+(?:\.\d+)+)/(\d+(?:\.\d+)*)/DeepL\.(?:zip|tar\.gz)$}i) + strategy :xml do |xml| + xml.get_elements("//ListBucketResult//Contents//Key").map do |item| + match = item.text.match(regex) + next if match.blank? + + "#{match[1]}.#{match[2]}" + end end end + + depends_on macos: ">= :catalina" end - on_big_sur :or_newer do - version "24.1.2756848" - sha256 "ca6dc9700e4134925c0e3d74cddbc1b63e80b2e4edb3be5273fca1059236d8ad" + on_monterey :or_newer do + version "24.4.2912025" + sha256 "29283358a53110abe658dea93db7e4f2845439dca0f1e9a12aa37a65ac5315dc" - url "https://www.deepl.com/macos/download/#{version.major_minor}/#{version.patch}/DeepL_#{version}.tar.gz" + url "https://www.deepl.com/macos/download/#{version.major_minor}/#{version.patch}/DeepL.tar.gz" livecheck do - url "https://appdownload.deepl.com/macos/bigsur/update.json" - strategy :json do |json| - json["currentRelease"] + url "https://appdownload.deepl.com/macos/" + regex(%r{^v?(\d+(?:\.\d+)+)/(\d+(?:\.\d+)*)/DeepL\.tar\.gz$}i) + strategy :xml do |xml| + xml.get_elements("//ListBucketResult//Contents//Key").map do |item| + match = item.text.match(regex) + next if match.blank? + + "#{match[1]}.#{match[2]}" + end end end + + depends_on macos: ">= :monterey" end name "DeepL"