mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-22 13:36:17 +00:00
Update AppImage
This commit is contained in:
@@ -1,9 +1,16 @@
|
|||||||
"use client"
|
import dynamic from "next/dynamic"
|
||||||
|
|
||||||
import { TerminalPanel } from "@/components/terminal-panel"
|
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||||
import { TerminalIcon } from "lucide-react"
|
import { TerminalIcon } from "lucide-react"
|
||||||
|
|
||||||
|
const TerminalPanel = dynamic(() => import("@/components/terminal-panel").then((mod) => mod.TerminalPanel), {
|
||||||
|
ssr: false,
|
||||||
|
loading: () => (
|
||||||
|
<div className="flex items-center justify-center h-full">
|
||||||
|
<div className="text-muted-foreground">Loading terminal...</div>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
export default function TerminalPage() {
|
export default function TerminalPage() {
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-background p-6">
|
<div className="min-h-screen bg-background p-6">
|
||||||
|
|||||||
@@ -2,9 +2,15 @@
|
|||||||
|
|
||||||
import type React from "react"
|
import type React from "react"
|
||||||
import { useEffect, useRef } from "react"
|
import { useEffect, useRef } from "react"
|
||||||
import { Terminal } from "xterm"
|
|
||||||
import { FitAddon } from "xterm-addon-fit"
|
let Terminal: any
|
||||||
import "xterm/css/xterm.css"
|
let FitAddon: any
|
||||||
|
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
Terminal = require("xterm").Terminal
|
||||||
|
FitAddon = require("xterm-addon-fit").FitAddon
|
||||||
|
require("xterm/css/xterm.css")
|
||||||
|
}
|
||||||
|
|
||||||
type TerminalPanelProps = {
|
type TerminalPanelProps = {
|
||||||
websocketUrl?: string // Custom WebSocket URL if needed
|
websocketUrl?: string // Custom WebSocket URL if needed
|
||||||
@@ -12,15 +18,15 @@ type TerminalPanelProps = {
|
|||||||
|
|
||||||
export const TerminalPanel: React.FC<TerminalPanelProps> = ({ websocketUrl = "ws://localhost:8008/ws/terminal" }) => {
|
export const TerminalPanel: React.FC<TerminalPanelProps> = ({ websocketUrl = "ws://localhost:8008/ws/terminal" }) => {
|
||||||
const containerRef = useRef<HTMLDivElement | null>(null)
|
const containerRef = useRef<HTMLDivElement | null>(null)
|
||||||
const termRef = useRef<Terminal | null>(null)
|
const termRef = useRef<any>(null)
|
||||||
const fitAddonRef = useRef<FitAddon | null>(null)
|
const fitAddonRef = useRef<any>(null)
|
||||||
const wsRef = useRef<WebSocket | null>(null)
|
const wsRef = useRef<WebSocket | null>(null)
|
||||||
|
|
||||||
// For touch gestures
|
// For touch gestures
|
||||||
const touchStartRef = useRef<{ x: number; y: number; time: number } | null>(null)
|
const touchStartRef = useRef<{ x: number; y: number; time: number } | null>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!containerRef.current) return
|
if (!containerRef.current || !Terminal || !FitAddon) return
|
||||||
|
|
||||||
const term = new Terminal({
|
const term = new Terminal({
|
||||||
fontFamily: "monospace",
|
fontFamily: "monospace",
|
||||||
|
|||||||
Reference in New Issue
Block a user