diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 671dc86..7d8ae32 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -174,12 +174,15 @@ jobs: working-directory: frontend run: npm run build + # 生成图标(构建前需要) + - name: 生成图标 + run: wails3 task common:generate:icons + shell: bash + # 使用 Wails Task 构建和打包应用 - name: 构建和打包 Wails 应用 - run: | - # 使用 wails3 task 执行平台特定的打包任务 - cd build/${{ matrix.platform_dir }} - wails3 task package PRODUCTION=true ARCH=${{ matrix.arch }} + working-directory: build/${{ matrix.platform_dir }} + run: wails3 task package PRODUCTION=true ARCH=${{ matrix.arch }} env: CGO_ENABLED: 1 APP_NAME: voidraft diff --git a/Taskfile.yml b/Taskfile.yml index f589c23..938975e 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -12,25 +12,13 @@ vars: VITE_PORT: '{{.WAILS_VITE_PORT | default 9245}}' tasks: - version: - summary: Generate version information - cmds: - - '{{if eq OS "windows"}}cmd /c ".\scripts\version.bat"{{else}}bash ./scripts/version.sh{{end}}' - sources: - - scripts/version.bat - - scripts/version.sh - generates: - - version.txt - build: summary: Builds the application - deps: [version] cmds: - task: "{{OS}}:build" package: summary: Packages a production build of the application - deps: [version] cmds: - task: "{{OS}}:package" diff --git a/build/linux/appimage/appicon.png b/build/linux/appimage/appicon.png index e69de29..613d223 100644 Binary files a/build/linux/appimage/appicon.png and b/build/linux/appimage/appicon.png differ diff --git a/internal/common/hotkey/hotkey_darwin.go b/internal/common/hotkey/hotkey_darwin.go index 25737c9..43b5810 100644 --- a/internal/common/hotkey/hotkey_darwin.go +++ b/internal/common/hotkey/hotkey_darwin.go @@ -20,6 +20,8 @@ const ( ModShift = darwin.ModShift ModOption = darwin.ModOption ModCmd = darwin.ModCmd + ModAlt = darwin.ModOption // Alias for ModOption (Alt key on macOS) + ModWin = darwin.ModCmd // Alias for ModCmd (Cmd key is like Win key) ) // Key represents a key. diff --git a/internal/common/hotkey/hotkey_linux.go b/internal/common/hotkey/hotkey_linux.go index 0ead90d..8b609c5 100644 --- a/internal/common/hotkey/hotkey_linux.go +++ b/internal/common/hotkey/hotkey_linux.go @@ -19,6 +19,7 @@ const ( ModCtrl = linux.ModCtrl ModShift = linux.ModShift ModAlt = linux.ModAlt // Alias for Mod1 + ModWin = linux.Mod4 // Super/Windows key is typically Mod4 on Linux Mod1 = linux.Mod1 Mod2 = linux.Mod2 Mod3 = linux.Mod3 diff --git a/internal/models/config.go b/internal/models/config.go index 596af9e..827c085 100644 --- a/internal/models/config.go +++ b/internal/models/config.go @@ -218,23 +218,3 @@ func NewDefaultAppConfig() *AppConfig { }, } } - -// GetVersion 获取配置版本 -func (ac *AppConfig) GetVersion() string { - return ac.Metadata.Version -} - -// SetVersion 设置配置版本 -func (ac *AppConfig) SetVersion(version string) { - ac.Metadata.Version = version -} - -// SetLastUpdated 设置最后更新时间 -func (ac *AppConfig) SetLastUpdated(timeStr string) { - ac.Metadata.LastUpdated = timeStr -} - -// GetDefaultConfig 获取默认配置 -func (ac *AppConfig) GetDefaultConfig() any { - return NewDefaultAppConfig() -} diff --git a/internal/services/self_update_service.go b/internal/services/self_update_service.go index 989d2eb..d0bbf1a 100644 --- a/internal/services/self_update_service.go +++ b/internal/services/self_update_service.go @@ -302,7 +302,9 @@ func (s *SelfUpdateService) handleUpdateSuccess(result *SelfUpdateResult) { if err := s.configService.Set("updates.version", result.LatestVersion); err != nil { s.logger.Error("update config version failed", "error", err) } - + if err := s.configService.Set("metadata.version", result.LatestVersion); err != nil { + s.logger.Error("update config version failed", "error", err) + } // 执行配置迁移 if err := s.configService.MigrateConfig(); err != nil { s.logger.Error("migrate config failed", "error", err) diff --git a/scripts/version.bat b/scripts/version.bat deleted file mode 100644 index 81ecec5..0000000 --- a/scripts/version.bat +++ /dev/null @@ -1,86 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -REM Simplified version management script - Windows version -REM Auto-increment patch version from git tags or use custom version - -REM Configuration section - Set custom version here if needed -set "CUSTOM_VERSION=" -REM Example: set "CUSTOM_VERSION=2.0.0" - -set "VERSION_FILE=version.txt" - -REM Check if custom version is set -if not "%CUSTOM_VERSION%"=="" ( - echo [INFO] Using custom version: %CUSTOM_VERSION% - set "VERSION=%CUSTOM_VERSION%" - goto :save_version -) - -REM Check if git is available -git --version >nul 2>&1 -if errorlevel 1 ( - echo [ERROR] Git is not installed or not in PATH - exit /b 1 -) - -REM Check if in git repository -git rev-parse --git-dir >nul 2>&1 -if errorlevel 1 ( - echo [ERROR] Not in a git repository - exit /b 1 -) - -REM Sync remote tags -echo [INFO] Syncing remote tags... -echo [INFO] Deleting local tags... -for /f "delims=" %%i in ('git tag -l') do git tag -d %%i >nul 2>&1 - -echo [INFO] Fetching remote tags... -git fetch origin --prune >nul 2>&1 -if errorlevel 1 ( - echo [WARNING] Failed to fetch from remote, using local tags -) else ( - echo [INFO] Remote tags synced successfully -) - -REM Get latest git tag -git describe --abbrev=0 --tags > temp_tag.txt 2>nul -if errorlevel 1 ( - echo [ERROR] No git tags found in repository - if exist temp_tag.txt del temp_tag.txt - exit /b 1 -) - -set /p LATEST_TAG= %VERSION_FILE% - -echo [INFO] Version information saved to %VERSION_FILE% \ No newline at end of file diff --git a/scripts/version.sh b/scripts/version.sh deleted file mode 100644 index fda8012..0000000 --- a/scripts/version.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# 配置区域 - 如需自定义版本,请在此处设置 -CUSTOM_VERSION="" -# 示例: CUSTOM_VERSION="2.0.0" - -VERSION_FILE="version.txt" - -# 检查是否设置了自定义版本 -if [ -n "$CUSTOM_VERSION" ]; then - echo "[INFO] Using custom version: $CUSTOM_VERSION" - VERSION="$CUSTOM_VERSION" -else - # 检查git是否可用 - if ! command -v git &> /dev/null; then - echo "[ERROR] Git is not installed or not in PATH" - exit 1 - elif ! git rev-parse --git-dir &> /dev/null; then - echo "[ERROR] Not in a git repository" - exit 1 - else - # 同步远程标签 - echo "[INFO] Syncing remote tags..." - echo "[INFO] Deleting local tags..." - git tag -l | xargs git tag -d &> /dev/null - - echo "[INFO] Fetching remote tags..." - if git fetch origin --prune &> /dev/null; then - echo "[INFO] Remote tags synced successfully" - else - echo "[WARNING] Failed to fetch from remote, using local tags" - fi - - # 获取最新的git标签 - LATEST_TAG=$(git describe --abbrev=0 --tags 2>/dev/null) - - if [ -z "$LATEST_TAG" ]; then - echo "[ERROR] No git tags found in repository" - exit 1 - else - echo "[INFO] Latest git tag: $LATEST_TAG" - - # 移除v前缀 - CLEAN_VERSION=${LATEST_TAG#v} - - # 分割版本号并递增patch版本 - IFS='.' read -r MAJOR MINOR PATCH <<< "$CLEAN_VERSION" - PATCH=$((PATCH + 1)) - - VERSION="$MAJOR.$MINOR.$PATCH" - echo "[INFO] Auto-incremented patch version: $VERSION" - fi - fi -fi - -# 输出版本信息 -echo "VERSION=$VERSION" - -# 保存到文件供其他脚本使用 -echo "VERSION=$VERSION" > "$VERSION_FILE" - -echo "[INFO] Version information saved to $VERSION_FILE" \ No newline at end of file