From 9dd357be318ca85363a98d62418d318db953a3a7 Mon Sep 17 00:00:00 2001 From: Oscaner Miao Date: Mon, 23 Sep 2024 09:39:42 +0800 Subject: [PATCH] fix: wpsoffice-en --- Casks/w/wpsoffice-en.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Casks/w/wpsoffice-en.rb b/Casks/w/wpsoffice-en.rb index 40c4aa2..c4da590 100644 --- a/Casks/w/wpsoffice-en.rb +++ b/Casks/w/wpsoffice-en.rb @@ -1,23 +1,37 @@ cask "wpsoffice-en" do arch arm: "arm64", intel: "x64" - version "0024.21300060" + lang = "zh-CN" + channel = "0024.21300060" + hdid = "11a27203ebea456b23522df31cfd8095" + + version "6.10.0.8196" sha256 :no_check - url "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/macwpsoffice/download/installer/WPSOffice_#{arch}_#{version}.dmg", + url "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/macwpsoffice/download/installer/WPSOffice_#{arch}_#{channel}.dmg", verified: "wdl1.pcfg.cache.wpscdn.com/" name "WPS Office" desc "AI-Powered Office Suite for Everyone" homepage "https://www.wps.com/" livecheck do - skip "No Version Information Available" + url "https://api-web-param-us.wps.com/onlineParamByFunc?funcName=Mac_Update&version=#{version}&hdid=#{hdid}&lang=#{lang}&channel=#{channel}&devicetype=mac" + strategy :page_match do |page| + params = JSON.parse(page)["params"] + + next version if params.blank? + + params[0]["extras"].find { |extra| extra["key"] == "latest_version" }["value"] + end end auto_updates true depends_on macos: ">= :el_capitan" - app "wpsoffice.app" + installer script: { + executable: "WPS Office Installer.app/Contents/MacOS/WPS Office Installer", + args: ["-q"], + } uninstall quit: "com.kingsoft.wpsoffice.mac.global"