mirror of https://github.com/jetkvm/kvm.git
Compare commits
1 Commits
38413bd2c6
...
4f5439fe7d
| Author | SHA1 | Date |
|---|---|---|
|
|
4f5439fe7d |
|
|
@ -14,7 +14,6 @@ set -ex
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
sudo apt-get update && \
|
sudo apt-get update && \
|
||||||
sudo apt-get install -y --no-install-recommends \
|
sudo apt-get install -y --no-install-recommends \
|
||||||
iputils-ping \
|
|
||||||
build-essential \
|
build-essential \
|
||||||
device-tree-compiler \
|
device-tree-compiler \
|
||||||
gperf g++-multilib gcc-multilib \
|
gperf g++-multilib gcc-multilib \
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ export interface RTCState {
|
||||||
peerConnection: RTCPeerConnection | null;
|
peerConnection: RTCPeerConnection | null;
|
||||||
setPeerConnection: (pc: RTCState["peerConnection"]) => void;
|
setPeerConnection: (pc: RTCState["peerConnection"]) => void;
|
||||||
|
|
||||||
setRpcDataChannel: (channel: RTCDataChannel | null) => void;
|
setRpcDataChannel: (channel: RTCDataChannel) => void;
|
||||||
rpcDataChannel: RTCDataChannel | null;
|
rpcDataChannel: RTCDataChannel | null;
|
||||||
|
|
||||||
hidRpcDisabled: boolean;
|
hidRpcDisabled: boolean;
|
||||||
|
|
@ -178,42 +178,41 @@ export const useRTCStore = create<RTCState>(set => ({
|
||||||
setPeerConnection: (pc: RTCState["peerConnection"]) => set({ peerConnection: pc }),
|
setPeerConnection: (pc: RTCState["peerConnection"]) => set({ peerConnection: pc }),
|
||||||
|
|
||||||
rpcDataChannel: null,
|
rpcDataChannel: null,
|
||||||
setRpcDataChannel: channel => set({ rpcDataChannel: channel }),
|
setRpcDataChannel: (channel: RTCDataChannel) => set({ rpcDataChannel: channel }),
|
||||||
|
|
||||||
hidRpcDisabled: false,
|
hidRpcDisabled: false,
|
||||||
setHidRpcDisabled: disabled => set({ hidRpcDisabled: disabled }),
|
setHidRpcDisabled: (disabled: boolean) => set({ hidRpcDisabled: disabled }),
|
||||||
|
|
||||||
rpcHidProtocolVersion: null,
|
rpcHidProtocolVersion: null,
|
||||||
setRpcHidProtocolVersion: version => set({ rpcHidProtocolVersion: version }),
|
setRpcHidProtocolVersion: (version: number | null) => set({ rpcHidProtocolVersion: version }),
|
||||||
|
|
||||||
rpcHidChannel: null,
|
rpcHidChannel: null,
|
||||||
setRpcHidChannel: channel => set({ rpcHidChannel: channel }),
|
setRpcHidChannel: (channel: RTCDataChannel) => set({ rpcHidChannel: channel }),
|
||||||
|
|
||||||
rpcHidUnreliableChannel: null,
|
rpcHidUnreliableChannel: null,
|
||||||
setRpcHidUnreliableChannel: channel => set({ rpcHidUnreliableChannel: channel }),
|
setRpcHidUnreliableChannel: (channel: RTCDataChannel) => set({ rpcHidUnreliableChannel: channel }),
|
||||||
|
|
||||||
rpcHidUnreliableNonOrderedChannel: null,
|
rpcHidUnreliableNonOrderedChannel: null,
|
||||||
setRpcHidUnreliableNonOrderedChannel: channel =>
|
setRpcHidUnreliableNonOrderedChannel: (channel: RTCDataChannel) => set({ rpcHidUnreliableNonOrderedChannel: channel }),
|
||||||
set({ rpcHidUnreliableNonOrderedChannel: channel }),
|
|
||||||
|
|
||||||
transceiver: null,
|
transceiver: null,
|
||||||
setTransceiver: transceiver => set({ transceiver }),
|
setTransceiver: (transceiver: RTCRtpTransceiver) => set({ transceiver }),
|
||||||
|
|
||||||
peerConnectionState: null,
|
peerConnectionState: null,
|
||||||
setPeerConnectionState: state => set({ peerConnectionState: state }),
|
setPeerConnectionState: (state: RTCPeerConnectionState) => set({ peerConnectionState: state }),
|
||||||
|
|
||||||
mediaStream: null,
|
mediaStream: null,
|
||||||
setMediaStream: stream => set({ mediaStream: stream }),
|
setMediaStream: (stream: MediaStream) => set({ mediaStream: stream }),
|
||||||
|
|
||||||
videoStreamStats: null,
|
videoStreamStats: null,
|
||||||
appendVideoStreamStats: stats => set({ videoStreamStats: stats }),
|
appendVideoStreamStats: (stats: RTCInboundRtpStreamStats) => set({ videoStreamStats: stats }),
|
||||||
videoStreamStatsHistory: new Map(),
|
videoStreamStatsHistory: new Map(),
|
||||||
|
|
||||||
isTurnServerInUse: false,
|
isTurnServerInUse: false,
|
||||||
setTurnServerInUse: inUse => set({ isTurnServerInUse: inUse }),
|
setTurnServerInUse: (inUse: boolean) => set({ isTurnServerInUse: inUse }),
|
||||||
|
|
||||||
inboundRtpStats: new Map(),
|
inboundRtpStats: new Map(),
|
||||||
appendInboundRtpStats: stats => {
|
appendInboundRtpStats: (stats: RTCInboundRtpStreamStats) => {
|
||||||
set(prevState => ({
|
set(prevState => ({
|
||||||
inboundRtpStats: appendStatToMap(stats, prevState.inboundRtpStats),
|
inboundRtpStats: appendStatToMap(stats, prevState.inboundRtpStats),
|
||||||
}));
|
}));
|
||||||
|
|
@ -221,7 +220,7 @@ export const useRTCStore = create<RTCState>(set => ({
|
||||||
clearInboundRtpStats: () => set({ inboundRtpStats: new Map() }),
|
clearInboundRtpStats: () => set({ inboundRtpStats: new Map() }),
|
||||||
|
|
||||||
candidatePairStats: new Map(),
|
candidatePairStats: new Map(),
|
||||||
appendCandidatePairStats: stats => {
|
appendCandidatePairStats: (stats: RTCIceCandidatePairStats) => {
|
||||||
set(prevState => ({
|
set(prevState => ({
|
||||||
candidatePairStats: appendStatToMap(stats, prevState.candidatePairStats),
|
candidatePairStats: appendStatToMap(stats, prevState.candidatePairStats),
|
||||||
}));
|
}));
|
||||||
|
|
@ -229,21 +228,21 @@ export const useRTCStore = create<RTCState>(set => ({
|
||||||
clearCandidatePairStats: () => set({ candidatePairStats: new Map() }),
|
clearCandidatePairStats: () => set({ candidatePairStats: new Map() }),
|
||||||
|
|
||||||
localCandidateStats: new Map(),
|
localCandidateStats: new Map(),
|
||||||
appendLocalCandidateStats: stats => {
|
appendLocalCandidateStats: (stats: RTCIceCandidateStats) => {
|
||||||
set(prevState => ({
|
set(prevState => ({
|
||||||
localCandidateStats: appendStatToMap(stats, prevState.localCandidateStats),
|
localCandidateStats: appendStatToMap(stats, prevState.localCandidateStats),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
remoteCandidateStats: new Map(),
|
remoteCandidateStats: new Map(),
|
||||||
appendRemoteCandidateStats: stats => {
|
appendRemoteCandidateStats: (stats: RTCIceCandidateStats) => {
|
||||||
set(prevState => ({
|
set(prevState => ({
|
||||||
remoteCandidateStats: appendStatToMap(stats, prevState.remoteCandidateStats),
|
remoteCandidateStats: appendStatToMap(stats, prevState.remoteCandidateStats),
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
diskDataChannelStats: new Map(),
|
diskDataChannelStats: new Map(),
|
||||||
appendDiskDataChannelStats: stats => {
|
appendDiskDataChannelStats: (stats: RTCDataChannelStats) => {
|
||||||
set(prevState => ({
|
set(prevState => ({
|
||||||
diskDataChannelStats: appendStatToMap(stats, prevState.diskDataChannelStats),
|
diskDataChannelStats: appendStatToMap(stats, prevState.diskDataChannelStats),
|
||||||
}));
|
}));
|
||||||
|
|
@ -251,7 +250,7 @@ export const useRTCStore = create<RTCState>(set => ({
|
||||||
|
|
||||||
// Add these new properties to the store implementation
|
// Add these new properties to the store implementation
|
||||||
terminalChannel: null,
|
terminalChannel: null,
|
||||||
setTerminalChannel: channel => set({ terminalChannel: channel }),
|
setTerminalChannel: (channel: RTCDataChannel) => set({ terminalChannel: channel }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export interface MouseMove {
|
export interface MouseMove {
|
||||||
|
|
@ -271,20 +270,12 @@ export interface MouseState {
|
||||||
export const useMouseStore = create<MouseState>(set => ({
|
export const useMouseStore = create<MouseState>(set => ({
|
||||||
mouseX: 0,
|
mouseX: 0,
|
||||||
mouseY: 0,
|
mouseY: 0,
|
||||||
setMouseMove: move => set({ mouseMove: move }),
|
setMouseMove: (move?: MouseMove) => set({ mouseMove: move }),
|
||||||
setMousePosition: (x, y) => set({ mouseX: x, mouseY: y }),
|
setMousePosition: (x: number, y: number) => set({ mouseX: x, mouseY: y }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export type HdmiStates =
|
export type HdmiStates = "ready" | "no_signal" | "no_lock" | "out_of_range" | "connecting";
|
||||||
| "ready"
|
export type HdmiErrorStates = Extract<VideoState["hdmiState"], "no_signal" | "no_lock" | "out_of_range">
|
||||||
| "no_signal"
|
|
||||||
| "no_lock"
|
|
||||||
| "out_of_range"
|
|
||||||
| "connecting";
|
|
||||||
export type HdmiErrorStates = Extract<
|
|
||||||
VideoState["hdmiState"],
|
|
||||||
"no_signal" | "no_lock" | "out_of_range"
|
|
||||||
>;
|
|
||||||
|
|
||||||
export interface HdmiState {
|
export interface HdmiState {
|
||||||
ready: boolean;
|
ready: boolean;
|
||||||
|
|
@ -299,7 +290,10 @@ export interface VideoState {
|
||||||
setClientSize: (width: number, height: number) => void;
|
setClientSize: (width: number, height: number) => void;
|
||||||
setSize: (width: number, height: number) => void;
|
setSize: (width: number, height: number) => void;
|
||||||
hdmiState: HdmiStates;
|
hdmiState: HdmiStates;
|
||||||
setHdmiState: (state: { ready: boolean; error?: HdmiErrorStates }) => void;
|
setHdmiState: (state: {
|
||||||
|
ready: boolean;
|
||||||
|
error?: HdmiErrorStates;
|
||||||
|
}) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useVideoStore = create<VideoState>(set => ({
|
export const useVideoStore = create<VideoState>(set => ({
|
||||||
|
|
@ -310,8 +304,7 @@ export const useVideoStore = create<VideoState>(set => ({
|
||||||
clientHeight: 0,
|
clientHeight: 0,
|
||||||
|
|
||||||
// The video element's client size
|
// The video element's client size
|
||||||
setClientSize: (clientWidth: number, clientHeight: number) =>
|
setClientSize: (clientWidth: number, clientHeight: number) => set({ clientWidth, clientHeight }),
|
||||||
set({ clientWidth, clientHeight }),
|
|
||||||
|
|
||||||
// Resolution
|
// Resolution
|
||||||
setSize: (width: number, height: number) => set({ width, height }),
|
setSize: (width: number, height: number) => set({ width, height }),
|
||||||
|
|
@ -458,15 +451,13 @@ export interface MountMediaState {
|
||||||
|
|
||||||
export const useMountMediaStore = create<MountMediaState>(set => ({
|
export const useMountMediaStore = create<MountMediaState>(set => ({
|
||||||
remoteVirtualMediaState: null,
|
remoteVirtualMediaState: null,
|
||||||
setRemoteVirtualMediaState: (state: MountMediaState["remoteVirtualMediaState"]) =>
|
setRemoteVirtualMediaState: (state: MountMediaState["remoteVirtualMediaState"]) => set({ remoteVirtualMediaState: state }),
|
||||||
set({ remoteVirtualMediaState: state }),
|
|
||||||
|
|
||||||
modalView: "mode",
|
modalView: "mode",
|
||||||
setModalView: (view: MountMediaState["modalView"]) => set({ modalView: view }),
|
setModalView: (view: MountMediaState["modalView"]) => set({ modalView: view }),
|
||||||
|
|
||||||
isMountMediaDialogOpen: false,
|
isMountMediaDialogOpen: false,
|
||||||
setIsMountMediaDialogOpen: (isOpen: MountMediaState["isMountMediaDialogOpen"]) =>
|
setIsMountMediaDialogOpen: (isOpen: MountMediaState["isMountMediaDialogOpen"]) => set({ isMountMediaDialogOpen: isOpen }),
|
||||||
set({ isMountMediaDialogOpen: isOpen }),
|
|
||||||
|
|
||||||
uploadedFiles: [],
|
uploadedFiles: [],
|
||||||
addUploadedFile: (file: { name: string; size: string; uploadedAt: string }) =>
|
addUploadedFile: (file: { name: string; size: string; uploadedAt: string }) =>
|
||||||
|
|
@ -483,7 +474,7 @@ export interface KeyboardLedState {
|
||||||
compose: boolean;
|
compose: boolean;
|
||||||
kana: boolean;
|
kana: boolean;
|
||||||
shift: boolean; // Optional, as not all keyboards have a shift LED
|
shift: boolean; // Optional, as not all keyboards have a shift LED
|
||||||
}
|
};
|
||||||
|
|
||||||
export const hidKeyBufferSize = 6;
|
export const hidKeyBufferSize = 6;
|
||||||
export const hidErrorRollOver = 0x01;
|
export const hidErrorRollOver = 0x01;
|
||||||
|
|
@ -518,23 +509,14 @@ export interface HidState {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useHidStore = create<HidState>(set => ({
|
export const useHidStore = create<HidState>(set => ({
|
||||||
keyboardLedState: {
|
keyboardLedState: { num_lock: false, caps_lock: false, scroll_lock: false, compose: false, kana: false, shift: false } as KeyboardLedState,
|
||||||
num_lock: false,
|
setKeyboardLedState: (ledState: KeyboardLedState): void => set({ keyboardLedState: ledState }),
|
||||||
caps_lock: false,
|
|
||||||
scroll_lock: false,
|
|
||||||
compose: false,
|
|
||||||
kana: false,
|
|
||||||
shift: false,
|
|
||||||
} as KeyboardLedState,
|
|
||||||
setKeyboardLedState: (ledState: KeyboardLedState): void =>
|
|
||||||
set({ keyboardLedState: ledState }),
|
|
||||||
|
|
||||||
keysDownState: { modifier: 0, keys: [0, 0, 0, 0, 0, 0] } as KeysDownState,
|
keysDownState: { modifier: 0, keys: [0, 0, 0, 0, 0, 0] } as KeysDownState,
|
||||||
setKeysDownState: (state: KeysDownState): void => set({ keysDownState: state }),
|
setKeysDownState: (state: KeysDownState): void => set({ keysDownState: state }),
|
||||||
|
|
||||||
isVirtualKeyboardEnabled: false,
|
isVirtualKeyboardEnabled: false,
|
||||||
setVirtualKeyboardEnabled: (enabled: boolean): void =>
|
setVirtualKeyboardEnabled: (enabled: boolean): void => set({ isVirtualKeyboardEnabled: enabled }),
|
||||||
set({ isVirtualKeyboardEnabled: enabled }),
|
|
||||||
|
|
||||||
isPasteInProgress: false,
|
isPasteInProgress: false,
|
||||||
setPasteModeEnabled: (enabled: boolean): void => set({ isPasteInProgress: enabled }),
|
setPasteModeEnabled: (enabled: boolean): void => set({ isPasteInProgress: enabled }),
|
||||||
|
|
@ -586,7 +568,7 @@ export interface OtaState {
|
||||||
|
|
||||||
systemUpdateProgress: number;
|
systemUpdateProgress: number;
|
||||||
systemUpdatedAt: string | null;
|
systemUpdatedAt: string | null;
|
||||||
}
|
};
|
||||||
|
|
||||||
export interface UpdateState {
|
export interface UpdateState {
|
||||||
isUpdatePending: boolean;
|
isUpdatePending: boolean;
|
||||||
|
|
@ -598,7 +580,7 @@ export interface UpdateState {
|
||||||
otaState: OtaState;
|
otaState: OtaState;
|
||||||
setOtaState: (state: OtaState) => void;
|
setOtaState: (state: OtaState) => void;
|
||||||
|
|
||||||
modalView: UpdateModalViews;
|
modalView: UpdateModalViews
|
||||||
setModalView: (view: UpdateModalViews) => void;
|
setModalView: (view: UpdateModalViews) => void;
|
||||||
|
|
||||||
updateErrorMessage: string | null;
|
updateErrorMessage: string | null;
|
||||||
|
|
@ -638,11 +620,12 @@ export const useUpdateStore = create<UpdateState>(set => ({
|
||||||
setModalView: (view: UpdateModalViews) => set({ modalView: view }),
|
setModalView: (view: UpdateModalViews) => set({ modalView: view }),
|
||||||
|
|
||||||
updateErrorMessage: null,
|
updateErrorMessage: null,
|
||||||
setUpdateErrorMessage: (errorMessage: string) =>
|
setUpdateErrorMessage: (errorMessage: string) => set({ updateErrorMessage: errorMessage }),
|
||||||
set({ updateErrorMessage: errorMessage }),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export type UsbConfigModalViews = "updateUsbConfig" | "updateUsbConfigSuccess";
|
export type UsbConfigModalViews =
|
||||||
|
| "updateUsbConfig"
|
||||||
|
| "updateUsbConfigSuccess";
|
||||||
|
|
||||||
export interface UsbConfigModalState {
|
export interface UsbConfigModalState {
|
||||||
modalView: UsbConfigModalViews;
|
modalView: UsbConfigModalViews;
|
||||||
|
|
@ -850,12 +833,12 @@ export interface MacrosState {
|
||||||
loadMacros: () => Promise<void>;
|
loadMacros: () => Promise<void>;
|
||||||
saveMacros: (macros: KeySequence[]) => Promise<void>;
|
saveMacros: (macros: KeySequence[]) => Promise<void>;
|
||||||
sendFn:
|
sendFn:
|
||||||
| ((
|
| ((
|
||||||
method: string,
|
method: string,
|
||||||
params: unknown,
|
params: unknown,
|
||||||
callback?: ((resp: JsonRpcResponse) => void) | undefined,
|
callback?: ((resp: JsonRpcResponse) => void) | undefined,
|
||||||
) => void)
|
) => void)
|
||||||
| null;
|
| null;
|
||||||
setSendFn: (
|
setSendFn: (
|
||||||
sendFn: (
|
sendFn: (
|
||||||
method: string,
|
method: string,
|
||||||
|
|
@ -995,5 +978,5 @@ export const useMacrosStore = create<MacrosState>((set, get) => ({
|
||||||
} finally {
|
} finally {
|
||||||
set({ loading: false });
|
set({ loading: false });
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue