From eb9e065a3a19fba1aa799c64db2a3d21c18bbb54 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Mon, 20 Nov 2023 17:05:50 -0500 Subject: [PATCH] nwjs: update livecheck --- Casks/n/nwjs.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Casks/n/nwjs.rb b/Casks/n/nwjs.rb index 3c1076cf38..8eda34224d 100644 --- a/Casks/n/nwjs.rb +++ b/Casks/n/nwjs.rb @@ -10,9 +10,17 @@ cask "nwjs" do desc "Call all Node.js modules directly from the DOM and Web Workers" homepage "https://nwjs.io/" + # The upstream download page appends a UNIX epoch timestamp (in milliseconds) + # to the JSON URL, so we do the same (in case it affects the returned data). livecheck do - url "https://github.com/nwjs/nw.js" - regex(/^nw[._-]v?(\d+(?:\.\d+)+)$/i) + url "https://nwjs.io/versions.json?#{DateTime.now.strftime("%Q")}" + regex(/^v?(\d+(?:\.\d+)+)$/i) + strategy :json do |json, regex| + match = json["stable"]&.match(regex) + next if match.blank? + + match[1] + end end app "nwjs-sdk-v#{version}-osx-#{arch}/nwjs.app"