mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
feat(app): 添加版本信息,为更新推送做准备
- 在应用启动时打印版本号
This commit is contained in:
parent
8afc26badb
commit
1628381295
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
|||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Build wails
|
- name: Build wails
|
||||||
uses: ArvinLovegood/wails-build-action@v2.3
|
uses: ArvinLovegood/wails-build-action@v2.4
|
||||||
id: build
|
id: build
|
||||||
with:
|
with:
|
||||||
build-name: ${{ matrix.build.name }}
|
build-name: ${{ matrix.build.name }}
|
||||||
|
13
app.go
13
app.go
@ -37,6 +37,7 @@ func NewApp() *App {
|
|||||||
|
|
||||||
// startup is called at application startup
|
// startup is called at application startup
|
||||||
func (a *App) startup(ctx context.Context) {
|
func (a *App) startup(ctx context.Context) {
|
||||||
|
logger.SugaredLogger.Infof("Version:%s", Version)
|
||||||
// Perform your setup here
|
// Perform your setup here
|
||||||
a.ctx = ctx
|
a.ctx = ctx
|
||||||
|
|
||||||
@ -47,6 +48,18 @@ func (a *App) startup(ctx context.Context) {
|
|||||||
go onExit(a)
|
go onExit(a)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//检查新版本
|
||||||
|
go func() {
|
||||||
|
config := data.NewSettingsApi(&data.Settings{}).GetConfig()
|
||||||
|
if config.CheckUpdate {
|
||||||
|
checkUpdate(a)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkUpdate(a *App) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// domReady is called after front-end resources have been loaded
|
// domReady is called after front-end resources have been loaded
|
||||||
|
@ -22,6 +22,7 @@ type Settings struct {
|
|||||||
OpenAiMaxTokens int `json:"openAiMaxTokens"`
|
OpenAiMaxTokens int `json:"openAiMaxTokens"`
|
||||||
OpenAiTemperature float64 `json:"openAiTemperature"`
|
OpenAiTemperature float64 `json:"openAiTemperature"`
|
||||||
Prompt string `json:"prompt"`
|
Prompt string `json:"prompt"`
|
||||||
|
CheckUpdate bool `json:"checkUpdate"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (receiver Settings) TableName() string {
|
func (receiver Settings) TableName() string {
|
||||||
|
@ -74,6 +74,7 @@ export namespace data {
|
|||||||
openAiMaxTokens: number;
|
openAiMaxTokens: number;
|
||||||
openAiTemperature: number;
|
openAiTemperature: number;
|
||||||
prompt: string;
|
prompt: string;
|
||||||
|
checkUpdate: boolean;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
return new Settings(source);
|
return new Settings(source);
|
||||||
@ -98,6 +99,7 @@ export namespace data {
|
|||||||
this.openAiMaxTokens = source["openAiMaxTokens"];
|
this.openAiMaxTokens = source["openAiMaxTokens"];
|
||||||
this.openAiTemperature = source["openAiTemperature"];
|
this.openAiTemperature = source["openAiTemperature"];
|
||||||
this.prompt = source["prompt"];
|
this.prompt = source["prompt"];
|
||||||
|
this.checkUpdate = source["checkUpdate"];
|
||||||
}
|
}
|
||||||
|
|
||||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
5
main.go
5
main.go
@ -33,6 +33,9 @@ var icon2 []byte
|
|||||||
var stocksBin []byte
|
var stocksBin []byte
|
||||||
|
|
||||||
//go:generate cp -R ./data ./build/bin
|
//go:generate cp -R ./data ./build/bin
|
||||||
|
|
||||||
|
var Version string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
checkDir("data")
|
checkDir("data")
|
||||||
db.Init("")
|
db.Init("")
|
||||||
@ -82,7 +85,7 @@ func main() {
|
|||||||
//FileMenu.AddText("退出", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) {
|
//FileMenu.AddText("退出", keys.CmdOrCtrl("q"), func(_ *menu.CallbackData) {
|
||||||
// runtime.Quit(app.ctx)
|
// runtime.Quit(app.ctx)
|
||||||
//})
|
//})
|
||||||
|
logger.NewDefaultLogger().Info("version: " + Version)
|
||||||
// Create application with options
|
// Create application with options
|
||||||
err := wails.Run(&options.App{
|
err := wails.Run(&options.App{
|
||||||
Title: "go-stock",
|
Title: "go-stock",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user