Update App version to 0.0.4

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
luckfox-eng29
2025-11-11 20:38:22 +08:00
parent 4e82b8a11c
commit 5e17c52afc
41 changed files with 3537 additions and 598 deletions

View File

@@ -346,6 +346,9 @@ interface SettingsState {
showPressedKeys: boolean;
setShowPressedKeys: (show: boolean) => void;
overrideCtrlV: boolean;
setOverrideCtrlV: (enabled: boolean) => void;
// Video enhancement settings
videoSaturation: number;
setVideoSaturation: (value: number) => void;
@@ -409,6 +412,9 @@ export const useSettingsStore = create(
showPressedKeys: true,
setShowPressedKeys: show => set({ showPressedKeys: show }),
overrideCtrlV: false,
setOverrideCtrlV: enabled => set({ overrideCtrlV: enabled }),
// Video enhancement settings with default values (1.0 = normal)
videoSaturation: 1.0,
setVideoSaturation: value => set({ videoSaturation: value }),
@@ -524,6 +530,9 @@ export interface HidState {
usbState: "configured" | "attached" | "not attached" | "suspended" | "addressed" | "default";
setUsbState: (state: HidState["usbState"]) => void;
isReinitializingGadget: boolean;
setIsReinitializingGadget: (reinitializing: boolean) => void;
}
export const useHidStore = create<HidState>((set, get) => ({
@@ -571,6 +580,9 @@ export const useHidStore = create<HidState>((set, get) => ({
// Add these new properties for USB state
usbState: "not attached",
setUsbState: state => set({ usbState: state }),
isReinitializingGadget: false,
setIsReinitializingGadget: reinitializing => set({ isReinitializingGadget: reinitializing }),
}));
@@ -808,15 +820,25 @@ export type TimeSyncMode =
| "custom"
| "unknown";
export interface IPv4StaticConfig {
address?: string;
netmask?: string;
gateway?: string;
dns?: string[];
}
export interface NetworkSettings {
hostname: string;
domain: string;
ipv4_mode: IPv4Mode;
ipv4_request_address?: string;
ipv4_static?: IPv4StaticConfig;
ipv6_mode: IPv6Mode;
lldp_mode: LLDPMode;
lldp_tx_tlvs: string[];
mdns_mode: mDNSMode;
time_sync_mode: TimeSyncMode;
pending_reboot?: boolean;
}
export const useNetworkStateStore = create<NetworkState>((set, get) => ({

View File

@@ -57,7 +57,13 @@ export function useJsonRpc(onRequest?: (payload: JsonRpcRequest) => void) {
// The "API" can also "request" data from the client
// If the payload has a method, it's a request
if ("method" in payload) {
if (onRequest) onRequest(payload);
if ((payload as JsonRpcRequest).method === "refreshPage") {
const currentUrl = new URL(window.location.href);
currentUrl.searchParams.set("networkChanged", "true");
window.location.href = currentUrl.toString();
return;
}
if (onRequest) onRequest(payload as JsonRpcRequest);
return;
}

View File

@@ -1,4 +1,5 @@
import { useCallback } from "react";
import notifications from "@/notifications";
import { useHidStore, useRTCStore } from "@/hooks/stores";
import { useJsonRpc } from "@/hooks/useJsonRpc";
@@ -11,18 +12,31 @@ export default function useKeyboard() {
const updateActiveKeysAndModifiers = useHidStore(
state => state.updateActiveKeysAndModifiers,
);
const isReinitializingGadget = useHidStore(state => state.isReinitializingGadget);
const usbState = useHidStore(state => state.usbState);
const sendKeyboardEvent = useCallback(
(keys: number[], modifiers: number[]) => {
if (rpcDataChannel?.readyState !== "open") return;
// Don't send keyboard events while reinitializing gadget
if (isReinitializingGadget) return;
if (usbState !== "configured") return;
const accModifier = modifiers.reduce((acc, val) => acc + val, 0);
send("keyboardReport", { keys, modifier: accModifier });
send("keyboardReport", { keys, modifier: accModifier }, resp => {
if ("error" in resp) {
const msg = (resp.error.data as string) || resp.error.message || "";
if (msg.includes("cannot send after transport endpoint shutdown") && usbState === "configured") {
notifications.error("Please check if the cable and connection are stable.", { duration: 5000 });
}
}
});
// We do this for the info bar to display the currently pressed keys for the user
updateActiveKeysAndModifiers({ keys: keys, modifiers: modifiers });
},
[rpcDataChannel?.readyState, send, updateActiveKeysAndModifiers],
[rpcDataChannel?.readyState, send, updateActiveKeysAndModifiers, isReinitializingGadget, usbState],
);
const resetKeyboardState = useCallback(() => {