mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-03-29 22:56:45 +08:00
feat(webrtc): 添加公共ICE服务器支持和优化HID延迟
- 重构ICE配置:将TURN配置改为统一的ICE配置,支持STUN和多TURN URL - 添加公共ICE服务器:类似RustDesk,用户留空时使用编译时配置的公共服务器 - 优化DataChannel HID消息:使用tokio::spawn立即处理,避免依赖webrtc-rs轮询 - 添加WebRTCReady事件:客户端等待此事件后再建立连接 - 初始化时启动音频流,确保WebRTC可订阅 - 移除多余的trace/debug日志减少开销 - 更新前端配置界面支持公共ICE服务器显示
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useSystemStore } from '@/stores/system'
|
||||
import {
|
||||
@@ -252,6 +252,12 @@ const config = ref({
|
||||
// 跟踪服务器是否已配置 TURN 密码
|
||||
const hasTurnPassword = ref(false)
|
||||
|
||||
// 跟踪公共 ICE 服务器状态
|
||||
const hasPublicIceServers = ref(false)
|
||||
const usingPublicIceServers = computed(() => {
|
||||
return !config.value.stun_server && !config.value.turn_server && hasPublicIceServers.value
|
||||
})
|
||||
|
||||
// OTG Descriptor settings
|
||||
const otgVendorIdHex = ref('1d6b')
|
||||
const otgProductIdHex = ref('0104')
|
||||
@@ -305,7 +311,7 @@ const selectedBackendFormats = computed(() => {
|
||||
})
|
||||
|
||||
// Video selection computed properties
|
||||
import { computed, watch } from 'vue'
|
||||
import { watch } from 'vue'
|
||||
|
||||
const selectedDevice = computed(() => {
|
||||
return devices.value.video.find(d => d.path === config.value.video_device)
|
||||
@@ -555,6 +561,9 @@ async function loadConfig() {
|
||||
// 设置是否已配置 TURN 密码
|
||||
hasTurnPassword.value = stream.has_turn_password || false
|
||||
|
||||
// 设置公共 ICE 服务器状态
|
||||
hasPublicIceServers.value = stream.has_public_ice_servers || false
|
||||
|
||||
// 加载 OTG 描述符配置
|
||||
if (hid.otg_descriptor) {
|
||||
otgVendorIdHex.value = hid.otg_descriptor.vendor_id?.toString(16).padStart(4, '0') || '1d6b'
|
||||
@@ -1068,7 +1077,7 @@ onMounted(async () => {
|
||||
|
||||
<template>
|
||||
<AppLayout>
|
||||
<div class="flex h-[calc(100vh-6rem)]">
|
||||
<div class="flex h-full overflow-hidden">
|
||||
<!-- Mobile Header -->
|
||||
<div class="lg:hidden fixed top-16 left-0 right-0 z-20 flex items-center justify-between px-4 py-3 border-b bg-background">
|
||||
<h1 class="text-lg font-semibold">{{ t('settings.title') }}</h1>
|
||||
@@ -1259,6 +1268,9 @@ onMounted(async () => {
|
||||
:placeholder="t('settings.stunServerPlaceholder')"
|
||||
/>
|
||||
<p class="text-xs text-muted-foreground">{{ t('settings.stunServerHint') }}</p>
|
||||
<p v-if="usingPublicIceServers && hasPublicIceServers" class="text-xs text-blue-500">
|
||||
{{ t('settings.usingPublicIceServers') }}
|
||||
</p>
|
||||
</div>
|
||||
<Separator />
|
||||
<div class="space-y-2">
|
||||
|
||||
Reference in New Issue
Block a user