mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-14 11:42:02 +08:00
fix:改进atx usb 继电器适配;修复 webrtc 无法建立连接问题;网页样式优化
This commit is contained in:
15
web/src/lib/debugLog.ts
Normal file
15
web/src/lib/debugLog.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export function isDebugLogEnabled(): boolean {
|
||||
if (typeof window === 'undefined') return false
|
||||
return new URLSearchParams(window.location.search).get('log') === 'debug'
|
||||
}
|
||||
|
||||
export function videoDebugLog(message: string, details?: unknown): void {
|
||||
if (!isDebugLogEnabled()) return
|
||||
|
||||
const timestamp = new Date().toISOString()
|
||||
if (details === undefined) {
|
||||
console.log(`[VideoDebug ${timestamp}] ${message}`)
|
||||
} else {
|
||||
console.log(`[VideoDebug ${timestamp}] ${message}`, details)
|
||||
}
|
||||
}
|
||||
11
web/src/lib/streamSignal.ts
Normal file
11
web/src/lib/streamSignal.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { StreamDeviceLostEventData } from '@/types/websocket'
|
||||
|
||||
const AUDIO_STATE_REASONS = new Set(['audio_device_lost', 'audio_reconnecting'])
|
||||
|
||||
export function isAudioDeviceLostStateReason(reason: string | null | undefined): boolean {
|
||||
return typeof reason === 'string' && AUDIO_STATE_REASONS.has(reason)
|
||||
}
|
||||
|
||||
export function isAudioStreamDeviceLostPayload(data: StreamDeviceLostEventData): boolean {
|
||||
return data.kind === 'audio'
|
||||
}
|
||||
Reference in New Issue
Block a user