Skip to content

Fix macosx ventura updater #768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed update URL for different update methods
  • Loading branch information
cmaglie committed Feb 14, 2023
commit a484330b9c58bcee2748ff3b92b4549b8f7139f8
4 changes: 2 additions & 2 deletions updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const (
plat = runtime.GOOS + "-" + runtime.GOARCH
)

func fetchInfo(updateAPIURL string, cmdName string) (*availableUpdateInfo, error) {
r, err := fetch(updateAPIURL + cmdName + "/" + plat + ".json")
func fetchInfo(updateAPIURL string) (*availableUpdateInfo, error) {
r, err := fetch(updateAPIURL)
if err != nil {
return nil, err
}
Expand Down
17 changes: 15 additions & 2 deletions updater/updater_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
"fmt"
"io"
"os"
"runtime"

"github.com/arduino/go-paths-helper"
"github.com/codeclysm/extract/v3"
Expand All @@ -70,7 +71,13 @@ func checkForUpdates(currentVersion string, updateURL string, cmdName string) (s
}

// Fetch information about updates
info, err := fetchInfo(updateURL, cmdName)

// updateURL: "https://downloads.arduino.cc/"
// cmdName: "CreateAgent/Stable"
// plat: "darwin-amd64"
// info URL: "https://downloads.arduino.cc/CreateAgent/Stable/darwin-amd64-bundle.json"
infoURL := updateURL + cmdName + "/" + plat + "-bundle.json"
info, err := fetchInfo(infoURL)
if err != nil {
return "", err
}
Expand All @@ -88,7 +95,13 @@ func checkForUpdates(currentVersion string, updateURL string, cmdName string) (s
defer tmp.RemoveAll()

// Download the update.
downloadURL := updateURL + cmdName + "/" + info.Version + "/ArduinoCreateAgent.app_notarized.zip"

// updateURL: "https://downloads.arduino.cc/"
// cmdName == "CreateAgent/Stable"
// info.Version == "1.2.8"
// runtime.GOARCH: "amd64"
// downloadURL: "https://downloads.arduino.cc/CreateAgent/Stable/1.2.8/ArduinoCreateAgent.app_arm64_notarized.zip"
downloadURL := updateURL + cmdName + "/" + info.Version + "/ArduinoCreateAgent.app_" + runtime.GOARCH + "_notarized.zip"
logrus.WithField("url", downloadURL).Info("Downloading update")
download, err := fetch(downloadURL)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion updater/updater_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ func (u *Updater) update() error {
}
defer old.Close()

info, err := fetchInfo(u.UpdateURL, u.CmdName)
infoURL := u.UpdateURL + u.CmdName + "/" + plat + ".json"
info, err := fetchInfo(infoURL)
if err != nil {
log.Println(err)
return err
Expand Down