瀏覽代碼

docs(desktop-pet): 双平台 CI、分发说明与 README

liaoxg 2 天之前
父節點
當前提交
b41503190b
共有 2 個文件被更改,包括 65 次插入 和 30 次删除
  1. 46 0
      cfc-desktop-pet/.github/workflows/release.yml
  2. 19 30
      cfc-desktop-pet/README.md

+ 46 - 0
cfc-desktop-pet/.github/workflows/release.yml

@@ -0,0 +1,46 @@
+name: desktop-pet-release
+
+on:
+  workflow_dispatch:
+  push:
+    tags: ["desktop-pet-v*"]
+
+jobs:
+  build:
+    permissions:
+      contents: write
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - platform: windows-latest
+            args: ""
+          - platform: macos-latest
+            args: "--target universal-apple-darwin"
+    runs-on: ${{ matrix.platform }}
+    steps:
+      - uses: actions/checkout@v4
+
+      - name: Rust toolchain
+        uses: dtolnay/rust-toolchain@stable
+        with:
+          targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
+
+      - name: Run tests
+        working-directory: cfc-desktop-pet/src-tauri
+        run: cargo test
+
+      - uses: tauri-apps/tauri-action@v0
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
+          TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
+          APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
+          APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
+          APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
+          APPLE_ID: ${{ secrets.APPLE_ID }}
+          APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
+          APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
+        with:
+          projectPath: cfc-desktop-pet
+          args: ${{ matrix.args }}

+ 19 - 30
cfc-desktop-pet/README.md

@@ -1,42 +1,31 @@
-# 浠艾福桌面宠物 (XafPet.Desktop)
+# 浠艾福桌面宠物(XafPet Desktop)
 
-Windows 桌面宠物应用,实时反映 CFC 健康陪跑状态。
+Windows + macOS 桌面宠物,展示五维能量 / 任务 / 打卡状态,点击宠物可完成喝水打卡。
 
-## 功能
+## 平台与产物
 
-- 显示今日任务进度 / 五维能量 / 健康打卡状态
-- 喝水提醒互动(点击宠物确认打卡)
-- 支持浠宝/福宝及自定义形象(PNG + pet-config.json)
-- 支持用户自定义状态(custom_state_1 ~ custom_state_10)
-- 托盘常驻,最小化到托盘,双击唤出
+| 平台 | 架构 | 产物 | 签名 |
+|------|------|------|------|
+| Windows | x64 | NSIS/MSI | Authenticode(CI,可选) |
+| macOS | Intel + Apple Silicon(universal) | DMG | Developer ID + notarytool 公证 |
 
-## 使用
-
-1. 发布:`dotnet publish src/XafPet.Desktop/XafPet.Desktop.csproj -c Release -r win-x64`
-2. 运行 `XafPet.Desktop.exe`
-3. 首次启动 → 右键托盘图标 → 设置 → 填入后端地址 + JWT Token
-4. 宠物出现在桌面右下角,可拖拽移动
-
-## 自定义宠物
-
-1. 在 `%APPDATA%\XafPet\pets\<名称>\` 放置 `standing.png` + `pet-config.json`
-2. 重启应用,设置中选择形象
+**macOS 透明窗口依赖私有 API(`macOSPrivateApi`),不可上架 Mac App Store,仅支持公证 DMG 分发。**
 
 ## 开发
 
 ```bash
-# 构建
-dotnet build XafPet.Desktop.sln
-
-# 测试(需 Windows 机器,.NET 6 SDK)
-dotnet test tests/XafPet.Desktop.Tests -v
+cargo install tauri-cli
+cd src-tauri
+cargo tauri dev        # 开发(需 CFC 后端 localhost:9082)
+cargo test             # 单元测试
+cargo tauri build      # 双平台产物
 ```
 
-## 环境要求
+## 结构
+
+- `src-tauri/src/`:Rust 主进程(API / 状态映射 / 轮询 / 令牌 / 托盘)
+- `src/`:Web 渲染层(零构建静态文件,`bridge.js` 负责 Tauri 桥接)
 
-- Windows 10 (1803+) / Windows 11
-- .NET 6 Runtime(发布时 Self-Contained,自带 WebView2 Runtime)
-- CFC 后端(localhost:9082)可选,不连接后端时宠物保持 idle 状态
+## 令牌
 
----
-> **注意:** 本项目仅在 Windows 上构建/运行。本代码仓库的其他模块(cfc-backend/cfc-web/cfc-frontend)不受影响。
+存储于系统安全存储:Windows Credential Manager / macOS Keychain(服务 `xafpet`)。从旧 WPF 版(DPAPI)升级需重新输入一次令牌。