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

This commit is contained in:
Liang Ding 2022-09-08 09:55:29 +08:00
parent 8f6ffd4dcd
commit 313143304b
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 83 additions and 20 deletions

View file

@ -34,16 +34,23 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func isExistUpdateInstallPkg() bool {
func GetNewVerInstallPkgPath() string {
if !Conf.System.DownloadInstallPkg {
return ""
}
downloadPkgURL, checksum, err := getUpdatePkg()
if nil != err {
return false
return ""
}
pkg := path.Base(downloadPkgURL)
savePath := filepath.Join(util.TempDir, "install", pkg)
localChecksum, _ := sha256Hash(savePath)
return checksum == localChecksum
ret := filepath.Join(util.TempDir, "install", pkg)
localChecksum, _ := sha256Hash(ret)
if checksum != localChecksum {
return ""
}
return ret
}
var checkDownloadInstallPkgLock = sync.Mutex{}