chore: add ts-ignore where needed

This commit is contained in:
CyberL1 2025-01-16 13:33:08 +01:00
parent e47e87199f
commit 238c5a2cec
6 changed files with 24 additions and 28 deletions

View File

@ -8,6 +8,7 @@ export default function ContainerInfo() {
useEffect(() => {
const updateInfo = async () => {
const stats = await fetch(`https://api.ssh.surf/info`, {
// @ts-ignore
headers: { "x-ssh-auth": localStorage.getItem("key") },
});

View File

@ -9,6 +9,7 @@ export default function Login() {
const data = Object.fromEntries(formData);
const hello = await fetch(`https://api.ssh.surf/hello`, {
// @ts-ignore
headers: { "x-ssh-auth": data.key },
});

View File

@ -58,7 +58,7 @@ export default function WebTerminal() {
terminal.dispose();
};
}
}, []);
}, [container]);
return <div ref={terminalRef} style={{ height: "auto" }} />;
}

View File

@ -8,6 +8,7 @@ import TerminalPage from "./pages/container/terminal.tsx";
async function loader() {
const info = await fetch(`https://api.ssh.surf/info`, {
// @ts-ignore
headers: { "x-ssh-auth": localStorage.getItem("key") },
});

View File

@ -6,15 +6,15 @@ import ContainerInfo from "../../components/ContainerInfo";
export default function ContainerPage() {
let container = useLoaderData();
const revalidator = useRevalidator();
const [isPowerStateLocked, setPowerStateLocked] = useState<boolean>();
if (!container.data) {
return "Container not found";
}
container = container.data as InfoData;
const revalidator = useRevalidator();
const [isPowerStateLocked, setPowerStateLocked] = useState<boolean>();
return (
<Paper square sx={{ padding: 1 }}>
<Paper sx={{ display: "flex" }} variant="outlined">

View File

@ -1,32 +1,25 @@
import { useLoaderData } from "react-router";
import { Container } from "../../types";
import { InfoData } from "../../types";
import { Paper, Typography } from "@mui/material";
import WebTerminal from "../../components/WebTerminal";
export async function Loader() {
const info = await fetch(`https://api.ssh.surf/info`, {
headers: { "x-ssh-auth": localStorage["key"] },
});
const data = await info.json();
return data;
}
export default function TerminalPage() {
const container = useLoaderData() as Container & { statusCode: number };
let container = useLoaderData();
if (container.statusCode === 404) {
return "Container not found";
}
if (!container.data) {
return "Container not found";
}
return (
<Paper square sx={{ padding: 1 }}>
<Paper sx={{ display: "flex" }} variant="outlined">
<Typography variant="h6" sx={{ flexGrow: 1 }}>
Terminal: {container.name}
</Typography>
</Paper>
<WebTerminal />
</Paper>
);
container = container.data as InfoData;
return (
<Paper square sx={{ padding: 1 }}>
<Paper sx={{ display: "flex" }} variant="outlined">
<Typography variant="h6" sx={{ flexGrow: 1 }}>
Terminal: {container.name}
</Typography>
</Paper>
<WebTerminal />
</Paper>
);
}