🎨 桌面端自动下载更新安装包 https://github.com/siyuan-note/siyuan/issues/5837

This commit is contained in:
Liang Ding 2022-09-08 10:29:27 +08:00
parent 684e430fe1
commit e4ddd99863
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 18 additions and 11 deletions

View file

@ -21,11 +21,12 @@ import (
)
type System struct {
ID string `json:"id"`
KernelVersion string `json:"kernelVersion"`
OS string `json:"os"`
Container string `json:"container"` // docker, android, ios, std
IsInsider bool `json:"isInsider"`
ID string `json:"id"`
KernelVersion string `json:"kernelVersion"`
OS string `json:"os"`
Container string `json:"container"` // docker, android, ios, std
IsMicrosoftStore bool `json:"isMicrosoftStore"`
IsInsider bool `json:"isInsider"`
HomeDir string `json:"homeDir"`
WorkspaceDir string `json:"workspaceDir"`

View file

@ -222,6 +222,7 @@ func InitConf() {
Conf.System.WorkspaceDir = util.WorkspaceDir
Conf.System.DataDir = util.DataDir
Conf.System.Container = util.Container
Conf.System.IsMicrosoftStore = util.ISMicrosoftStore
Conf.System.OS = runtime.GOOS
Conf.Newbie = util.IsNewbie
@ -375,7 +376,7 @@ func Close(force bool, execInstallPkg int) (exitCode int) {
//})
newVerInstallPkgPath := ""
if Conf.System.DownloadInstallPkg && 0 == execInstallPkg {
if Conf.System.DownloadInstallPkg && !util.ISMicrosoftStore && 0 == execInstallPkg {
newVerInstallPkgPath = GetNewVerInstallPkgPath()
if "" != newVerInstallPkgPath {
exitCode = 2

View file

@ -35,7 +35,7 @@ import (
)
func GetNewVerInstallPkgPath() string {
if !Conf.System.DownloadInstallPkg {
if !Conf.System.DownloadInstallPkg || util.ISMicrosoftStore {
return ""
}
@ -58,7 +58,7 @@ var checkDownloadInstallPkgLock = sync.Mutex{}
func checkDownloadInstallPkg() {
defer logging.Recover()
if !Conf.System.DownloadInstallPkg {
if !Conf.System.DownloadInstallPkg || util.ISMicrosoftStore {
return
}

View file

@ -83,6 +83,9 @@ func Boot() {
Container = ContainerDocker
}
msStoreFilePath := filepath.Join(WorkingDir, "ms-store")
ISMicrosoftStore = gulu.File.IsExist(msStoreFilePath)
UserAgent = UserAgent + " " + Container
httpclient.SetUserAgent(UserAgent)
@ -276,7 +279,8 @@ var (
AccessAuthCode string
Lang = ""
Container string // docker, android, ios, std
Container string // docker, android, ios, std
ISMicrosoftStore bool // 桌面端是否是微软商店版
)
const (