mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-14 08:06:22 +00:00
Update AppImage
This commit is contained in:
@@ -7,7 +7,8 @@ import { Button } from "@/components/ui/button"
|
|||||||
import { Input } from "@/components/ui/input"
|
import { Input } from "@/components/ui/input"
|
||||||
import { Label } from "@/components/ui/label"
|
import { Label } from "@/components/ui/label"
|
||||||
import { Loader2, Activity, GripHorizontal } from "lucide-react"
|
import { Loader2, Activity, GripHorizontal } from "lucide-react"
|
||||||
import { API_PORT } from "../lib/api-config"
|
import "xterm/css/xterm.css"
|
||||||
|
import { API_PORT } from "@/lib/api-config"
|
||||||
|
|
||||||
interface WebInteraction {
|
interface WebInteraction {
|
||||||
type: "yesno" | "menu" | "msgbox" | "input" | "inputbox"
|
type: "yesno" | "menu" | "msgbox" | "input" | "inputbox"
|
||||||
@@ -23,7 +24,7 @@ interface ScriptTerminalModalProps {
|
|||||||
onClose: () => void
|
onClose: () => void
|
||||||
scriptPath: string
|
scriptPath: string
|
||||||
scriptName: string
|
scriptName: string
|
||||||
params?: Record<string, string>
|
scriptDescription?: string
|
||||||
title: string
|
title: string
|
||||||
description: string
|
description: string
|
||||||
}
|
}
|
||||||
@@ -33,7 +34,7 @@ export function ScriptTerminalModal({
|
|||||||
onClose,
|
onClose,
|
||||||
scriptPath,
|
scriptPath,
|
||||||
scriptName,
|
scriptName,
|
||||||
params = {},
|
scriptDescription,
|
||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
}: ScriptTerminalModalProps) {
|
}: ScriptTerminalModalProps) {
|
||||||
@@ -42,7 +43,7 @@ export function ScriptTerminalModal({
|
|||||||
const fitAddonRef = useRef<any>(null)
|
const fitAddonRef = useRef<any>(null)
|
||||||
const sessionIdRef = useRef<string>(Math.random().toString(36).substring(2, 8))
|
const sessionIdRef = useRef<string>(Math.random().toString(36).substring(2, 8))
|
||||||
|
|
||||||
const [isConnected, setIsConnected] = useState(true)
|
const [connectionStatus, setConnectionStatus] = useState<"connecting" | "online" | "offline">("connecting")
|
||||||
const [isComplete, setIsComplete] = useState(false)
|
const [isComplete, setIsComplete] = useState(false)
|
||||||
const [exitCode, setExitCode] = useState<number | null>(null)
|
const [exitCode, setExitCode] = useState<number | null>(null)
|
||||||
const [currentInteraction, setCurrentInteraction] = useState<WebInteraction | null>(null)
|
const [currentInteraction, setCurrentInteraction] = useState<WebInteraction | null>(null)
|
||||||
@@ -161,13 +162,12 @@ export function ScriptTerminalModal({
|
|||||||
wsRef.current = ws
|
wsRef.current = ws
|
||||||
|
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
setIsConnected(true)
|
setConnectionStatus("online")
|
||||||
|
|
||||||
const initMessage = {
|
const initMessage = {
|
||||||
script_path: scriptPath,
|
script_path: scriptPath,
|
||||||
params: {
|
params: {
|
||||||
EXECUTION_MODE: "web",
|
EXECUTION_MODE: "web",
|
||||||
...params,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,12 +232,12 @@ export function ScriptTerminalModal({
|
|||||||
}
|
}
|
||||||
|
|
||||||
ws.onerror = (error) => {
|
ws.onerror = (error) => {
|
||||||
setIsConnected(false)
|
setConnectionStatus("offline")
|
||||||
term.writeln("\x1b[31mWebSocket error occurred\x1b[0m")
|
term.writeln("\x1b[31mWebSocket error occurred\x1b[0m")
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.onclose = (event) => {
|
ws.onclose = (event) => {
|
||||||
setIsConnected(false)
|
setConnectionStatus("offline")
|
||||||
term.writeln("\x1b[33mConnection closed\x1b[0m")
|
term.writeln("\x1b[33mConnection closed\x1b[0m")
|
||||||
|
|
||||||
if (!isComplete) {
|
if (!isComplete) {
|
||||||
@@ -254,7 +254,13 @@ export function ScriptTerminalModal({
|
|||||||
|
|
||||||
checkConnectionInterval.current = setInterval(() => {
|
checkConnectionInterval.current = setInterval(() => {
|
||||||
if (ws) {
|
if (ws) {
|
||||||
setIsConnected(ws.readyState === WebSocket.OPEN)
|
setConnectionStatus(
|
||||||
|
ws.readyState === WebSocket.OPEN
|
||||||
|
? "online"
|
||||||
|
: ws.readyState === WebSocket.CONNECTING
|
||||||
|
? "connecting"
|
||||||
|
: "offline",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
@@ -333,7 +339,7 @@ export function ScriptTerminalModal({
|
|||||||
setInteractionInput("")
|
setInteractionInput("")
|
||||||
setCurrentInteraction(null)
|
setCurrentInteraction(null)
|
||||||
setIsWaitingNextInteraction(false)
|
setIsWaitingNextInteraction(false)
|
||||||
setIsConnected(false)
|
setConnectionStatus("connecting")
|
||||||
}
|
}
|
||||||
}, [isOpen])
|
}, [isOpen])
|
||||||
|
|
||||||
@@ -617,10 +623,28 @@ export function ScriptTerminalModal({
|
|||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Activity className="h-5 w-5 text-blue-500" />
|
<Activity className="h-5 w-5 text-blue-500" />
|
||||||
<div
|
<div
|
||||||
className={`w-2 h-2 rounded-full ${isConnected ? "bg-green-500" : "bg-red-500"}`}
|
className={`w-2 h-2 rounded-full ${
|
||||||
title={isConnected ? "Connected" : "Disconnected"}
|
connectionStatus === "online"
|
||||||
|
? "bg-green-500"
|
||||||
|
: connectionStatus === "connecting"
|
||||||
|
? "bg-blue-500"
|
||||||
|
: "bg-red-500"
|
||||||
|
}`}
|
||||||
|
title={
|
||||||
|
connectionStatus === "online"
|
||||||
|
? "Connected"
|
||||||
|
: connectionStatus === "connecting"
|
||||||
|
? "Connecting"
|
||||||
|
: "Disconnected"
|
||||||
|
}
|
||||||
></div>
|
></div>
|
||||||
<span className="text-xs text-muted-foreground">{isConnected ? "Online" : "Offline"}</span>
|
<span className="text-xs text-muted-foreground">
|
||||||
|
{connectionStatus === "online"
|
||||||
|
? "Online"
|
||||||
|
: connectionStatus === "connecting"
|
||||||
|
? "Connecting..."
|
||||||
|
: "Offline"}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
import type React from "react"
|
import type React from "react"
|
||||||
import { useEffect, useRef, useState } from "react"
|
import { useEffect, useRef, useState } from "react"
|
||||||
import { API_PORT } from "../lib/api-config"
|
import { API_PORT, fetchApi } from "@/lib/api-config" // Unificando importaciones de api-config en una sola línea con alias @/
|
||||||
import { fetchApi } from "@/lib/api-config" // Cambiando import para usar fetchApi directamente
|
|
||||||
import {
|
import {
|
||||||
Activity,
|
Activity,
|
||||||
Trash2,
|
Trash2,
|
||||||
|
|||||||
Reference in New Issue
Block a user