Compare commits

..

8 Commits

Author SHA1 Message Date
Marc Brooks 65b76b4e42
Merge 70cd19ddbc into 9438ab7778 2025-10-01 16:52:25 +00:00
Marc Brooks 70cd19ddbc
Removed duplicate code between main and devices.$id
The isOneDevice and checkAuth can be leveraged from devices.$id.tsx
2025-10-01 11:49:59 -05:00
Marc Brooks 72e2367011
Fix link for reconnect to point to settings 2025-10-01 11:49:59 -05:00
Marc Brooks d7a56213ea
Added force page reload to the onClose events of update/reboot
Updated the text about reboot/update and used a smaller button.
Ensure we get the correct UI version.
Also fixed comment about the system update progress
2025-10-01 11:49:58 -05:00
Marc Brooks 85c98ee998
Fix comment 2025-10-01 11:49:58 -05:00
Marc Brooks 69f429d0a5
Added exponential backoff to reconnection
Also made the number of reconnect attempts settable
Doesn't attempt a reconnection if we intentionally disconnect
Make sure the fire-and-forget for TURN activity doesn't result in unhandled promise rejection.
2025-10-01 11:49:58 -05:00
Marc Brooks 0984ca7e40
Add ability to request a reload to LinkButton and Link 2025-10-01 11:49:57 -05:00
Marc Brooks 2fce23c5d6
Better reporting of and process for OTA updating 2025-10-01 11:49:57 -05:00
3 changed files with 9 additions and 23 deletions

View File

@ -85,7 +85,7 @@ export async function checkDeviceAuth() {
}
export async function checkAuth() {
return import.meta.env.MODE === "device" ? checkDeviceAuth() : checkCloudAuth();
return isOnDevice ? checkDeviceAuth() : checkCloudAuth();
}
let router;

View File

@ -292,7 +292,7 @@ function UpdatingDeviceState({
<span className="font-medium text-black dark:text-white">
Rebooting the device to complete the update...
</span>
<p className="font-medium text-black dark:text-white">
<p className="flex-col text-black dark:text-white">
This may take a few minutes. The device will automatically
reconnect once it is back online.<br/>
If it doesn{"'"}t reconnect automatically, you can manually
@ -304,7 +304,7 @@ function UpdatingDeviceState({
LeadingIcon={MdConnectWithoutContact}
textAlign="center"
reloadDocument={true}
to={"/"}
to={".."}
/>
</p>
</div>
@ -314,7 +314,7 @@ function UpdatingDeviceState({
<span className="font-medium text-black dark:text-white">
Device reboot is pending...
</span>
<p className="font-medium text-black dark:text-white">
<p className="flex-col text-black dark:text-white">
The JetKVM is preparing to reboot. This may take a while.<br/>
If it doesn{"'"}t automatically reboot after a few minutes, you
can manually request a reboot by clicking here:

View File

@ -1,7 +1,6 @@
import { lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
import {
Outlet,
redirect,
useLoaderData,
useLocation,
useNavigate,
@ -15,7 +14,7 @@ import { FocusTrap } from "focus-trap-react";
import { motion, AnimatePresence } from "framer-motion";
import useWebSocket from "react-use-websocket";
import { CLOUD_API, DEVICE_API } from "@/ui.config";
import { CLOUD_API } from "@/ui.config";
import api from "@/api";
import { checkAuth, isInCloud, isOnDevice } from "@/main";
import { cx } from "@/cva.config";
@ -48,7 +47,6 @@ import {
} from "@/components/VideoOverlay";
import { useDeviceUiNavigation } from "@/hooks/useAppNavigation";
import { FeatureFlagProvider } from "@/providers/FeatureFlagProvider";
import { DeviceStatus } from "@routes/welcome-local";
import { useVersion } from "@/hooks/useVersion";
interface LocalLoaderResp {
@ -70,20 +68,8 @@ export interface LocalDevice {
}
const deviceLoader = async () => {
const res = await api
.GET(`${DEVICE_API}/device/status`)
.then(res => res.json() as Promise<DeviceStatus>);
if (!res.isSetup) return redirect("/welcome");
const deviceRes = await api.GET(`${DEVICE_API}/device`);
if (deviceRes.status === 401) return redirect("/login-local");
if (deviceRes.ok) {
const device = (await deviceRes.json()) as LocalDevice;
return { authMode: device.authMode };
}
throw new Error("Error fetching device");
const device = await checkAuth();
return { authMode: device.authMode } as LocalLoaderResp;
};
const cloudLoader = async (params: Params<string>): Promise<CloudLoaderResp> => {
@ -106,11 +92,11 @@ const cloudLoader = async (params: Params<string>): Promise<CloudLoaderResp> =>
device: { id: string; name: string; user: { googleId: string } };
};
return { user, iceConfig, deviceName: device.name || device.id };
return { user, iceConfig, deviceName: device.name || device.id } as CloudLoaderResp;
};
const loader: LoaderFunction = ({ params }: LoaderFunctionArgs) => {
return import.meta.env.MODE === "device" ? deviceLoader() : cloudLoader(params);
return isOnDevice ? deviceLoader() : cloudLoader(params);
};
export default function KvmIdRoute() {