fix(web): 修复初始化向导未应用所选 HID 配置

This commit is contained in:
mofeng-git
2026-09-26 11:46:32 +08:00
parent 0e8c323659
commit f8fb64ad8c
4 changed files with 154 additions and 48 deletions

View File

@@ -169,7 +169,8 @@ export const systemApi = {
video_width?: number
video_height?: number
video_fps?: number
hid_backend?: string
hid_backend?: 'otg' | 'ch9329' | 'bluetooth' | 'none'
hid_bluetooth?: { adapter: string; name: string }
hid_ch9329_port?: string
hid_ch9329_baudrate?: number
hid_otg_udc?: string

View File

@@ -107,26 +107,7 @@ export const useAuthStore = defineStore('auth', () => {
}
}
async function setup(data: {
username: string
password: string
video_device?: string
video_format?: string
video_width?: number
video_height?: number
video_fps?: number
hid_backend?: string
hid_ch9329_port?: string
hid_ch9329_baudrate?: number
hid_otg_udc?: string
hid_otg_profile?: string
hid_otg_keyboard_leds?: boolean
msd_enabled?: boolean
encoder_backend?: string
audio_device?: string
ttyd_enabled?: boolean
rustdesk_enabled?: boolean
}) {
async function setup(data: Parameters<typeof systemApi.setup>[0]) {
loading.value = true
error.value = null

View File

@@ -347,7 +347,7 @@ function prevStep() {
async function handleSetup() {
error.value = ''
if (loading.value) return
if (loading.value || !validateStep3()) return
loading.value = true
// Reconcile a previous timed-out account request before submitting again.
@@ -385,7 +385,16 @@ async function handleSetup() {
setupData.video_fps = toConfigFps(videoFps.value)
}
setupData.hid_backend = 'none'
const hid = hidSelection.value
setupData.hid_backend = hid.backend
if (hid.backend === 'ch9329') {
setupData.hid_ch9329_port = hid.ch9329_port
setupData.hid_ch9329_baudrate = hid.ch9329_baudrate
} else if (hid.backend === 'otg') {
setupData.hid_otg_udc = hid.otg_udc
} else if (hid.backend === 'bluetooth') {
setupData.hid_bluetooth = { ...hid.bluetooth }
}
setupData.msd_enabled = false
// Encoder backend setting