mirror of
https://gitee.com/energye/energy.git
synced 2024-12-02 03:37:48 +08:00
add: version, auto update
This commit is contained in:
parent
5b4660981a
commit
6103fb7fd9
29
cef/def.go
29
cef/def.go
@ -13,31 +13,32 @@
|
||||
package cef
|
||||
|
||||
import (
|
||||
"github.com/energye/energy/v2/cef/internal/version"
|
||||
"github.com/energye/energy/v2/common/imports"
|
||||
"github.com/energye/golcl/lcl/api"
|
||||
)
|
||||
|
||||
var (
|
||||
cef_version string
|
||||
lib_build_version string
|
||||
)
|
||||
// defInit
|
||||
// GlobalInit
|
||||
func defInit() {
|
||||
// Set pascal lib build version
|
||||
r1, _, _ := imports.Proc(internale_LibBuildVersion).Call()
|
||||
version.SetLibBuildVersion(api.GoStr(r1))
|
||||
}
|
||||
|
||||
// EnergyVersion 返回 Energy 版本
|
||||
func EnergyVersion() string {
|
||||
return version.Version()
|
||||
}
|
||||
|
||||
// CEFVersion 返回CEF版本
|
||||
func CEFVersion() string {
|
||||
if cef_version == "" {
|
||||
r1, _, _ := imports.Proc(internale_CEFVersion).Call()
|
||||
cef_version = api.GoStr(r1)
|
||||
}
|
||||
return cef_version
|
||||
return version.CEFVersion()
|
||||
}
|
||||
|
||||
// LibBuildVersion 返回lib-lcl构建版本
|
||||
func LibBuildVersion() string {
|
||||
if lib_build_version == "" {
|
||||
r1, _, _ := imports.Proc(internale_LibBuildVersion).Call()
|
||||
lib_build_version = api.GoStr(r1)
|
||||
}
|
||||
return lib_build_version
|
||||
return version.LibBuildVersion()
|
||||
}
|
||||
|
||||
// setMacOSXCommandLine
|
||||
|
@ -46,9 +46,13 @@ func GlobalInit(libs *embed.FS, resources *embed.FS) {
|
||||
if energyEnv != "" {
|
||||
macapp.MacApp.SetEnergyEnv(macapp.ENERGY_ENV(energyEnv))
|
||||
}
|
||||
// golcl
|
||||
inits.Init(libs, resources)
|
||||
//macos的命令行设置
|
||||
// def
|
||||
defInit()
|
||||
// macos command line
|
||||
setMacOSXCommandLine(api.PascalStr(Args.CommandLine()))
|
||||
// main thread run call
|
||||
applicationQueueAsyncCallInit()
|
||||
//应用低层出错异常捕获
|
||||
lcl.Application.SetOnException(func(sender lcl.IObject, e *lcl.Exception) {
|
||||
|
42
cef/internal/autoupdate/autoupdate.go
Normal file
42
cef/internal/autoupdate/autoupdate.go
Normal file
@ -0,0 +1,42 @@
|
||||
//----------------------------------------
|
||||
//
|
||||
// Copyright © yanghy. All Rights Reserved.
|
||||
//
|
||||
// Licensed under Apache License Version 2.0, January 2004
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//----------------------------------------
|
||||
|
||||
// Package autoupdate Energy check auto update
|
||||
package autoupdate
|
||||
|
||||
var (
|
||||
isCheckUpdate = true
|
||||
)
|
||||
|
||||
// CheckUpdate
|
||||
// 检查更新, isCheckUpdate 为true时
|
||||
func CheckUpdate() {
|
||||
if isCheckUpdate {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// IsCheckUpdate
|
||||
// 设置是否检查更新
|
||||
func IsCheckUpdate(v bool) {
|
||||
isCheckUpdate = v
|
||||
}
|
||||
|
||||
func UpdateLog() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func updatePrompt() {
|
||||
|
||||
}
|
||||
|
||||
func updateDownload() {
|
||||
|
||||
}
|
45
cef/internal/version/version.go
Normal file
45
cef/internal/version/version.go
Normal file
@ -0,0 +1,45 @@
|
||||
//----------------------------------------
|
||||
//
|
||||
// Copyright © yanghy. All Rights Reserved.
|
||||
//
|
||||
// Licensed under Apache License Version 2.0, January 2004
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//----------------------------------------
|
||||
|
||||
// Package version Energy framework version config
|
||||
package version
|
||||
|
||||
// Current Branch Version
|
||||
var (
|
||||
version = "2.0.1-beta" // energy
|
||||
libVersion = "2.0.1" // lib-lcl
|
||||
cefVersion = "1.109.18" // cef framework
|
||||
libBuildVersion = "" // pascal lib build
|
||||
)
|
||||
|
||||
// Version return energy version
|
||||
func Version() string {
|
||||
return version
|
||||
}
|
||||
|
||||
// LibVersion return lib-lcl version
|
||||
func LibVersion() string {
|
||||
return libVersion
|
||||
}
|
||||
|
||||
// CEFVersion return cef framework version
|
||||
func CEFVersion() string {
|
||||
return cefVersion
|
||||
}
|
||||
|
||||
// LibBuildVersion return pascal lib build version
|
||||
func LibBuildVersion() string {
|
||||
return libBuildVersion
|
||||
}
|
||||
|
||||
// SetLibBuildVersion Set pascal lib build version
|
||||
func SetLibBuildVersion(version string) {
|
||||
libBuildVersion = version
|
||||
}
|
@ -33,7 +33,7 @@ func main() {
|
||||
//环境变量 ENERGY_HOME="/app/cefframework" 配置框架所在目录
|
||||
//全局初始化
|
||||
cef.GlobalInit(&libs, &resources)
|
||||
fmt.Println("CEFVersion:", cef.CEFVersion(), "LibBuildVersion:", cef.LibBuildVersion())
|
||||
fmt.Println("CEFVersion:", cef.Version(), "LibBuildVersion:", cef.LibBuildVersion())
|
||||
//Render 子进程一些初始化配置
|
||||
cefApp := src.AppRenderInit()
|
||||
//Browser 主进程一些初始配置
|
||||
|
Loading…
Reference in New Issue
Block a user