Add support for Luckfox PicoKVM

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
luckfox-eng29
2025-08-07 14:26:01 +08:00
parent 3e7d8fb0f5
commit 8fbd6bcf0d
114 changed files with 4676 additions and 3270 deletions

View File

@@ -16,7 +16,6 @@ import DashboardNavbar from "@components/Header";
import { User } from "@/hooks/stores";
import { checkAuth } from "@/main";
import Fieldset from "@components/Fieldset";
import { CLOUD_API } from "@/ui.config";
import api from "../api";
@@ -33,43 +32,9 @@ const action = async ({ params, request }: ActionFunctionArgs) => {
return { message: "Please specify a name" };
}
try {
const res = await api.PUT(`${CLOUD_API}/devices/${id}`, {
name,
});
if (!res.ok) {
return { message: "There was an error renaming your device. Please try again." };
}
} catch (e) {
console.error(e);
return { message: "There was an error renaming your device. Please try again." };
}
return redirect("/devices");
};
const loader = async ({ params }: LoaderFunctionArgs) => {
const user = await checkAuth();
const { id } = params;
try {
const res = await fetch(`${CLOUD_API}/devices/${id}`, {
method: "GET",
credentials: "include",
mode: "cors",
});
const { device } = (await res.json()) as {
device: { id: string; name: string; user: { googleId: string } };
};
return { device, user };
} catch (e) {
console.error(e);
return { devices: [] };
}
};
export default function DeviceIdRename() {
const { device, user } = useLoaderData() as LoaderData;
const error = useActionData() as { message: string };
@@ -135,5 +100,4 @@ export default function DeviceIdRename() {
);
}
DeviceIdRename.loader = loader;
DeviceIdRename.action = action;