From 56f3565fb5f10bd4993438d6b9815b75dbafc7ef Mon Sep 17 00:00:00 2001 From: pwh-pwh Date: Mon, 29 Jul 2024 16:00:10 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=89=93=E5=8C=85=E5=90=8D=E7=A7=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 4 ++-- app.go | 2 +- build/windows/installer/wails_tools.nsh | 31 +++++++------------------ frontend/index.html | 2 +- main.go | 2 +- wails.json | 4 ++-- windows_init.go | 2 +- 7 files changed, 17 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8399fc..101dc9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,10 +20,10 @@ jobs: - name: 'App' platform: 'linux/amd64' os: 'ubuntu-latest' - - name: 'App.exe' + - name: 'ai-gui.exe' platform: 'windows/amd64' os: 'windows-latest' - - name: 'wailsdemo' + - name: 'ai-gui' platform: 'darwin/universal' os: 'macos-latest' diff --git a/app.go b/app.go index b3ab69c..d4647f7 100644 --- a/app.go +++ b/app.go @@ -29,6 +29,7 @@ func NewApp() *App { // so we can call the runtime methods func (a *App) startup(ctx context.Context) { a.ctx = ctx + InitWithApp() utils.InitConfigPath() fullFilePath := filepath.Join(utils.GetConfigPath(), CONFIG_FILE_NAME) exists := utils.FileExists(fullFilePath) @@ -51,7 +52,6 @@ func (a *App) startup(ctx context.Context) { } } a.chat = service.GetChatByConfig(conf) - InitWithApp() } // 对接 /loadconf diff --git a/build/windows/installer/wails_tools.nsh b/build/windows/installer/wails_tools.nsh index f9c0f88..9a1479f 100644 --- a/build/windows/installer/wails_tools.nsh +++ b/build/windows/installer/wails_tools.nsh @@ -5,19 +5,19 @@ !include "FileFunc.nsh" !ifndef INFO_PROJECTNAME - !define INFO_PROJECTNAME "{{.Name}}" + !define INFO_PROJECTNAME "ai-gui" !endif !ifndef INFO_COMPANYNAME - !define INFO_COMPANYNAME "{{.Info.CompanyName}}" + !define INFO_COMPANYNAME "ai-gui" !endif !ifndef INFO_PRODUCTNAME - !define INFO_PRODUCTNAME "{{.Info.ProductName}}" + !define INFO_PRODUCTNAME "ai-gui" !endif !ifndef INFO_PRODUCTVERSION - !define INFO_PRODUCTVERSION "{{.Info.ProductVersion}}" + !define INFO_PRODUCTVERSION "1.0.0" !endif !ifndef INFO_COPYRIGHT - !define INFO_COPYRIGHT "{{.Info.Copyright}}" + !define INFO_COPYRIGHT "Copyright........." !endif !ifndef PRODUCT_EXECUTABLE !define PRODUCT_EXECUTABLE "${INFO_PROJECTNAME}.exe" @@ -203,20 +203,12 @@ RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}" !macro wails.associateFiles ; Create file associations - {{range .Info.FileAssociations}} - !insertmacro APP_ASSOCIATE "{{.Ext}}" "{{.Name}}" "{{.Description}}" "$INSTDIR\{{.IconName}}.ico" "Open with ${INFO_PRODUCTNAME}" "$INSTDIR\${PRODUCT_EXECUTABLE} $\"%1$\"" - - File "..\{{.IconName}}.ico" - {{end}} + !macroend !macro wails.unassociateFiles ; Delete app associations - {{range .Info.FileAssociations}} - !insertmacro APP_UNASSOCIATE "{{.Ext}}" "{{.Name}}" - - Delete "$INSTDIR\{{.IconName}}.ico" - {{end}} + !macroend !macro CUSTOM_PROTOCOL_ASSOCIATE PROTOCOL DESCRIPTION ICON COMMAND @@ -235,15 +227,10 @@ RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}" !macro wails.associateCustomProtocols ; Create custom protocols associations - {{range .Info.Protocols}} - !insertmacro CUSTOM_PROTOCOL_ASSOCIATE "{{.Scheme}}" "{{.Description}}" "$INSTDIR\${PRODUCT_EXECUTABLE},0" "$INSTDIR\${PRODUCT_EXECUTABLE} $\"%1$\"" - - {{end}} + !macroend !macro wails.unassociateCustomProtocols ; Delete app custom protocol associations - {{range .Info.Protocols}} - !insertmacro CUSTOM_PROTOCOL_UNASSOCIATE "{{.Scheme}}" - {{end}} + !macroend diff --git a/frontend/index.html b/frontend/index.html index faf3452..4153cec 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,7 +3,7 @@ - wailsdemo + Ai-Gui
diff --git a/main.go b/main.go index 4224af6..167b78e 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ func main() { // Create application with options err := wails.Run(&options.App{ - Title: "wailsdemo", + Title: "Ai-Gui", Width: 500, Height: 668, AssetServer: &assetserver.Options{ diff --git a/wails.json b/wails.json index 7c3c825..8054a5d 100644 --- a/wails.json +++ b/wails.json @@ -1,7 +1,7 @@ { "$schema": "https://wails.io/schemas/config.v2.json", - "name": "wailsdemo", - "outputfilename": "wailsdemo", + "name": "ai-gui", + "outputfilename": "ai-gui", "frontend:install": "npm install", "frontend:build": "npm run build", "frontend:dev:watcher": "npm run dev", diff --git a/windows_init.go b/windows_init.go index 0df08d4..d865414 100644 --- a/windows_init.go +++ b/windows_init.go @@ -9,7 +9,7 @@ import ( ) func InitWithApp() { - wn, _ := syscall.UTF16PtrFromString("wailsdemo") + wn, _ := syscall.UTF16PtrFromString("Ai-Gui") hwnd := win.FindWindow(nil, wn) win.SetWindowLong(hwnd, win.GWL_EXSTYLE, win.GetWindowLong(hwnd, win.GWL_EXSTYLE)|win.WS_EX_LAYERED) }