feat: add link to syscall

This commit is contained in:
CyberL1 2025-01-16 15:10:16 +01:00
parent 03ddc35df0
commit 4ca8045df9
3 changed files with 10 additions and 1 deletions

View File

@ -17,6 +17,7 @@ export default function Login() {
if (json.message.startsWith("Hello")) { if (json.message.startsWith("Hello")) {
localStorage.setItem("key", data.key.toString()); localStorage.setItem("key", data.key.toString());
localStorage.setItem("hostname", json.message.slice(7).replace("!", ""));
location.reload(); location.reload();
} }
} }

View File

@ -19,7 +19,7 @@ export default function WebTerminal() {
const terminal = new Terminal({ rows: 67 }); const terminal = new Terminal({ rows: 67 });
const socket = new WebSocket( const socket = new WebSocket(
`ws://127.0.0.1:3000/containers/${container.id}/terminal`, `ws://127.0.0.1:3000/containers/${container.id}/terminal`, // TODO: Replace this with dlinux ssh connector
); );
const fitAddon = new FitAddon(); const fitAddon = new FitAddon();

View File

@ -26,11 +26,18 @@ interface Item {
title: string; title: string;
icon: keyof typeof Icons; icon: keyof typeof Icons;
href: string; href: string;
openInNewTab?: boolean;
} }
const sidebarItems: Item[] = [ const sidebarItems: Item[] = [
{ title: "Info", icon: "Info", href: "/container" }, { title: "Info", icon: "Info", href: "/container" },
{ title: "Terminal", icon: "Terminal", href: "/container/terminal" }, { title: "Terminal", icon: "Terminal", href: "/container/terminal" },
{
title: "Syscall",
icon: "Memory",
href: `//${localStorage.getItem("hostname")}.syscall.lol`,
openInNewTab: true,
},
]; ];
const drawerWidth = 240; const drawerWidth = 240;
@ -80,6 +87,7 @@ function App({ error }: { error?: boolean }) {
key={item.title} key={item.title}
component={Link} component={Link}
to={item.href} to={item.href}
target={item.openInNewTab ? "_blank" : "_self"}
disablePadding disablePadding
> >
<ListItemButton> <ListItemButton>