Release 2.7.1: fix macOS DMG launch, cores path and naive download.
Use UDZO DMG via hdiutil, store cores under Application Support, and match new naiveproxy mac asset names. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -64,7 +64,19 @@ func EnsureBinary(binDir string) (string, error) {
|
||||
if err := extractNaiveArchive(archivePath, binDir); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return ResolveBinary(binDir)
|
||||
path, err := ResolveBinary(binDir)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
clearQuarantine(path)
|
||||
return path, nil
|
||||
}
|
||||
|
||||
func clearQuarantine(path string) {
|
||||
if runtime.GOOS != "darwin" {
|
||||
return
|
||||
}
|
||||
_ = exec.Command("xattr", "-dr", "com.apple.quarantine", path).Run()
|
||||
}
|
||||
|
||||
func assetNameForPlatform() (string, error) {
|
||||
@@ -76,9 +88,11 @@ func assetNameForPlatform() (string, error) {
|
||||
case runtime.GOOS == "linux" && runtime.GOARCH == "amd64":
|
||||
return "naiveproxy-*-linux-x64.zip", nil
|
||||
case runtime.GOOS == "darwin" && runtime.GOARCH == "amd64":
|
||||
return "naiveproxy-*-mac-x64.tar.xz", nil
|
||||
// Newer releases use mac-x64-x64; older used mac-x64.
|
||||
return "naiveproxy-*-mac-x64", nil
|
||||
case runtime.GOOS == "darwin" && runtime.GOARCH == "arm64":
|
||||
return "naiveproxy-*-mac-arm64.tar.xz", nil
|
||||
// Newer releases use mac-arm64-arm64; older used mac-arm64.
|
||||
return "naiveproxy-*-mac-arm64", nil
|
||||
default:
|
||||
return "", fmt.Errorf("unsupported platform %s/%s for auto-download; place naive binary in bin/", runtime.GOOS, runtime.GOARCH)
|
||||
}
|
||||
@@ -114,14 +128,32 @@ func findReleaseAsset(pattern string) (name, downloadURL string, err error) {
|
||||
return "", "", err
|
||||
}
|
||||
prefix := strings.Split(pattern, "*")[0]
|
||||
suffix := ""
|
||||
if parts := strings.Split(pattern, "*"); len(parts) == 2 {
|
||||
suffix = parts[1]
|
||||
needle := ""
|
||||
if parts := strings.SplitN(pattern, "*", 2); len(parts) == 2 {
|
||||
needle = parts[1]
|
||||
}
|
||||
var bestName, bestURL string
|
||||
for _, a := range rel.Assets {
|
||||
if strings.HasPrefix(a.Name, prefix) && strings.HasSuffix(a.Name, suffix) {
|
||||
return a.Name, a.BrowserDownloadURL, nil
|
||||
name := a.Name
|
||||
if strings.Contains(name, "plugin") {
|
||||
continue
|
||||
}
|
||||
if !strings.HasPrefix(name, prefix) {
|
||||
continue
|
||||
}
|
||||
if needle != "" && !strings.Contains(name, needle) {
|
||||
continue
|
||||
}
|
||||
// Prefer desktop archives over openwrt/apk.
|
||||
if strings.HasSuffix(name, ".zip") || strings.HasSuffix(name, ".tar.xz") || strings.HasSuffix(name, ".txz") {
|
||||
return name, a.BrowserDownloadURL, nil
|
||||
}
|
||||
if bestName == "" {
|
||||
bestName, bestURL = name, a.BrowserDownloadURL
|
||||
}
|
||||
}
|
||||
if bestName != "" {
|
||||
return bestName, bestURL, nil
|
||||
}
|
||||
return "", "", fmt.Errorf("no asset matching %s in release %s", pattern, rel.TagName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user