Add Store MSIX packaging and dark/light theme for 2.9.0.

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Navis
2026-08-01 14:12:30 +03:00
co-authored by Cursor
parent 93017e2076
commit d42202a1cf
17 changed files with 706 additions and 63 deletions
+6
View File
@@ -0,0 +1,6 @@
//go:build !windows
package update
// IsStorePackaged is false outside Windows (no Microsoft Store / MSIX package identity).
func IsStorePackaged() bool { return false }
+49
View File
@@ -0,0 +1,49 @@
//go:build windows
package update
import (
"sync"
"unsafe"
"golang.org/x/sys/windows"
)
const (
appModelErrorNoPackage = 15700 // APPMODEL_ERROR_NO_PACKAGE
errorInsufficientBuffer = 122 // ERROR_INSUFFICIENT_BUFFER
)
var (
storeOnce sync.Once
storePackaged bool
)
// IsStorePackaged reports whether this process has an MSIX / Store package identity.
// Store builds must not self-update (Store owns updates).
func IsStorePackaged() bool {
storeOnce.Do(func() {
storePackaged = detectStorePackage()
})
return storePackaged
}
func detectStorePackage() bool {
mod := windows.NewLazySystemDLL("kernel32.dll")
proc := mod.NewProc("GetCurrentPackageFullName")
if err := proc.Find(); err != nil {
return false
}
var n uint32
r, _, _ := proc.Call(uintptr(unsafe.Pointer(&n)), 0)
switch r {
case appModelErrorNoPackage:
return false
case errorInsufficientBuffer:
return true
case 0:
return n > 0
default:
return false
}
}
+19 -12
View File
@@ -18,7 +18,7 @@ import (
// CurrentVersion is the product/semver used for update eligibility (feed "version").
// Keep major.minor.patch only — no build suffix here.
const CurrentVersion = "2.8.0"
const CurrentVersion = "2.9.0"
// BuildNumber is the monotonic build within CurrentVersion (Windows FileVersion 4th part,
// macOS CFBundleVersion suffix, Android versionCode low digits). Bump on every release build.
@@ -64,17 +64,18 @@ type Manifest struct {
// Status is returned to the UI / CLI.
type Status struct {
Current string `json:"current"`
Latest string `json:"latest,omitempty"`
Notes string `json:"notes,omitempty"`
URL string `json:"url,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Platform string `json:"platform,omitempty"`
Available bool `json:"available"`
Mandatory bool `json:"mandatory"`
Checking bool `json:"checking,omitempty"`
Error string `json:"error,omitempty"`
ManifestURL string `json:"manifest_url"`
Current string `json:"current"`
Latest string `json:"latest,omitempty"`
Notes string `json:"notes,omitempty"`
URL string `json:"url,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Platform string `json:"platform,omitempty"`
Available bool `json:"available"`
Mandatory bool `json:"mandatory"`
Checking bool `json:"checking,omitempty"`
Error string `json:"error,omitempty"`
ManifestURL string `json:"manifest_url"`
StoreManaged bool `json:"store_managed,omitempty"` // MSIX / Microsoft Store — no in-app updates
}
// PlatformKey is "GOOS-GOARCH", e.g. windows-amd64, darwin-arm64.
@@ -192,6 +193,12 @@ func Check(ctx context.Context, manifestURL string) (Status, error) {
}
key := PlatformKey()
st := Status{Current: DisplayVersion(), ManifestURL: manifestURL, Platform: key}
if IsStorePackaged() {
st.StoreManaged = true
st.Available = false
st.Notes = "Обновления через Microsoft Store"
return st, nil
}
m, err := fetchManifest(ctx, manifestURL)
if err != nil {
+3
View File
@@ -20,6 +20,9 @@ const finishUpdateFlag = "--navis-finish-update"
// Apply downloads the new build and replaces the running Navis.exe after this process exits.
func Apply(ctx context.Context, manifestURL string) (string, error) {
if IsStorePackaged() {
return "", fmt.Errorf("обновления устанавливаются через Microsoft Store")
}
latest, _, _, exe, tmp, err := prepareDownload(ctx, manifestURL)
if err != nil {
return "", err