mirror of https://github.com/jetkvm/kvm.git
Compare commits
4 Commits
2ff93e7342
...
f7918a0f6c
| Author | SHA1 | Date |
|---|---|---|
|
|
f7918a0f6c | |
|
|
8e00b3d581 | |
|
|
28919bf37c | |
|
|
4090592112 |
|
|
@ -386,7 +386,7 @@ export class CancelKeyboardMacroReportMessage extends RpcMessage {
|
|||
|
||||
constructor(token: string) {
|
||||
super(HID_RPC_MESSAGE_TYPES.CancelKeyboardMacroReport);
|
||||
this.token = (token == null || token === undefined || token === "")
|
||||
this.token = (token == null || token === "")
|
||||
? "00000000-0000-0000-0000-000000000000"
|
||||
: token;
|
||||
}
|
||||
|
|
@ -397,11 +397,11 @@ export class CancelKeyboardMacroReportMessage extends RpcMessage {
|
|||
}
|
||||
|
||||
public static unmarshal(data: Uint8Array): CancelKeyboardMacroReportMessage | undefined {
|
||||
if (data.length == 0) {
|
||||
if (data.length === 0) {
|
||||
return new CancelKeyboardMacroReportMessage("00000000-0000-0000-0000-000000000000");
|
||||
}
|
||||
|
||||
if (data.length != 16) {
|
||||
if (data.length !== 16) {
|
||||
throw new Error(`Invalid cancel message length: ${data.length}`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { TextAreaWithLabel } from "@components/TextArea";
|
|||
import { isOnDevice } from "@/main";
|
||||
import notifications from "@/notifications";
|
||||
import { m } from "@localizations/messages.js";
|
||||
import { sleep } from "@/utils";
|
||||
|
||||
export default function SettingsAdvancedRoute() {
|
||||
const { send } = useJsonRpc();
|
||||
|
|
@ -311,8 +312,10 @@ export default function SettingsAdvancedRoute() {
|
|||
size="SM"
|
||||
theme="light"
|
||||
text={m.advanced_reset_config_button()}
|
||||
onClick={() => {
|
||||
onClick={async () => {
|
||||
handleResetConfig();
|
||||
// Add 2s delay between resetting the configuration and calling reload() to prevent reload from interrupting the RPC call to reset things.
|
||||
await sleep(2000);
|
||||
window.location.reload();
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -4,13 +4,16 @@ import { useNavigate } from "react-router";
|
|||
import { useJsonRpc } from "@hooks/useJsonRpc";
|
||||
import { Button } from "@components/Button";
|
||||
import { m } from "@localizations/messages.js";
|
||||
import { sleep } from "@/utils";
|
||||
|
||||
export default function SettingsGeneralRebootRoute() {
|
||||
const navigate = useNavigate();
|
||||
const { send } = useJsonRpc();
|
||||
|
||||
const onClose = useCallback(() => {
|
||||
const onClose = useCallback(async () => {
|
||||
navigate(".."); // back to the devices.$id.settings page
|
||||
// Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation.
|
||||
await sleep(1000);
|
||||
window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded
|
||||
}, [navigate]);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ export default function SettingsGeneralUpdateRoute() {
|
|||
const { setModalView, otaState } = useUpdateStore();
|
||||
const { send } = useJsonRpc();
|
||||
|
||||
const onClose = useCallback(() => {
|
||||
const onClose = useCallback(async () => {
|
||||
navigate(".."); // back to the devices.$id.settings page
|
||||
// Add 1s delay between navigation and calling reload() to prevent reload from interrupting the navigation.
|
||||
await sleep(1000);
|
||||
window.location.reload(); // force a full reload to ensure the current device/cloud UI version is loaded
|
||||
}, [navigate]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue