mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 11:13:43 +08:00
* feat(desktop): support remote lite build mode without bundled JRE/JAR Add a dual packaging mode system controlled by the BUILD_MODE env var: - **local** (default): Full build bundling JRE + Spring Boot JAR, identical to the previous behavior. Supports both embedded local backend and remote server connection. - **remote** (lite): Omits the ~530 MB JRE/JAR resources, producing an installer that is ~81% smaller (97 MB vs 523 MB on macOS arm64). The app only supports connecting to a remote server; the "local" option is hidden from the splash connection chooser. Changes: - Replace static electron-builder.json with dynamic electron-builder.cjs that conditionally includes extraResources based on BUILD_MODE - Add build mode detection at runtime (checks JAR existence) with graceful fallback to remote-only mode - Add IPC handler app:get-build-mode and expose via preload - Hide "本地运行" option in splash when running a remote build - Ignore stale 'local' saved config in remote builds - Add package scripts: package:mac:local, package:mac:remote, etc. - Add missing build scripts: build.sh, download-jre.sh, build-all-platforms.sh - Add no-op afterPack hook (trim-playwright-driver.cjs) placeholder - Add cross-env devDependency for cross-platform BUILD_MODE support * feat(desktop): add white-label branding system for build-time rebranding Add a Vite plugin (scripts/branding.cjs) that replaces hardcoded "MateClaw" strings at build time, enabling white-label/OEM rebranding without modifying any source code. Configuration: - Edit branding.config.json (name, tagline, team, copyright, appId, githubUrl) - Or set BRAND_* env vars (BRAND_NAME, BRAND_TAGLINE, BRAND_TEAM, etc.) Usage: # Default build (MateClaw brand) npm run package:mac # Custom brand via env vars BRAND_NAME=MyAI BRAND_TAGLINE="Smart AI Helper" npm run package:mac:remote # Or edit branding.config.json and build normally npm run package:mac:remote Replacements applied at build time: - Brand name (window title, About dialog, error messages, console logs) - Tagline, team name, copyright line - GitHub repo/issues URLs - Logo file path - electron-builder config (productName, appId, artifactName, dmg title, publish repo) The branding plugin runs in Vite's transform hook, covering the renderer (App.vue, index.html), electron main process, and preload script. Server-coupled strings (H2 database name, Spring Boot property names) are intentionally NOT replaced to avoid breaking backend compatibility. --------- Co-authored-by: qiaozhipeng <qiaozhipeng@daojia-inc.com>
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
/// <reference types="vite/client" />
|
|
|
|
declare module '*.vue' {
|
|
import type { DefineComponent } from 'vue'
|
|
const component: DefineComponent<{}, {}, any>
|
|
export default component
|
|
}
|
|
|
|
interface UpdaterState {
|
|
status: 'idle' | 'checking' | 'available' | 'not-available' | 'downloading' | 'downloaded' | 'error'
|
|
version?: string
|
|
releaseNotes?: string
|
|
progress?: { percent: number; bytesPerSecond: number; transferred: number; total: number }
|
|
error?: string
|
|
}
|
|
|
|
interface RemoteServer {
|
|
url: string
|
|
name?: string
|
|
lastUsed?: number
|
|
}
|
|
|
|
interface ConnectionConfigState {
|
|
mode: 'local' | 'remote' | null
|
|
remoteUrl: string
|
|
servers: RemoteServer[]
|
|
forceChoose: boolean
|
|
buildMode: 'local' | 'remote'
|
|
}
|
|
|
|
interface ConnectionTestResult {
|
|
ok: boolean
|
|
status?: number
|
|
error?: string
|
|
}
|
|
|
|
interface MateClawAPI {
|
|
getPlatform: () => Promise<string>
|
|
getVersion: () => Promise<string>
|
|
getBuildMode: () => Promise<'local' | 'remote'>
|
|
getBackendUrl: () => Promise<string>
|
|
isBackendReady: () => Promise<boolean>
|
|
getUserDataPath: () => Promise<string>
|
|
openExternal: (url: string) => Promise<void>
|
|
restartBackend: () => Promise<void>
|
|
onBackendStatus: (callback: (status: string) => void) => () => void
|
|
onBackendCrashed: (callback: (message: string) => void) => () => void
|
|
navigateToApp: () => void
|
|
|
|
// Connection management
|
|
getConnectionConfig: () => Promise<ConnectionConfigState>
|
|
testConnection: (url: string) => Promise<ConnectionTestResult>
|
|
useLocalConnection: () => Promise<void>
|
|
useRemoteConnection: (url: string) => Promise<ConnectionTestResult>
|
|
switchServer: () => Promise<void>
|
|
|
|
// Auto-updater
|
|
getUpdaterState: () => Promise<UpdaterState>
|
|
checkForUpdates: () => Promise<UpdaterState>
|
|
downloadUpdate: () => Promise<void>
|
|
installUpdate: () => Promise<void>
|
|
onUpdaterState: (callback: (state: UpdaterState) => void) => () => void
|
|
}
|
|
|
|
interface Window {
|
|
mateClawAPI: MateClawAPI
|
|
}
|