mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-05-07 06:22:53 +08:00
feat: multi-OpenClaw CLI detection/binding + i18n infrastructure
Multi-OpenClaw Detection & Binding: - Add resolve_openclaw_cli_path() and classify_cli_source() in utils.rs - Support openclawCliPath binding in clawpanel.json (user selects CLI) - VersionInfo now includes cli_path, cli_source, all_installations - scan_all_installations() detects all OpenClaw installs on system - Dashboard shows CLI source label + multi-install warning - Settings page: CLI binding UI with auto-detect and manual selection - dev-api.js synced with cli_path/cli_source fields for Web mode i18n Infrastructure: - Create src/lib/i18n.js core module (t(), setLang(), initI18n()) - Create src/locales/zh-CN.json and src/locales/en.json - Sidebar fully i18n-ized (nav labels, sections, instance switcher) - Dashboard stat cards fully i18n-ized - Settings page: language switcher UI (live reload) - initI18n() called in main.js on startup
This commit is contained in:
@@ -2939,6 +2939,24 @@ const handlers = {
|
||||
const current = getLocalOpenclawVersion()
|
||||
const latest = await getLatestVersionFor(source)
|
||||
const recommended = recommendedVersionFor(source)
|
||||
|
||||
// CLI 路径解析(Web 模式下用 which/where)
|
||||
let cli_path = null
|
||||
let cli_source = null
|
||||
try {
|
||||
const { execSync } = require('child_process')
|
||||
const cmd = process.platform === 'win32' ? 'where openclaw' : 'which openclaw'
|
||||
const out = execSync(cmd, { timeout: 3000 }).toString().trim()
|
||||
cli_path = out.split('\n')[0]?.trim() || null
|
||||
if (cli_path) {
|
||||
const lower = cli_path.replace(/\\/g, '/').toLowerCase()
|
||||
if (lower.includes('/programs/openclaw/') || lower.includes('/openclaw-bin/') || lower.includes('/opt/openclaw/')) cli_source = 'standalone'
|
||||
else if (lower.includes('openclaw-zh') || lower.includes('@qingchencloud')) cli_source = 'npm-zh'
|
||||
else if (lower.includes('/npm/') || lower.includes('/node_modules/')) cli_source = 'npm-official'
|
||||
else cli_source = 'unknown'
|
||||
}
|
||||
} catch {}
|
||||
|
||||
return {
|
||||
current,
|
||||
latest,
|
||||
@@ -2948,7 +2966,10 @@ const handlers = {
|
||||
is_recommended: !!current && !!recommended && versionsMatch(current, recommended),
|
||||
ahead_of_recommended: !!current && !!recommended && recommendedIsNewer(current, recommended),
|
||||
panel_version: PANEL_VERSION,
|
||||
source
|
||||
source,
|
||||
cli_path,
|
||||
cli_source,
|
||||
all_installations: null
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user