mirror of
https://github.com/stashapp/stash.git
synced 2025-12-08 01:13:09 +01:00
Bug Fix: Update Macos Version Check (#6289)
This commit is contained in:
parent
a31df336f8
commit
367b96df0f
1 changed files with 21 additions and 1 deletions
|
|
@ -7,8 +7,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/sys/cpu"
|
"golang.org/x/sys/cpu"
|
||||||
|
|
@ -36,6 +38,24 @@ var stashReleases = func() map[string]string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isMacOSBundle checks if the application is running from within a macOS .app bundle
|
||||||
|
func isMacOSBundle() bool {
|
||||||
|
exec, err := os.Executable()
|
||||||
|
return err == nil && strings.Contains(exec, "Stash.app/")
|
||||||
|
}
|
||||||
|
|
||||||
|
// getWantedRelease determines which release variant to download based on platform and bundle type
|
||||||
|
func getWantedRelease(platform string) string {
|
||||||
|
release := stashReleases()[platform]
|
||||||
|
|
||||||
|
// On macOS, check if running from .app bundle
|
||||||
|
if runtime.GOOS == "darwin" && isMacOSBundle() {
|
||||||
|
return "Stash.app.zip"
|
||||||
|
}
|
||||||
|
|
||||||
|
return release
|
||||||
|
}
|
||||||
|
|
||||||
type githubReleasesResponse struct {
|
type githubReleasesResponse struct {
|
||||||
Url string
|
Url string
|
||||||
Assets_url string
|
Assets_url string
|
||||||
|
|
@ -168,7 +188,7 @@ func GetLatestRelease(ctx context.Context) (*LatestRelease, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
platform := fmt.Sprintf("%s/%s", runtime.GOOS, arch)
|
platform := fmt.Sprintf("%s/%s", runtime.GOOS, arch)
|
||||||
wantedRelease := stashReleases()[platform]
|
wantedRelease := getWantedRelease(platform)
|
||||||
|
|
||||||
url := apiReleases
|
url := apiReleases
|
||||||
if build.IsDevelop() {
|
if build.IsDevelop() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue