From 34dff0a3aac034215add6481f1c21194be9538f3 Mon Sep 17 00:00:00 2001 From: Marc Brooks Date: Thu, 28 Aug 2025 13:26:05 -0500 Subject: [PATCH] Removed diskChannel and localFile --- ui/src/hooks/stores.ts | 12 ------------ ui/src/routes/devices.$id.mount.tsx | 2 -- ui/src/routes/devices.$id.tsx | 27 --------------------------- webrtc.go | 1 - 4 files changed, 42 deletions(-) diff --git a/ui/src/hooks/stores.ts b/ui/src/hooks/stores.ts index 5fe96b5..819ccc2 100644 --- a/ui/src/hooks/stores.ts +++ b/ui/src/hooks/stores.ts @@ -105,9 +105,6 @@ export interface RTCState { setRpcDataChannel: (channel: RTCDataChannel) => void; rpcDataChannel: RTCDataChannel | null; - diskChannel: RTCDataChannel | null; - setDiskChannel: (channel: RTCDataChannel) => void; - peerConnectionState: RTCPeerConnectionState | null; setPeerConnectionState: (state: RTCPeerConnectionState) => void; @@ -160,9 +157,6 @@ export const useRTCStore = create(set => ({ peerConnectionState: null, setPeerConnectionState: (state: RTCPeerConnectionState) => set({ peerConnectionState: state }), - diskChannel: null, - setDiskChannel: (channel: RTCDataChannel) => set({ diskChannel: channel }), - mediaStream: null, setMediaStream: (stream: MediaStream) => set({ mediaStream: stream }), @@ -390,9 +384,6 @@ export interface RemoteVirtualMediaState { } export interface MountMediaState { - localFile: File | null; - setLocalFile: (file: MountMediaState["localFile"]) => void; - remoteVirtualMediaState: RemoteVirtualMediaState | null; setRemoteVirtualMediaState: (state: MountMediaState["remoteVirtualMediaState"]) => void; @@ -410,9 +401,6 @@ export interface MountMediaState { } export const useMountMediaStore = create(set => ({ - localFile: null, - setLocalFile: (file: MountMediaState["localFile"]) => set({ localFile: file }), - remoteVirtualMediaState: null, setRemoteVirtualMediaState: (state: MountMediaState["remoteVirtualMediaState"]) => set({ remoteVirtualMediaState: state }), diff --git a/ui/src/routes/devices.$id.mount.tsx b/ui/src/routes/devices.$id.mount.tsx index 3361f38..68979be 100644 --- a/ui/src/routes/devices.$id.mount.tsx +++ b/ui/src/routes/devices.$id.mount.tsx @@ -48,7 +48,6 @@ export function Dialog({ onClose }: { onClose: () => void }) { const { modalView, setModalView, - setLocalFile, setRemoteVirtualMediaState, errorMessage, setErrorMessage, @@ -58,7 +57,6 @@ export function Dialog({ onClose }: { onClose: () => void }) { const [incompleteFileName, setIncompleteFileName] = useState(null); const [mountInProgress, setMountInProgress] = useState(false); function clearMountMediaState() { - setLocalFile(null); setRemoteVirtualMediaState(null); } diff --git a/ui/src/routes/devices.$id.tsx b/ui/src/routes/devices.$id.tsx index b746e13..9be05f6 100644 --- a/ui/src/routes/devices.$id.tsx +++ b/ui/src/routes/devices.$id.tsx @@ -29,7 +29,6 @@ import { USBStates, useDeviceStore, useHidStore, - useMountMediaStore, useNetworkStateStore, User, useRTCStore, @@ -132,7 +131,6 @@ export default function KvmIdRoute() { const { peerConnection, setPeerConnection, peerConnectionState, setPeerConnectionState, - diskChannel, setDiskChannel, setMediaStream, setRpcDataChannel, isTurnServerInUse, setTurnServerInUse, @@ -484,18 +482,12 @@ export default function KvmIdRoute() { setRpcDataChannel(rpcDataChannel); }; - const diskDataChannel = pc.createDataChannel("disk"); - diskDataChannel.onopen = () => { - setDiskChannel(diskDataChannel); - }; - setPeerConnection(pc); }, [ cleanupAndStopReconnecting, iceConfig?.iceServers, legacyHTTPSignaling, sendWebRTCSignal, - setDiskChannel, setMediaStream, setPeerConnection, setPeerConnectionState, @@ -719,25 +711,6 @@ export default function KvmIdRoute() { } }, [navigate, navigateTo, queryParams, setModalView, setQueryParams]); - const { localFile } = useMountMediaStore(); - useEffect(() => { - if (!diskChannel || !localFile) return; - diskChannel.onmessage = async e => { - console.debug("Received", e.data); - const data = JSON.parse(e.data); - const blob = localFile.slice(data.start, data.end); - const buf = await blob.arrayBuffer(); - const header = new ArrayBuffer(16); - const headerView = new DataView(header); - headerView.setBigUint64(0, BigInt(data.start), false); // start offset, big-endian - headerView.setBigUint64(8, BigInt(buf.byteLength), false); // length, big-endian - const fullData = new Uint8Array(header.byteLength + buf.byteLength); - fullData.set(new Uint8Array(header), 0); - fullData.set(new Uint8Array(buf), header.byteLength); - diskChannel.send(fullData); - }; - }, [diskChannel, localFile]); - // System update const [kvmTerminal, setKvmTerminal] = useState(null); const [serialConsole, setSerialConsole] = useState(null); diff --git a/webrtc.go b/webrtc.go index d9a039d..c0f159a 100644 --- a/webrtc.go +++ b/webrtc.go @@ -21,7 +21,6 @@ type Session struct { ControlChannel *webrtc.DataChannel RPCChannel *webrtc.DataChannel HidChannel *webrtc.DataChannel - DiskChannel *webrtc.DataChannel shouldUmountVirtualMedia bool rpcQueue chan webrtc.DataChannelMessage }