From 2adde048b0c205ef24154389082c3dd862a8c79a Mon Sep 17 00:00:00 2001 From: Khairul Hidayat Date: Wed, 6 Nov 2024 17:32:39 +0000 Subject: [PATCH] feat: add pve vnc session --- frontend/app/index.tsx | 42 ++++-- .../containers/interactive-session.tsx | 35 +++-- frontend/components/containers/terminal.tsx | 4 +- frontend/components/containers/vncviewer.tsx | 90 +++++++++++++ frontend/components/containers/xtermjs.tsx | 17 ++- frontend/package.json | 2 + frontend/pnpm-lock.yaml | 125 +++++++++++++++--- frontend/tsconfig.json | 1 + server/lib/pve.go | 2 +- server/lib/pve_session.go | 85 +++++++++++- server/main.go | 67 +++++----- 11 files changed, 380 insertions(+), 90 deletions(-) create mode 100644 frontend/components/containers/vncviewer.tsx diff --git a/frontend/app/index.tsx b/frontend/app/index.tsx index e67181c..0e95c0b 100644 --- a/frontend/app/index.tsx +++ b/frontend/app/index.tsx @@ -1,13 +1,33 @@ -import { View, Text, ScrollView, Button } from "react-native"; +import { View, ScrollView, Button } from "react-native"; import React, { useState } from "react"; import { Stack } from "expo-router"; -import InteractiveSession from "@/components/containers/interactive-session"; +import InteractiveSession, { + InteractiveSessionProps, +} 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(["1"]); + 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" }, + }, + ]); const [curSession, setSession] = useState(0); return ( @@ -21,18 +41,18 @@ const HomePage = () => { > {sessions.map((session, idx) => (