From ab9b3368d1cd709dd7e66ffbc62bfde9bbe4eef0 Mon Sep 17 00:00:00 2001 From: Khairul Hidayat Date: Thu, 7 Nov 2024 04:56:19 +0700 Subject: [PATCH] feat: add incus terminal --- frontend/app/index.tsx | 37 +++--- .../containers/interactive-session.tsx | 25 +++- frontend/components/containers/xtermjs.tsx | 4 +- server/lib/crypto.go | 37 ++++++ server/lib/incus.go | 114 ++++++++++++++++++ server/lib/incus_session.go | 90 ++++++++++++++ server/main.go | 16 ++- 7 files changed, 302 insertions(+), 21 deletions(-) create mode 100644 server/lib/crypto.go create mode 100644 server/lib/incus.go create mode 100644 server/lib/incus_session.go diff --git a/frontend/app/index.tsx b/frontend/app/index.tsx index 0e95c0b..a93e325 100644 --- a/frontend/app/index.tsx +++ b/frontend/app/index.tsx @@ -6,37 +6,40 @@ import InteractiveSession, { } from "@/components/containers/interactive-session"; import PagerView from "@/components/ui/pager-view"; -let nextSession = 1; - type Session = InteractiveSessionProps & { id: string }; const HomePage = () => { const [sessions, setSessions] = useState([ { id: "1", - type: "ssh", - params: { serverId: "1" }, - }, - { - id: "2", - type: "pve", - params: { client: "vnc", serverId: "2" }, - }, - { - id: "3", - type: "pve", - params: { client: "xtermjs", serverId: "3" }, + type: "incus", + params: { client: "xtermjs", serverId: "1", shell: "bash" }, }, + // { + // id: "1", + // type: "ssh", + // params: { serverId: "1" }, + // }, + // { + // id: "2", + // type: "pve", + // params: { client: "vnc", serverId: "2" }, + // }, + // { + // id: "3", + // type: "pve", + // params: { client: "xtermjs", serverId: "3" }, + // }, ]); const [curSession, setSession] = useState(0); return ( - + {sessions.map((session, idx) => ( @@ -46,7 +49,7 @@ const HomePage = () => { >